GetMonsterData: Difference between revisions
Jump to navigation
Jump to search
Complete Lua function catalog |
Document Lua APIs available or improved from G1R:MP 0.1.2 |
||
| Line 1: | Line 1: | ||
= getMonsterData = | = getMonsterData = | ||
<div style="background:#fff5f5; border:1px solid #d13b3b; border-left:5px solid #d13b3b; color:#111111; padding:0.85rem 1rem; margin:0.75rem 0 1rem;"> | |||
<div style="color:#111111; font-weight:bold; letter-spacing:0.04em;">IMPROVED FROM UPDATE 0.1.2</div> | |||
<div style="color:#111111; margin-top:0.25rem;">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.</div> | |||
</div> | |||
Returns the complete authoritative state of a server-owned monster. | Returns the complete authoritative state of a server-owned monster. | ||
| Line 16: | Line 20: | ||
== Returns == | == Returns == | ||
Returns a table containing <code>id</code>, <code>type</code>, | Returns a table containing <code>id</code>, <code>type</code>, <code>name</code>, <code>nameplateIdVisible</code>, <code>x</code>, <code>y</code>, <code>z</code>, <code>yaw</code>, <code>health</code>, <code>maxHealth</code>, <code>attackDamage</code>, <code>state</code>, <code>targetPlayerId</code>, <code>aggressive</code>, <code>alive</code>, and <code>navigationMode</code>; otherwise returns <code>false</code>. | ||
== Examples == | == Examples == | ||
| Line 29: | Line 33: | ||
== Notes == | == Notes == | ||
* Available only in server-side resource scripts. | * Available only in server-side resource scripts. | ||
* Position values use metres and yaw uses degrees. | * Position values use metres and yaw uses degrees. <code>navigationMode</code> is <code>"builtin"</code> or <code>"scripted"</code>. | ||
[[Category:Lua Functions]] | [[Category:Lua Functions]] | ||
Revision as of 18:40, 3 September 2026
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, and navigationMode; 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".