Make lights blink not flicker

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Callous1
Lance Corporal
Posts: 12
Joined: Mon Jan 12, 2004 11:15 pm

Make lights blink not flicker

Post by Callous1 »

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
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

while (1)
if ($player istouching $gate_trigger)
{
$light1 light 0 0 0 64
$corona1 show
wait .5
$light1 light 1 0 0 206
$corona1 hide
wait .5

$light2 light 0 0 0 64
$corona2 show
wait .5
$light2 light 1 0 0 206
$corona2 hide
wait .5
}
else
{
$light1 light 0 0 0 64
$corona1 hide
$light2 light 0 0 0 64
$corona2 hide
wait 1
}
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
Axion
Major General
Posts: 683
Joined: Mon Sep 29, 2003 5:14 am
Location: Northern California
Contact:

Post by Axion »

Have a look at this topic. It might be useful, even though you said you don't want your lights to flicker. Still, you might be able to find something of assistance.

viewtopic.php?t=6267&start=0&postdays=0 ... highlight=
"The work of a thousand years is nothing but rubble."
- Dr. Carl Goerdeler (1943)
Visit my mapping site: http://www.freewebs.com/axion9
Image
Post Reply