OnRested

From NWN Lexicon
Jump to navigationJump to search

The script attached to this event fires when the creature attempts to rest. It can be used to customize the behavior of the creature so that instead of just sitting down it could drink from a tankard or dance around to regain lost hit points.

Trigger

The creature has successfully rested via ActionRest or when a DM clicks their Rest action on the NPC. Note: there is no way to determine if ActionRest has failed - it either triggers the event (on success) or does nothing (eg; if enemies are nearby).

Henchmen resting with their masters also triggers this at the start of the rest only (so you won't know if the NPC has fully rested or not if the PC decides to interrupt it, or something else like enemies appearing does). Throughout the "sit down" portion will report ACTION_REST as their GetCurrentAction however if you wanted to do something special in the duration.

Note the PC resting forcing their NPC allies to is done with a call to ClearAllActions. It is also unclear what happens if the NPC is fighting something or in range of an enemy at the time a PC isn't and chooses to rest (needs investigating).

ForceRest does not fire this event at all, it is instant on PC or NPC and no events are triggered.

Remarks

Creatures don't normally rest so there is no default AI script behavior defined. This fires once, and so GetLastRestEventType will not work with this event (Although if tied to a PC, you can use the PCs OnPlayerRest event to cause NPCs to respond to the end of resting, for instance with a SpeakString or similar).

Known Bugs

Up to version 1.60, this didn't ever ever work. As of 1.60, it does fire.