GetMonsterData
getMonsterData
IMPROVED FROM UPDATE 0.1.2
This function is available in earlier releases and has corrected or expanded behavior in G1R:MP 0.1.2 and later. The contract below describes the updated behavior.
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, name, nameplateIdVisible, x, y, z, yaw, health, maxHealth, attackDamage, state, targetPlayerId, aggressive, alive, navigationMode, and navigationCollisionMode; 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.
navigationModeis"builtin"or"scripted";navigationCollisionModeis"combined","builtin", or"custom".