Got this nifty little lift.
Two buttons. One one top floor, the other one at the bottom floor. They each target a different target_script_trigger that calls the same “function” (lift) but with different subfunction (up/down) You’ll understand with the code below.
What I want to do is pretty simple:
Player hits the top floor button, if lift is up, bring it down. If it’s down, bring the lift up (and when it gets to top floor, he’ll push the button to go down again). Same thing with the bottom button.
Now, what happens is that if I push the top floor button, I hear everything, ie: the sound of the lift but it stays there. :disgust: Exactly the same happens if I push the bottom (floor) button and I’m at the bottom level. BUT! If I noclip myself down and use the button while the lift is up it WILL come down. Same if the lift is down and I push the button from up top! :eek3: Now… I’ve g_debugscript enabled and I see that those up/down functions are hit THREE times when they fire properly. And that’s even if I put resetscript (but I’ve just inserted that so I might gotten it wrong).
Here’s the monster :moo:
lift
{
spawn
{
accum 0 set 1 // Lift position (0 = down, 1 = up)
accum 1 set 0 // Is lift moving?
wait 200 // let things spawn
}
trigger call_lift_bup // bup = button up top
{
accum 0 trigger_if_equal 0 lift bring_lift_up // If lift DOWN move it UP
accum 1 abort_if_not_equal 0 // Dont try to move if already moving
resetscript
accum 1 set 1 // we're moving! :D
playsound sound\movers\elevators\elev1_start.wav
wait 400
playsound sound\movers\elevators\elev1_loop.wav LOOPING
gotomarker path_lift_bottom 50 wait
stopsound
playsound sound\movers\elevators\elev1_end.wav
accum 1 set 0 // we've stopped :(
accum 0 set 0 // down bottom
}
trigger call_lift_bdown // bdown = button down level
{
accum 0 trigger_if_equal 1 lift bring_lift_down // if lift UP move it DOWN
accum 1 abort_if_not_equal 0 // Dont try to move if already moving
resetscript
accum 1 set 1 // we're moving! :D
playsound sound\movers\elevators\elev1_start.wav
wait 400
playsound sound\movers\elevators\elev1_loop.wav LOOPING
gotomarker path_lift_top 50 wait
stopsound
playsound sound\movers\elevators\elev1_end.wav
accum 1 set 0 // we've stopped :(
accum 0 set 1 // up top
}
trigger bring_lift_up
{
accum 1 set 1
playsound sound\movers\elevators\elev1_start.wav
wait 400
playsound sound\movers\elevators\elev1_loop.wav LOOPING
gotomarker path_lift_top 50 wait
stopsound
playsound sound\movers\elevators\elev1_end.wav
accum 1 set 0
accum 0 set 1
resetscript
}
trigger bring_lift_down
{
accum 1 set 1
playsound sound\movers\elevators\elev1_start.wav
wait 400
playsound sound\movers\elevators\elev1_loop.wav LOOPING
gotomarker path_lift_bottom 50 wait
stopsound
playsound sound\movers\elevators\elev1_end.wav
accum 1 set 0
accum 0 set 0
resetscript
}
}
Top button (bup) is linked to target_script_trigger with:
target: call_lift_bup
scriptname: lift
targetname: call_lift_bup_st
Top button’s attributes:
cursorhint: HINT_ACTIVATE
target: call_lift_bup_st
targetname: lift_button_up
Bottom button (bdown) linked to target_script_trigger with:
target: call_lift_bdown
scriptname: lift
targetname: call_lift_bdown_st
Bottom button’s attributes:
target: call_lift_bdown_st
targetname: lift_button_down
cursorhint: HINT_ACTIVATE
Any ideas? :???:
edit: made it clearer… I think 


