Talk:Door

From the CreationKit Wiki
Revision as of 04:47, 17 April 2012 by imported>Tunaisafish (→‎Controlling NPC usage)
Jump to navigation Jump to search

Controlling NPC usage

[Moved from Talk:Papyrus]

Would anyone happen to know how to stop certain actors from opening a certain door? GetTheJojDone 16:10, 15 April 2012 (EDT)

The ways I can think of:
  1. don't given that NPC any packages that could cause it to travel through the door: give it fixed patrols to follow, make it sandbox out of range of the door, etc. This is the most obvious, simplest way, but fails in extreme situations (if you attack them, they might flee through the door still, etc).
  2. make the NPC "bound", as a more restrictive version of the above (problem; they are then unable to walk around).
  3. make the door "min use" (problem: affects all NPCs).
  4. lock the door, and don't give the NPC the key (problem: has no effect once door opens; affects other NPCs).
  5. have a separate navmesh either side of the door, with no connection between the two sides of the door (affects all NPCs; unreliable).
  6. (maybe?) set ownership of the door to everyone but that person? Not sure door ownership matters if unlocked, though.
  7. have a collision primitive around the door and make it so that this NPC is the only thing that collides with it. Not sure if that's even possible.
  8. have a collision primitive around the door with an OnTriggerEnter script that detects that NPC approaching, and changes their chosen package to be "walk away from this door". This way, everyone else can use the door freely, but the door is impassible to that one NPC even if you have made them a follower and are leading them through it (however, they may magically teleport to join you the next time you enter a new cell, if they are a follower).
If it's a teleport door, ensure that the collision primitive encloses the red navmesh triangle for the door, as well as/instead of the door itself.
Beware that this might result in them walking up to the door and back away again repeatedly, if their default package can only be fulfilled by passing through the door.
Beware also that if the player leaves and returns after a few days, that NPC may be randomly placed anywhere in that cell, ignoring primitives and navmesh constraints and sometimes even locked doors! One workaround might be to have another collision primitive to detect the player approaching/leaving, then either move the NPC to a known-valid position on the correct side of the door when the player approaches; or binds the NPC in position, while the player is away.
Hope some of those ideas were useful. --Catwheezle 23:44, 16 April 2012 (EDT)


There are also a few supplied scripts that are meant to control door access; eg. DefaultNoEnemiesFollowDoorScript.psc & DefaultNoFollowDoorScript.psc
Look at those and see if you can configure them to your liking using the properties, or roll your own script using those as an example. -- Tunaisafish 05:47, 17 April 2012 (EDT)