Make lights blink not flicker
Posted: Sun Jan 25, 2004 9:08 pm
In my map one of the boundries will be a railroad crossing that a gate comes down to block road when player is touching trigger multiple.
I have the gate working fine but I would like to add blinking lights as well. I used Mansteins tut on how to do the light on off with the switch to get this far.
http://dynamic5.gamespy.com/%7Emanstein ... cadf5e3a01
My gate trigger is a large area approaching the gate. I want 2 lights to blink alternately. I have 2 script origins using corona_reg.tik for model with targetnames corona1 and corona2 and 2 script models using dummy.tik with targetnames light1 and light2.
I have been able to get the lights to come on and blink proper but can't/don't know how to get them to stop blinking when gate raises after player leaves trigger area.
Here's the relavent parts of my script that I have so far:
thread gate_mover
gate_mover:
$gate_trigger waittill trigger
local.player = parm.other
$gate rotateZdown -90
$gate time 3
$gate move
thread light_on
while (local.player istouching $gate_trigger)
{
waitframe
}
wait 15
thread light_off
$gate rotateZup -90
$gate move
goto gate_mover
end
//-----------------------------------------------------------------------------
light_on:
$light1 light 1 0 0 206
$corona1 show
wait .5
$light1 light 0 0 0 64
$corona1 hide
wait .5
$light2 light 1 0 0 206
$corona2 show
wait .5
$light2 light 0 0 0 64
$corona2 hide
wait .5
goto light_on
end
//-----------------------------------------------------------------------------
light_off:
$light1 light 0 0 0 64
$corona1 hide
$light2 light 0 0 0 64
$corona2 hide
end
//-----------------------------------------------------------------------------
What I get with this is the lights blink when triggered but do not stop blinking, then if player steps back into trigger (before 15 second wait for gate to go back up) it must restart the light_on thread and lights blink wildly.
Any help will be greatly appreciated as I have limited programming/scripting experience.
Thanxs in advance
I have the gate working fine but I would like to add blinking lights as well. I used Mansteins tut on how to do the light on off with the switch to get this far.
http://dynamic5.gamespy.com/%7Emanstein ... cadf5e3a01
My gate trigger is a large area approaching the gate. I want 2 lights to blink alternately. I have 2 script origins using corona_reg.tik for model with targetnames corona1 and corona2 and 2 script models using dummy.tik with targetnames light1 and light2.
I have been able to get the lights to come on and blink proper but can't/don't know how to get them to stop blinking when gate raises after player leaves trigger area.
Here's the relavent parts of my script that I have so far:
thread gate_mover
gate_mover:
$gate_trigger waittill trigger
local.player = parm.other
$gate rotateZdown -90
$gate time 3
$gate move
thread light_on
while (local.player istouching $gate_trigger)
{
waitframe
}
wait 15
thread light_off
$gate rotateZup -90
$gate move
goto gate_mover
end
//-----------------------------------------------------------------------------
light_on:
$light1 light 1 0 0 206
$corona1 show
wait .5
$light1 light 0 0 0 64
$corona1 hide
wait .5
$light2 light 1 0 0 206
$corona2 show
wait .5
$light2 light 0 0 0 64
$corona2 hide
wait .5
goto light_on
end
//-----------------------------------------------------------------------------
light_off:
$light1 light 0 0 0 64
$corona1 hide
$light2 light 0 0 0 64
$corona2 hide
end
//-----------------------------------------------------------------------------
What I get with this is the lights blink when triggered but do not stop blinking, then if player steps back into trigger (before 15 second wait for gate to go back up) it must restart the light_on thread and lights blink wildly.
Any help will be greatly appreciated as I have limited programming/scripting experience.
Thanxs in advance