void main() { // Check to see if the trap door is open. It will return 0 if the // variable has never been set. int currentState=GetLocalInt(OBJECT_SELF,"DOOR_OPEN"); if (currentState==0) { // Display a string, it will be tagged as coming from the name of // the object (trapdoor). ActionSpeakString("The trap door opens with a creak"); // I added a sound object near the trap door with the wood creak sound // and labeled it TrapDoorOpen. SoundObjectPlay(GetObjectByTag("TrapDoorOpen")); // Display the trap door opening, and it will stay opening. ActionPlayAnimation(ANIMATION_PLACEABLE_OPEN); // Make sure that the next time we come through this code we will // use the other segment of code. SetLocalInt(OBJECT_SELF,"DOOR_OPEN",1); } else { // Now that the trap door is open start a conversation, this will // allow the user to select if they wish to descend, or if to stay // up. [I could also add an option to close the door, but don't have // that yet]. // If they choose to descend, see below for an example of the code that // gets used. //BeginConversation("trapdoorconv",GetLastUsedBy()); // If you instead wished to transport them directly, you could use a // Scripts such as the following. // location lLoc = GetLocation(GetObjectByTag("WP_trap")); AssignCommand(GetPCSpeaker(), JumpToLocation(lLoc)); } }