Jump to content

Home

Lock Switch Script


JDKnite188

Recommended Posts

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?

Link to comment
Share on other sites

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" );

}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...