OnMonsterAttack
Jump to navigation
Jump to search
onMonsterAttack
Triggered when server-owned monster AI begins an authoritative attack against a player.
Availability
This event is available in server-side scripts.
Callback signature
onMonsterAttack(monsterId, targetPlayerId, damage, actionId)
Parameters
| Name | Type | Description |
|---|---|---|
monsterId |
string |
The attacking monster ID. |
targetPlayerId |
int |
The targeted player ID. |
damage |
number |
The attack's validated damage. |
actionId |
int |
The replicated monster action ID. |
Examples
Handle the event:
addEventHandler("onMonsterAttack", root, function(monsterId, targetPlayerId, damage, actionId)
outputDebugString("Monster " .. monsterId .. " attacks " .. getPlayerName(targetPlayerId))
end)
Notes
- Player health changes caused by the attack also emit onPlayerDamage and life-state events.