So I have 5 dynamic lights working in the level not including dynamic sun. They are scripted to go on/off relative to player position and depending on time of day. The problem is that all lights seem to behave strangely depending on..
1. Where the player is in the level
2. Rotation of the camera in relation to where the lightsource/surfaces being lit

The level is comprised of all models and sprites except for the invisible skybox which i'm not even sure I need since I use the day/night script by loopix for environment.

Here is my light action code attached to light sources.

action light
{

my.passable = on;
my.transparent = on;

while(1)
{

if(vec_dist(camera.x, my.x)< 6000) // if light entity is within range of camera

{
if((sun_angle.pan > 170)&&(sun_angle.pan < 360)) // and if the sun is over the horizon
{
my.bright = on;
my.ALPHA = 80;
my.LIGHTRED = 195;
my.LIGHTGREEN = 255;
my.LIGHTBLUE = 150;
while (my.LIGHTRANGE < my._l_range) // run this loop until the entity gets to full light range
{
my.LIGHTRANGE = max(0, my.LIGHTRANGE + 15 * time_step); // increase my.LIGHTRANGE (15 = speed)
wait (1);
}

}

if((sun_angle.pan > 20)&&(sun_angle.pan < 180)) // when sun begins to rise
{
my.bright = off;
my.ALPHA = 100;
my.LIGHTRED = 255;
my.LIGHTGREEN = 255;
my.LIGHTBLUE = 150;
while (my.LIGHTRANGE > 0) // run this loop until the entity becomes invisible (LIGHTRANGE = 0)
{
my.LIGHTRANGE = max(0, my.LIGHTRANGE - 15 * time_step); // decrease my.LIGHTRANGE (15 = speed)
wait (1);
}
}
}

else // if light entity is not within range of camera
{
while (my.LIGHTRANGE > 0) // run this loop until the entity becomes invisible (LIGHTRANGE = 0)
{
my.LIGHTRANGE = max(0, my.LIGHTRANGE - 15 * time_step); // decrease my.LIGHTRANGE (15 = speed)
wait (1);
}
}
wait(1);
}
}

Please let me know what I'm doing wrong. Or are the lights supposed to act this way?? Unlit Surfaces Lit surfaces


P4 2.6 ghz 1 gig ram geforce 6600 256 mb GS A7.05 commercial