StopNpcMovement
stopNpcMovement
AVAILABLE FROM UPDATE 0.1.2
This function is available in G1R:MP 0.1.2 and later. The contract below includes the compatibility guarantees introduced in that update.
Stops a resource-owned NPC and clears its current route or direct movement goal without changing its navigation mode.
Syntax
bool stopNpcMovement(int npcId)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
npcId |
int |
yes | The server-assigned NPC identifier returned by spawnNpc or getNpcs.
|
Returns
Returns true when the stop is accepted; otherwise returns false.
Examples
Stop an NPC at its current position:
stopNpcMovement(npcId)
Notes
- Available only in server-side resource scripts.
- Only the resource that created the NPC may stop it.
- The function clears both route state and a scripted direct goal, publishes a reliable stationary state, and leaves
navigationModeunchanged. - An explicit stop does not emit
onNpcMoveComplete. UsesetNpcRouteorsetNpcMoveGoalto start movement again in the matching mode.