SetNpcAmmo: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
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 33: Line 33:
== 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. This documents the next release; public 0.1.4 does not include these additions.
* 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.
* Does not equip or draw a weapon. Updating resources can interrupt preparation.
* Does not equip or draw a weapon. Updating resources can interrupt preparation.

Latest revision as of 07:34, 26 September 2026

setNpcAmmo

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.

Sets one NPC ammunition pool.

Syntax

setNpcAmmo(npcId, kind, quantity)

Parameters

Name Type Required Description
npcId int yes Server-assigned NPC ID returned by spawnNpc; not a player ID.
kind string yes arrows or bolts (independent pools).
quantity int yes Integer ammunition count 0..65535.

Returns

Returns true when accepted, false for a rejected request. Acceptance is not proof of a rendered animation, projectile release or hit.

Examples

setNpcAmmo(npcId, "arrows", 30)

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.
  • Does not equip or draw a weapon. Updating resources can interrupt preparation.