OnDeath

From NWN Lexicon
Jump to: navigation, search

OnDeath

The script attached to this event fires when the object dies for any reason. It can be used to force the object to drop treasure, respawn at a new location, or cause a creature to spawn (or reincarnate!).

DestroyObject will not trigger this event, although DM kill will (with an invalid last killer).


Trigger

When the creature, door, or placeable object has been killed (normally by reduction to 0 or less hit points).

Unlike players an NPC instantly goes from 0 to -11HP - there is no OnDying style event for NPCs.

Note a creature will be gibbed if the damage inflicted in the last attack was more than half it's maximum HP, and took them to -11 or more in one hit.

Function(s)

GetLastKiller() returns the object that killed OBJECT_SELF.

See Also

functions:

GetLastKiller