View Full Version : Lock Switch Script

07-13-2003, 07:31 PM
I am planning on making a switch that locks a door switch. The script in other words makes the switch inactive when the switch was active, and vice-versa. How would I go about doing this?

My plan was lock switch entity targets "target_scriptrunner" which activates the script. What would be in the script?

07-13-2003, 07:46 PM
I told you exactly how to do it in your thread at Massassi. If you don't understand something, please tell me and I'll clarify it.

You want a button to unlock or lock a door, a toggle. Okay, so you'll need your lock button to target a target_scriptrunner.

Give the scriptrunner the following keys and values:

PARM1: LOCKED (or UNLOCKED if your door starts unlocked)
PARM2: Targetname of a target_activate which targets your door
Parm3: Targetname of a target_deactivate which targets your door.

Here's the script I would use:

//Generated by BehavEd

rem ( "Toggles an entity locked/unlocked through activation" );
rem ( "Checks the condition of locked/unlocked by reading what PARM1 is," );
rem ( "then sets PARM1 to LOCKED or UNLOCKED, and uses either PARM2 or PARM3," );
rem ( "which contain the targetnames of the target_activate and target_deactivate entities" );
rem ( "which target the lockable entity." );

if ( $get( STRING, "SET_PARM1") = "LOCKED"$ )
use ( $get( STRING, "SET_PARM2")$ );
set ( /*@SET_TYPES*/ "SET_PARM1", "UNLOCKED" );

else ( )
use ( $get( STRING, "SET_PARM3")$ );
set ( /*@SET_TYPES*/ "SET_PARM1", "LOCKED" );

07-14-2003, 01:03 AM
Thanks Emon! My plan was much more simple. The script would move the trigger_multiple out of reach of the player! Crude but easy! Too bad you beat me to a working plan and wasted 6 minutes on it.