Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Image Masking? (https://forums.graalonline.com/forums/showthread.php?t=134269845)

Alpho 02-11-2015 11:55 PM

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!

scriptless 02-12-2015 03:00 AM

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.

callimuc 02-12-2015 05:04 PM

One of the versions Dusty has used made. Kind of equals to this one of him

http://forums.graalonline.com/forums...1&d=1273130160

PHP 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);



Elk 02-12-2015 09:30 PM

we made something like this but its only clientside

its an image overlay and clientside only

http://i.gyazo.com/1bb1a6d0881dc7a0b659ec99c705bde6.png

scriptless 02-13-2015 01:24 AM

Quite impressive actually even client side.

Quote:

Originally Posted by callimuc (Post 1734540)
One of the versions Dusty has used made. Kind of equals to this one of him

http://forums.graalonline.com/forums...1&d=1273130160

PHP 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.

cbk1994 02-13-2015 05:24 PM

Quote:

Originally Posted by Elk (Post 1734557)
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.

Draenin 02-13-2015 07:33 PM

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.

Alpho 02-19-2015 03:25 PM

Quote:

Originally Posted by cbk1994 (Post 1734586)
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.

Alpho 02-19-2015 03:26 PM

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.

callimuc 02-19-2015 04:51 PM

Quote:

Originally Posted by Alpho (Post 1734765)
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 (Post 1734540)
...

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

Alpho 02-20-2015 07:12 PM

Quote:

Originally Posted by callimuc (Post 1734767)
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.

http://i.imgur.com/5Iq49EL.png

Crow 02-21-2015 07:02 AM

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.

Alpho 02-22-2015 02:04 AM

Quote:

Originally Posted by Crow (Post 1734805)
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.

Crow 02-22-2015 06:54 AM

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.

shrimps 02-22-2015 07:00 AM

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?


All times are GMT +2. The time now is 11:42 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.