SetNpcPosition
Jump to navigation
Jump to search
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.