OnMonsterDamage

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

onMonsterDamage

Triggered after authoritative damage changes a monster's health.

Availability

This event is available in server-side scripts.

Callback signature

onMonsterDamage(monsterId, damage, healthAfter, sourcePlayerId, damageKind, sourceResource)

Parameters

Name Type Description
monsterId string The damaged monster ID.
damage number Validated damage applied.
healthAfter number Authoritative health after damage.
sourcePlayerId int The attacking player ID, if any.
damageKind string Damage kind such as melee, bow, crossbow, spell, or script.
sourceResource string The resource associated with the damage.

Examples

Handle the event:

addEventHandler("onMonsterDamage", root, function(monsterId, damage, healthAfter, sourcePlayerId, damageKind, sourceResource)
    outputDebugString("Monster " .. monsterId .. " has " .. healthAfter .. " HP")
end)

Notes

  • Do not apply the same damage again from this observation event.