Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Script for a door

Page: 1 of 1
 Coola
11-22-2006, 4:14 AM
#1
Hey, im just looking for a script that will make a door open.

Thanks in advance!
 Tupac Amaru
11-22-2006, 7:37 AM
#2
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));
}
 Coola
11-23-2006, 12:13 AM
#3
Thanks!
Page: 1 of 1