GetNpcPosition

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search

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.