SetNpcNavigationMode

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

setNpcNavigationMode

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.

Selects built-in route movement or direct resource-scripted movement for a resource-owned NPC.

Syntax

bool setNpcNavigationMode(int npcId, string mode)

Parameters

Name Type Required Description
npcId int yes The server-assigned NPC identifier returned by spawnNpc or getNpcs.
mode string yes Case-sensitive movement mode: "builtin" or "scripted".

Returns

Returns true when the requested mode is valid and accepted; otherwise returns false.

Examples

Take direct control of an NPC's movement:

if setNpcNavigationMode(npcId, "scripted") then
    setNpcMoveGoal(npcId, 20.0, -7.5, 2.0)
end

Notes

  • Available only in server-side resource scripts.
  • Only the resource that created the NPC may change its navigation mode.
  • New NPCs start in "builtin" mode, where setNpcRoute, server path planning and the selected wait/avoid behavior remain available.
  • In "scripted" mode, direct resource goals bypass built-in route following, path planning and avoidance. Static world blockers and authoritative character-capsule collision remain mandatory.
  • Changing between modes stops the NPC and clears both its current route and direct move goal. Repeating the current mode is a successful no-op.
  • The mode changes movement only. It does not grant client authority or bypass server-owned combat, health or other gameplay rules.
  • Scripted NPC movement is ground-only and does not provide arbitrary vertical control or moving-platform attachment.