DamageMonster
Jump to navigation
Jump to search
damageMonster
Applies authoritative scripted damage to a server-owned monster.
Syntax
bool damageMonster(string monsterId, number damage [, int sourcePlayerId = 0])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
monsterId |
string |
yes | The opaque decimal monster identifier returned by spawnMonster or getMonsters.
|
damage |
number |
yes | A finite positive damage amount. |
sourcePlayerId |
int |
no | Optional connected source player identifier, or 0 for world/script damage. |
Returns
Returns true when damage is applied; otherwise returns false.
Examples
Damage a monster from a trap:
damageMonster(monsterId, 15)
Notes
- Available only in server-side resource scripts.
- Player weapon hits use the server's validated combat path; this function is intended for scripted damage sources.
- Successful damage emits
onMonsterDamageand lethal damage emitsonMonsterDeath.