ok I modified the code a little bit that was posted here problem is with my code below the game will crash after running through a few lights doesnt give me any kind of errors just locks up the program.
So I was wondering if someone sees something I dont here cause it seems like it should be fine.
Code:
define fade_end,skill100;
define fade_start,skill99;
define fade_factor,skill98;
define Playerdist,skill97;
define max_range,skill96;
define red_c,skill95;
define green_c,skill94;
define blue_c,skill93;
action Torch
{
my.fade_end = 500;
my.fade_start = 300;
my.max_range = 60;
my.red_c = 214;
my.green_c = 91;
my.blue_c = 39;
my.passable = on;
my.invisible = on;
my.lightrange = 0;
my.red=my.red_c;
my.green=my.green_c;
my.blue=my.blue_c;
while(1)
{
if(player!=null)
{my.Playerdist = vec_dist(my.x,player.x);}
if(my.Playerdist <= my.fade_end && my.Playerdist >= my.fade_start)
{my.lightrange = ((my.fade_end - my.Playerdist) / (my.fade_end - my.fade_start)) * my.max_range;}
if(my.Playerdist > my.fade_end){my.lightrange = 0;}
if(my.Playerdist < my.fade_start){my.lightrange = my.max_range;}
wait(1);
}
}