FANDOM


If this is done through a Conversation, then make an NPC open/close a door is just a matter of applying the script in the "Actions Taken" script handle. NOTE: Remove the nw_walk_wp script from the End Conversation Normally script handle in the convo node. More on this later.

The ScriptEdit

Place this script in the Actions Taken handle on the text node that will cause the NPC to open / close a door. Replace the Word "DOOR_TAG" with the actual tag of the door you want the NPC to open; remember to include the quotes " ". The SetLocked function is included in case the door is locked. The NPC will walk to the door and open it. The script to close the door is very similar and it reverses the order of the SetLocked and Action.

NPC Open DoorEdit

/////////////////////////////////////////////////////////////
// NPC Open Door
/////////////////////////////////////////////////////////////
void main()
{
 	object oDoor = GetObjectByTag("DOOR_TAG");
 	SetLocked(oDoor,FALSE);
 	ActionOpenDoor(oDoor);
}

NPC Close DoorEdit

/////////////////////////////////////////////////////////////
// NPC Close Door
/////////////////////////////////////////////////////////////
void main()
{
 	object oDoor = GetObjectByTag("DOOR_TAG");
 	ActionCloseDoor(oDoor);
 	SetLocked(oDoor,TRUE);
}