SetNpcSpell

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 17:15, 25 September 2026 by QCherry (talk | contribs) (Document new NPC/player-mode API and events available from 0.1.5)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

setNpcSpell

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.

Selects an implemented NPC combat spell and charge level.

Syntax

setNpcSpell(npcId, key, level=1)

Parameters

Name Type Required Description
npcId int yes Server-assigned NPC ID returned by spawnNpc; not a player ID.
key string yes Supported NPC spell key or none; see NPC scripting#Spells and projectiles.
level int no Optional spell level, default 1; only supported chargeable spells accept 2 or 3.

Returns

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

Examples

setNpcSpell(npcId, "fire_ball", 1)
setNpcWeaponMode(npcId, "magic")

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.
  • Stops targeting and holsters magic. none clears the selection. Draw with setNpcWeaponMode(npcId,"magic"). Does not grant mana. Supported keys and levels are in NPC scripting#Spells and projectiles.