SetNpcPosition: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Update Lua API reference
 
Complete Lua function catalog
 
Line 36: Line 36:
* The update is reliable and also refreshes interest for relevant clients.
* The update is reliable and also refreshes interest for relevant clients.


[[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:55, 15 August 2026

setNpcPosition

Moves a resource-owned scripted NPC to an authoritative position.

Syntax

bool setNpcPosition(int npcId, number x, number y, number z [, number yaw = 0])

Parameters

Name Type Required Description
npcId int yes The server-assigned NPC identifier returned by spawnNpc or getNpcs.
x number yes World X coordinate in metres.
y number yes World Y coordinate in metres.
z number yes World Z coordinate in metres.
yaw number no Optional yaw in degrees; defaults to 0.

Returns

Returns true when the authoritative move is accepted; otherwise returns false.

Examples

Move an NPC to a work point:

setNpcPosition(npcId, 20.0, -7.5, 2.0, 90)

Notes

  • Available only in server-side resource scripts.
  • The update is reliable and also refreshes interest for relevant clients.