SetNpcCombatConfig
setNpcCombatConfig
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.
Updates NPC projectile combat configuration atomically.
Syntax
setNpcCombatConfig(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
setNpcCombatConfig(npcId, {range=3, aimTimeMs=600, consumeMana=true})
Notes
- Server-side only. Mutations require the NPC to belong to the calling resource; getters do not grant control.
- Since 0.1.5. This documents the next release; public 0.1.4 does not include these additions.
- Use matching updated client and server. See NPC scripting for lifecycle, defaults, combat examples and collision limitations.
- Fields: range (metres 1..40, default 15), dexterity (0..100000, default 10), skillTier (integer 0..2, default 0), aimTimeMs (integer 150..30000, default 600), cooldownMs (integer 360..60000, default 1000), consumeAmmo/consumeMana (booleans, default true). Spell range/cooldown still apply. Configuration changes interrupt pending preparation. Disabling consumption still requires sufficient initial resources.