GetMonsterData
getMonsterData
Returns the complete authoritative state of a server-owned monster.
Syntax
table|false getMonsterData(string monsterId)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
monsterId |
string |
yes | The opaque decimal monster identifier returned by spawnMonster or getMonsters.
|
Returns
Returns a table containing id, type, position, yaw, health, maximum health, state, target player, aggression, and alive state; otherwise returns false.
Examples
Inspect a monster:
local monster = getMonsterData(monsterId)
if monster then
outputDebugString(monster.type .. " HP: " .. monster.health .. "/" .. monster.maxHealth)
end
Notes
- Available only in server-side resource scripts.
- Position values use metres and yaw uses degrees.