As I said, it wasn't tested. I based it on a script I made for fading far entities out, and that worked perfectly.
Thanks for posting, you are obviously the onlyh person who actually tried it. Since you are interested I will go back and debug this for you. I can see a couple of problems just looking at it again now. I'm flat out at work, so I might be a few days.
Until then, you can try this. Did I get it right this time?
Code:
temp_distance = vec_dist (my.x, player.x);
fade_factor = (temp_distance - fade_start) / (fade_end * (1 - fade_start / fade_end);
r = fade_factor * my.skill2;
g = fade_factor * my.skill3;
b = fade_factor * my.skill4;
//I forgot to actually set it!
vec_set(my.red, vector(r,g,b));
//Turn off when no more light
//The previous method would have turned the light off when there was no more red only
var temp[3]; //declare this up near the top with the other variables
vec_diff(temp, my.skill2, vector(2,2,2)); //Try 1,1,1; but GS might be inaccurate
if(vec_length(temp) < 2) //Try 1, but GS might be inaccurate
{
my.lightrange = 0;
}else
{
my.lightrange = my.skill1;
}
[\code]
This is off the top of my head, but I feel quite confident about it.