Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-11-2015, 11:55 PM
Alpho Alpho is offline
Registered User
Alpho's Avatar
Join Date: Dec 2011
Location: California, USA
Posts: 80
Alpho will become famous soon enough
Image Masking?

Hello! I was making a forest level and I am curious if there is a way to do image masking? I want to make a semi-transparent circle around my player so you could be seen in the trees only around your player! Is there anything that could work? Thanks!
Reply With Quote
  #2  
Old 02-12-2015, 03:00 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
I think if you draw a drawing panel over the whole window you can draw on that and perhaps mask it out. I think dusty mentioned this a while back.
Reply With Quote
  #3  
Old 02-12-2015, 05:04 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
One of the versions Dusty has used made. Kind of equals to this one of him



Graal Script Code:
//#CLIENTSIDE
function onPlayerenters() {
  for (
temp.i=0;i<33*33;i++) {
    
showimg(1000+i,"light2.png",((i%32)*2)-4,(int(i/32)*2)-4);
    
/*showpoly(1000+i,{
      ((i%32)*2),(int(i/32)*2),
      ((i%32)*2)+2,(int(i/32)*2),
      ((i%32)*2)+2,(int(i/32)*2)+2,
      ((i%32)*2),(int(i/32)*2)+2
    });*/
    
changeimgmode(1000+i,2);
    
changeimgzoom(1000+i,2);
    
changeimgcolors(1000+i,.99,.99,.99,.99);
  }
  
onTimeout();
}
function 
onTimeout() {
  
temp.lgts = new[0];
  for (
temp.i=0;i<33*33;i++) findimg(1000+i).alpha .99;
  
temp.mx int((mousex-1-5)/2);
  
temp.my int((mousey-1-5)/2);
  
lgts.add({mx,my,6});
  for (
temp.pl:players) {
    if (
pl.account == player.account) {
      
temp.mx int((pl.x+.5-9)/2);
      
temp.my int((pl.y+1-9)/2);
      
lgts.add({mx,my,10});
    } else {
      
temp.mx int((pl.x+.5-5)/2);
      
temp.my int((pl.y+1-5)/2);
      
lgts.add({mx,my,6});
    }
  }
  for (
temp.j:lgts) {
    for (
temp.i=0;i<j[2]^2;i++) {
      
temp.dx = (j[0]+(i%j[2])) - (j[0]+(j[2]/2));
      
temp.dy = (j[1]+int(i/j[2])) - (j[1]+(j[2]/2));
      
temp.dist = (dx^dy^2)^.5;
      
temp.img 1000+(j[0]+(i%j[2]))+((j[1]+int(i/j[2]))*32);
      
//findimg(img).alpha = 0;
      //findimg(img).alpha -= (1-(dist/(j[2]/2)));
      
findimg(img).alpha dist/(j[2]*5);
      if (
findimg(img).alpha .99findimg(img).alpha .99;
    }
  }
  
setTimer(0.05);

__________________
MEEP!
Reply With Quote
  #4  
Old 02-12-2015, 09:30 PM
Elk Elk is offline
Sr Marketing Strategist
Elk's Avatar
Join Date: Nov 2005
Location: Deerland
Posts: 3,829
Elk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant future
Send a message via ICQ to Elk Send a message via AIM to Elk Send a message via MSN to Elk Send a message via Yahoo to Elk Send a message via Skype™ to Elk
we made something like this but its only clientside

its an image overlay and clientside only

__________________
iEra IGN: *Elk (Darkshire)
iCla. IGN: *Elk (Darkshire)
iZone IGN: *Elk (Darkshire)




Reply With Quote
  #5  
Old 02-13-2015, 01:24 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quite impressive actually even client side.

Quote:
Originally Posted by callimuc View Post
One of the versions Dusty has used made. Kind of equals to this one of him



Graal Script Code:
//#CLIENTSIDE
function onPlayerenters() {
  for (
temp.i=0;i<33*33;i++) {
    
showimg(1000+i,"light2.png",((i%32)*2)-4,(int(i/32)*2)-4);
    
/*showpoly(1000+i,{
      ((i%32)*2),(int(i/32)*2),
      ((i%32)*2)+2,(int(i/32)*2),
      ((i%32)*2)+2,(int(i/32)*2)+2,
      ((i%32)*2),(int(i/32)*2)+2
    });*/
    
changeimgmode(1000+i,2);
    
changeimgzoom(1000+i,2);
    
changeimgcolors(1000+i,.99,.99,.99,.99);
  }
  
onTimeout();
}
function 
onTimeout() {
  
temp.lgts = new[0];
  for (
temp.i=0;i<33*33;i++) findimg(1000+i).alpha .99;
  
temp.mx int((mousex-1-5)/2);
  
temp.my int((mousey-1-5)/2);
  
lgts.add({mx,my,6});
  for (
temp.pl:players) {
    if (
pl.account == player.account) {
      
temp.mx int((pl.x+.5-9)/2);
      
temp.my int((pl.y+1-9)/2);
      
lgts.add({mx,my,10});
    } else {
      
temp.mx int((pl.x+.5-5)/2);
      
temp.my int((pl.y+1-5)/2);
      
lgts.add({mx,my,6});
    }
  }
  for (
temp.j:lgts) {
    for (
temp.i=0;i<j[2]^2;i++) {
      
temp.dx = (j[0]+(i%j[2])) - (j[0]+(j[2]/2));
      
temp.dy = (j[1]+int(i/j[2])) - (j[1]+(j[2]/2));
      
temp.dist = (dx^dy^2)^.5;
      
temp.img 1000+(j[0]+(i%j[2]))+((j[1]+int(i/j[2]))*32);
      
//findimg(img).alpha = 0;
      //findimg(img).alpha -= (1-(dist/(j[2]/2)));
      
findimg(img).alpha dist/(j[2]*5);
      if (
findimg(img).alpha .99findimg(img).alpha .99;
    }
  }
  
setTimer(0.05);

Thanks for finding that, thats exactly what I was referring to.
Reply With Quote
  #6  
Old 02-13-2015, 05:24 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Elk View Post
we made something like this but its only clientside

its an image overlay and clientside only
Does this work with multiple points of light? If so, I'd be curious how you achieved it.
__________________
Reply With Quote
  #7  
Old 02-13-2015, 07:33 PM
Draenin Draenin is offline
Magnificent Bastard
Draenin's Avatar
Join Date: Dec 2004
Location: Bermuda Triangle
Posts: 6,790
Draenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud of
Send a message via AIM to Draenin Send a message via MSN to Draenin Send a message via Yahoo to Draenin Send a message via Skype™ to Draenin
Both of these examples are really nice. Fantastic job, guys.

And yeah, overlays are generally the easier way to go, and you'll have a lot of options for playing around with them.
Reply With Quote
  #8  
Old 02-19-2015, 03:25 PM
Alpho Alpho is offline
Registered User
Alpho's Avatar
Join Date: Dec 2011
Location: California, USA
Posts: 80
Alpho will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
Does this work with multiple points of light? If so, I'd be curious how you achieved it.
I think that's just one image with transparency in the center which they have stretched to fit the screen and focused on their player.
Reply With Quote
  #9  
Old 02-19-2015, 03:26 PM
Alpho Alpho is offline
Registered User
Alpho's Avatar
Join Date: Dec 2011
Location: California, USA
Posts: 80
Alpho will become famous soon enough
I still haven't been able to figure out how to achieve the OP. Is it even possible with GS2? I have a forest of trees and I want to be able to have a semi-transparent cut-out around the player so you can see yourself while you walk behind the trees. The circle would follow your player as you walk through the trees.
Reply With Quote
  #10  
Old 02-19-2015, 04:51 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by Alpho View Post
I still haven't been able to figure out how to achieve the OP. Is it even possible with GS2? I have a forest of trees and I want to be able to have a semi-transparent cut-out around the player so you can see yourself while you walk behind the trees. The circle would follow your player as you walk through the trees.
Quote:
Originally Posted by callimuc View Post
...
I'd believe the information inside that post is enough to have you accomplish whatever you're trying to do? Else you might want to elaborate more or make a rough image of whatever your goal is
__________________
MEEP!
Reply With Quote
  #11  
Old 02-20-2015, 07:12 PM
Alpho Alpho is offline
Registered User
Alpho's Avatar
Join Date: Dec 2011
Location: California, USA
Posts: 80
Alpho will become famous soon enough
Quote:
Originally Posted by callimuc View Post
I'd believe the information inside that post is enough to have you accomplish whatever you're trying to do? Else you might want to elaborate more or make a rough image of whatever your goal is
I made this on photoshop. The semi-transparent cut-out would follow your player while behind trees.

Reply With Quote
  #12  
Old 02-21-2015, 07:02 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
You're not looking for image masking, then. Just display a gani of the player directly on the player, with a lower opacity. You won't get the blending mode used in your mockup, but it's acceptable I guess.
__________________
Reply With Quote
  #13  
Old 02-22-2015, 02:04 AM
Alpho Alpho is offline
Registered User
Alpho's Avatar
Join Date: Dec 2011
Location: California, USA
Posts: 80
Alpho will become famous soon enough
Quote:
Originally Posted by Crow View Post
You're not looking for image masking, then. Just display a gani of the player directly on the player, with a lower opacity. You won't get the blending mode used in your mockup, but it's acceptable I guess.
Even if there isn't a semi-transparent circle, and its just a circle, I want the player to see a few tiles around them so they can find chests and such hidden in the trees.
Reply With Quote
  #14  
Old 02-22-2015, 06:54 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Ah, I didn't see the circle. That's a splendid idea, but I'm afraid it's not going to be possible with Graal.
__________________
Reply With Quote
  #15  
Old 02-22-2015, 07:00 AM
shrimps shrimps is offline
Butterscotch Pudding
shrimps's Avatar
Join Date: Aug 2005
Location: Red Bank, Tennessee
Posts: 1,127
shrimps is a splendid one to beholdshrimps is a splendid one to beholdshrimps is a splendid one to beholdshrimps is a splendid one to behold
Is it not possible to do something similar to how Graal Kingdoms Labyrinth event is?
Although be the whole thing is black other than an area around you, couldn't you apply that "blackness" to the image of trees?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:37 PM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.