GetNpcPosition: Difference between revisions
Jump to navigation
Jump to search
Update Lua API reference |
Complete Lua function catalog |
||
| Line 31: | Line 31: | ||
* Coordinates use metres and yaw uses degrees. | * Coordinates use metres and yaw uses degrees. | ||
[[Category:Lua Functions]] | |||
[[Category:Server Functions]] | [[Category:Server Functions]] | ||
[[Category:World Functions]] | [[Category:World Functions]] | ||
[[Category:NPC Functions]] | [[Category:NPC Functions]] | ||
Latest revision as of 09:52, 15 August 2026
getNpcPosition
Returns a scripted NPC's authoritative position and yaw.
Syntax
table|false getNpcPosition(int npcId)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
npcId |
int |
yes | The server-assigned NPC identifier returned by spawnNpc or getNpcs.
|
Returns
Returns a table with x, y, z, yaw and matching numeric indices, or false.
Examples
Read an NPC position:
local position = getNpcPosition(npcId)
if position then
outputDebugString(position.x .. ", " .. position.y)
end
Notes
- Available only in server-side resource scripts.
- Coordinates use metres and yaw uses degrees.