OnNpcDamage

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search

onNpcDamage

AVAILABLE FROM UPDATE 0.1.5
This event is available in G1R:MP 0.1.5 and later. The contract below includes the compatibility guarantees introduced in that update.

Reports authoritative incoming NPC damage after state commit.

Availability

This event is available in server-side scripts.

Callback signature

function(npcId, sourceId, damage, kind, healthAfter)

Parameters

Name Type Description
npcId int Damaged NPC.
sourceId int Damage source actor ID.
damage number Applied damage.
kind string Damage kind.
healthAfter number Committed remaining HP.

Notes

  • Listen with addEventHandler(eventName, root, handler). Server observation/event, not client authority.
  • Invulnerable/rejected hits do not subtract HP. Lethal accepted damage also emits onNpcDeath. Direct HP setters are not damage events.
  • See NPC scripting and Update 0.1.5.