SetNpcCombatMovement
setNpcCombatMovement
AVAILABLE FROM UPDATE 0.1.5
This function is available in G1R:MP 0.1.5 and later. The contract below includes the compatibility guarantees introduced in that update.
Configures independent combat pursuit walk/run speed or holding position.
Syntax
setNpcCombatMovement(npcId, settings)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
npcId |
int |
yes | Server-assigned NPC ID returned by spawnNpc; not a player ID. |
settings |
table |
yes | Partial configuration table; unknown fields and invalid values reject the whole change. See details below. |
Returns
Returns true when accepted, false for a rejected request. Acceptance is not proof of a rendered animation, projectile release or hit.
Examples
setNpcCombatMovement(npcId, {mode="run", chase=true, speed=4.5})
-- Hold position but keep in-range attacks:
setNpcCombatMovement(npcId, {chase=false})
Notes
- Server-side only. Mutations require the NPC to belong to the calling resource; getters do not grant control.
- Since 0.1.5. Use the matching 0.1.5 client and server (Protocol 37).
- Use matching updated client and server. See NPC scripting for lifecycle, defaults, combat examples and collision limitations.
- Fields: chase (boolean, default true), mode (walk/run, default walk), speed (m/s; walk 0.1..2.5, run 2.6..8). Mode without speed picks walk=1.8 or run=4.5. chase-only preserves speed/mode. chase=false holds position but permits in-range attacks. Does not start combat, alter patrol speed or restart weapon/aim preparation. Use setNpcPaused for a full pause.