Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Light Effect Help (https://forums.graalonline.com/forums/showthread.php?t=134264604)

Ohk4y 09-21-2011 01:22 AM

Light Effect Help
 
Hello, I'm trying to simulate being in a cave on my server and I was thinking I could show a polygon that covered the whole screen except for a little circle around your player.

Here's my current script to show a black screen:
PHP Code:

    showpoly(210, {
        
00screenwidth0screenwidthscreenheight0screenheight
    
});
    
changeimgcolors(2100001); 

How could I modify this to show only the area around your player? Like maybe 1 - 2 tiles around your player.

Gunderak 09-21-2011 09:40 AM

I think a light effect would look nicer.
*Just my personal opinion*
however if you do decide to go with a light effect iv scripted this, its as close to realistic as i can get it.
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
onTimeout();
}

function 
onTimeout() {
  
with(findimg(200)) {
    
attachtoowner true;
    
attachoffset = {
      -
2.55, -2.60
    
};
    
image "light4.png";
    
layer 0;
    
mode 0;
    
zoom 1.5;
    
red 1;
    
green 0.5;
    
blue 0.2;
    
alpha 0.99;
  }
  
settimer(0.05);



Tricxta 09-21-2011 10:26 AM

Quote:

Originally Posted by Ohk4y (Post 1668730)
Hello, I'm trying to simulate being in a cave on my server and I was thinking I could show a polygon that covered the whole screen except for a little circle around your player.

Here's my current script to show a black screen:
PHP Code:

    showpoly(210, {
        
00screenwidth0screenwidthscreenheight0screenheight
    
});
    
changeimgcolors(2100001); 

How could I modify this to show only the area around your player? Like maybe 1 - 2 tiles around your player.

you have some problems here o_0 your drawing on the tile layer yet using pixel co-ordinates, if you want to draw around the player you would construct it of 4 polygons and draw it on the tile layer instead of the gui layer because the focus of the player changes. You can also calculate the outer co-ordinates of a circle using:
PHP Code:

x=cos(angle)*radius;
y=sin(angle)*radius

I could give you the script to solve your problem but where's the fun in that ;)
I hope this helps you.

iBeatz 09-21-2011 06:29 PM

Or instead of going to the trouble of making a polygon circle, you could just make an image which gets more transparent towards the middle, and then surround the image with black polygons, giving the same effect but with less difficulty.


All times are GMT +2. The time now is 07:20 AM.

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