Prevent killing NPCs¶
This hook supports all four engines. Define zDExt_Npc_CanKill in Scripts/Content to control whether damage may mark an NPC as dead.
The function runs after the engine evaluates damage conditions, including damage that is not fatal. If the engine marks the target as dead and the function returns FALSE, the hook clears the dead flag and sets the unconscious flag. It does not cancel damage or restore health. It is separate from finishing attacks.
attacker– NPC causing the damage; may be a null instance for damage without an NPC attackertarget– NPC receiving the damagereturn–FALSE(zero) to replace the dead state with unconsciousness;TRUE(nonzero) to keep the engine result. A failed script call keeps the engine result and logs the failure.