SetNpcWeaponMode

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 07:34, 26 September 2026 by QCherry (talk | contribs) (Release G1R:MP 0.1.5 BUILD144 / Protocol 37; update availability and migration)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

setNpcWeaponMode

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.

Draws or holsters the NPC weapon/spell.

Syntax

setNpcWeaponMode(npcId, mode)

Parameters

Name Type Required Description
npcId int yes Server-assigned NPC ID returned by spawnNpc; not a player ID.
mode string yes none, fist, melee, bow, crossbow or magic. none means holstered, not an empty inventory.

Returns

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

Examples

setNpcWeapon(npcId, "1h_sword_short_02")
setNpcWeaponMode(npcId, "melee")

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.
  • Requires a living NPC and a matching equipped item; magic requires a supported selected spell. Does not grant items, mana or ammunition. Repeating the same mode is idempotent. Drawing cancels scripted animation; it does not automatically start combat.