StopNpcMovement

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 18:40, 3 September 2026 by QCherry (talk | contribs) (Document Lua APIs available or improved from G1R:MP 0.1.2)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 navigationMode unchanged.
  • An explicit stop does not emit onNpcMoveComplete. Use setNpcRoute or setNpcMoveGoal to start movement again in the matching mode.