Rules for taking an NPC
Things to know
- Your claim ends by itself when the NPC dies. The framework notices on its next call, so a later
ReleasereturnsfalseandIsTakenisfalse. If your mod callsTakeagain with the same NPC id after the NPC moved to a new body in the game, the old claim is dropped and the new body is taken. That drop puts back the same thingsReleasedoes, which for a dead NPC is the fade distance only. - Things are put back only when the game has not changed them since. The fade distance is put back only while it still holds the value the framework set.
Movementis the one flag that sets a value to hold the NPC, so releasing it writes the walking switch back. It does not turn movement on while the NPC is sitting in a chair or asleep, because the game turns movement on again when the NPC stands up or wakes.Sight,TalkandBarkschange no value. The framework checks their flags whenever the game asks, so releasing them takes effect at once. ReleaseandReleaseAllalways work. The game’s save does not write anything the framework changes, so the framework does nothing special at save time.- This API raises no events.
Limits
- Only NPCs that are really in the scene can be taken.
Takeneeds a loaded NPC that is alive. An NPC that is switched off only because the game hid it for being far away can be taken. With theFadeflag, an NPC that is switched off only because the camera hid it can be taken too. - An NPC switched off for any other reason is refused, and so is a camera-hidden NPC taken without
Fade. An unknown, dead or off-scene NPC is refused. Takeis refused while a save loads or is being written.- A bad
modIdor a flags value that is not a mix of the members above throws anArgumentException. A game failure is logged once and the call returnsfalse. Nothing else throws. (ThemodIdis checked by the framework’s mod id rules.flagsoutsideNpcControlFlags.Allare refused.)