Make an NPC open/close a door

Make an NPC Open / Close a Door
If this is done through a Conversation then 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 latter.

Place this script in the Actions Taken handle on the text node that you want the NPC to open / close a door. Replace the Word "DOOR_TAG" with the actual TAG of the door you want him to open, include the quotes "". The SetLocked function is included in case the door is locked. Your NPC will walk to the door and Open it. The script to close the Door is very similar, however we must reverse the order of the SetLocked and Action.

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

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