Jump to content

Home

Script for a door


Coola

Recommended Posts

In TSL, there are two premade scripts that can used in dialogues: a_open_door will open and unlock a door, and a_lock_door will close and lock a door. The string parameter must be the tag of the door. The parameter P1 is an optional delay. They should not be used if there are several doors with the same tag in a module, though.

 

To write your own scripts, the command ActionOpenDoor opens a door. Assign it to the door object.

If the door is locked then it needs to be unlocked as well. This can be done with SetLocked. It needs two parameters: the object for the door and a boolean (FALSE to unlock, TRUE to lock the door).

 

This script opens and unlocks a door:

void main() {
 object oDoor = GetObjectByTag("doortag");
 SetLocked(oDoor, FALSE);
 AssignCommand(oDoor, ActionOpenDoor(oDoor));
}

This one closes and locks the door:

void main() {
 object oDoor = GetObjectByTag("doortag");
 SetLocked(oDoor, TRUE);
 AssignCommand(oDoor, ActionCloseDoor(oDoor));
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...