OnMonsterDeath
onMonsterDeath
Triggered when a synchronized monster's authoritative health reaches zero.
Availability
This event is available in server-side scripts.
Callback signature
onMonsterDeath(monsterId, killerPlayerId, sourceResource)
Parameters
| Name | Type | Description |
|---|---|---|
monsterId |
string |
The dead monster ID. |
killerPlayerId |
int |
The responsible player ID, if any. |
sourceResource |
string |
The resource associated with the death. |
Examples
Handle the event:
addEventHandler("onMonsterDeath", root, function(monsterId, killerPlayerId, sourceResource)
outputDebugString("Monster " .. monsterId .. " was killed by player " .. killerPlayerId)
end)