SetNpcCombatConfig: Difference between revisions
Jump to navigation
Jump to search
Document new NPC/player-mode API and events available from 0.1.5 |
Release G1R:MP 0.1.5 BUILD144 / Protocol 37; update availability and migration |
||
| Line 31: | Line 31: | ||
== Notes == | == Notes == | ||
* Server-side only. Mutations require the NPC to belong to the calling resource; getters do not grant control. | * Server-side only. Mutations require the NPC to belong to the calling resource; getters do not grant control. | ||
* Since 0.1.5. | * 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. | * 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. | * 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. | ||
Latest revision as of 07:34, 26 September 2026
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. 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: 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.