SetNpcNavigationCollisionMode
Jump to navigation
Jump to search
setNpcNavigationCollisionMode
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 which static navigation-collision layers a resource-owned NPC uses.
Syntax
bool setNpcNavigationCollisionMode(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 collision source: "combined", "builtin", or "custom".
|
Returns
Returns true when the NPC, ownership and mode are valid; otherwise returns false.
Examples
Run an NPC route against only server-scripted blockers:
setNpcNavigationCollisionMode(npcId, "custom")
setNpcRoute(npcId, routePoints)
Notes
- Available only in server-side resource scripts.
- New NPCs start in
"combined"mode."combined"uses the baked MainMap layer plus all enabled custom blockers,"builtin"uses only the baked layer, and"custom"uses only custom blockers. - The setting is independent from
setNpcNavigationMode: collision mode selects static blocker sources, while navigation mode selects route AI or a direct scripted goal. - Authoritative player, NPC and monster capsule separation always remains active in every mode.
- Changing the mode invalidates cached paths. A custom-blocker mutation also replans any affected active route before its next movement step.
getNpcDatareturns the current value asnavigationCollisionMode. - Only the resource that created the NPC may change this setting.