OnMonsterDeath

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 22:31, 14 August 2026 by QCherry (talk | contribs) (Update Lua event reference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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)