Page 1 of 1

Disabling a switch for 2 secs ?

Posted: Wed Mar 03, 2004 12:34 am
by Jack Ruby
Well I released my map but errors are being reported already :( Which is bad but good as I will be able to fix them, at least I hope I can.

I have two switches that move things, a bridge rotates up and a walkway thing moves horizontally.

The errors come when the switch gets hit repeatedly in quick succession, so as the bridge is lowering someone hits the switch before the bridge completes its movement and it either gets stuck in mid air, rotates in the completely wrong direction or strangely gets confused as to which direction it should move, its meant to lower for allies raises for axis( hope that made some sense ).

So I was thinking is there a way to disable the switch for say 2 seconds after its been hit, then it complete its movement and hopefully not get confused when its hit again ? Or maybe theres another way around it ?

Heres the script for these two switches:

//--------------------------------------------------------------
//The lock gate
//--------------------------------------------------------------
artillerystrike_switch:

if( level.bArtillerySwitchUp == 1 )
{
$lockgate moveSouth 544 // To open it
$lockgate move // or waitmove
$artillerystrike_origin speed 1.0
$artillerystrike_origin rotatexdownto 180
$artillerystrike_origin waitmove
$artillerystrike_origin playsound switchbox
level.bArtillerySwitchUp = 0
}
else
{
$lockgate moveNorth 544 // To close it
$lockgate move // or waitmove
$artillerystrike_origin rotatexupto 0
$artillerystrike_origin waitmove
level.bArtillerySwitchUp = 1
}

end

//--------------------------------------------------------------
//The Bridge
//--------------------------------------------------------------
airstrike_switch:

if( level.bAirStrikeSwitchUp == 1 )
{
$bridge rotateZdown 90
$bridge move
$airstrike_origin speed 1.0
$airstrike_origin rotatexdownto 180
$airstrike_origin waitmove
$airstrike_origin playsound switchbox
level.bAirStrikeSwitchUp = 0
}
else
{
$bridge rotateZup 90
$bridge move
$airstrike_origin rotatexupto 0
$airstrike_origin waitmove
level.bAirStrikeSwitchUp = 1
}

end

Posted: Wed Mar 03, 2004 1:02 am
by omniscient
in the part where the birdge moves try
$switch remove
wait 2
$switch show

i dunno if switch was urs, i didnt read the code, but thats what u need to do.

nottriggerable

Posted: Wed Mar 03, 2004 1:56 am
by tltrude
Use lines like these to disable and enable the triggers.

$my_triggers_name nottriggerable
$my_triggers_name triggerable

You can hide and show entities, but they are still there (just invisible). And, if you used "switch" as a tragetname the script would crash (switch is a command word).

Posted: Wed Mar 03, 2004 2:54 am
by omniscient
doesnt "remove" actually take it out (like it isnt there)

Posted: Wed Mar 03, 2004 12:02 pm
by Jack Ruby
Thanks guys, I am such a novice scripter I need to know exactly where to put the additional script.

Would it be possible for you to walk me through it ?

Posted: Wed Mar 03, 2004 2:58 pm
by M&M
i wouldnt call my self a scripter ,but shouldnt waitmove be the command ur looking 4.i mean u make the trigger wait 4 the bridge 2 move b4 being triggerable again (instead of wait #secs)

Posted: Wed Mar 03, 2004 5:53 pm
by vonderbakluft
Example:
If the trigger has the targetname mytrigger

//--------------------------------------------------------------
//The lock gate
//--------------------------------------------------------------
artillerystrike_switch:

$mytrigger nottriggerable //inmediately disable it to avoid dual use

if( level.bArtillerySwitchUp == 1 )
{
$lockgate moveSouth 544 // To open it
$lockgate move // or waitmove
$artillerystrike_origin speed 1.0
$artillerystrike_origin rotatexdownto 180
$artillerystrike_origin waitmove
$artillerystrike_origin playsound switchbox
level.bArtillerySwitchUp = 0
}
else
{
$lockgate moveNorth 544 // To close it
$lockgate move // or waitmove
$artillerystrike_origin rotatexupto 0
$artillerystrike_origin waitmove
level.bArtillerySwitchUp = 1
}


wait 2
$mytrigger triggerable //to be used again
end


Makes the trigger useable again 2 seconds after the movement is done

Von

Posted: Wed Mar 03, 2004 6:48 pm
by Jack Ruby
Thanks a million Von, I cant test it until I hook up with another player in the map but will let you know how it works out.

Thanks again.

Posted: Thu Mar 04, 2004 1:09 am
by omniscient
M&M wrote:i wouldnt call my self a scripter ,but shouldnt waitmove be the command ur looking 4.i mean u make the trigger wait 4 the bridge 2 move b4 being triggerable again (instead of wait #secs)
whoa.
hes right.

Posted: Thu Mar 04, 2004 1:43 am
by nuggets
waitmove will work just fine

$something remove //will delete the entity
$something show //will make an entity visible if
$something hide //has already been done