Skip to content
ASArcaneMP Scripting APIScripting reference
Global objectClient APIGenerated

Spells

const Spells: object

Defined in: client/api.d.ts:5517

Local spell-unlock enforcement and spell-diamond access.

broomCastReady(): boolean

True while broom-mounted with a usable wand; gate keybinds on this so they stay inert on foot.

boolean

broomCastTry(slot, aimMode?): string

Casts the slot’s spell via ActivateSpellTool + SpellTool::Start, bypassing the ground cast path. Fires a real spell.

number

Equipped diamond slot 0-3.

number

0 tool’s own aim (rider-forward on a broom), 1/2 wand-cast tracker, 5 per-cast override on the tool.

string

cast(slot): SpellCastResult

Loads the slotted spell tools and taps the requested spell through the production WandTool OnSpell_Pressed/OnSpell_Released route. The result confirms dispatch; observe localSpellCast for native cast completion.

number

Diamond slot 0-3.

SpellCastResult

castRecord(recordPath, aimMode?): SpellCastResult

Loads a modded SpellToolRecord and casts it through the local wand. On foot it goes through the game’s own cast entry, so the cast gesture plays and fires it; on a mount, or with aimMode 5, the tool is started directly. A record a Spells.define definition runs is cast as that spell. Vanilla /Game paths are rejected.

string

Plugin-rooted Package.Object path to a modded SpellToolRecord.

number

0 uses the tool’s aim; 1/2 use the target tracker; 5 uses a per-cast camera override.

SpellCastResult

cooldowns(): SpellCooldown[]

The local player’s spells on cooldown, read from the game’s own cooldown table: only spells actually cooling down, with every reduction, reset and combat rule already applied. Spells whose cast set no cooldown are absent. Empty without a player. spellCooldownChanged reports the changes.

SpellCooldown[]

currentLoadout(): number | null

The spell set (0-3) the player has selected: the one the HUD shows and casts from. spellLoadoutChanged reports switches.

number | null

fizzle(): boolean

Plays the game’s own failed cast on the local player: the wand’s fail sound, its spark at the tip and the arm’s failed-cast pose for 1.7 s. False without a player or wand, or while a fizzle is still playing.

boolean

isHeld(slot?): boolean

Whether a cast input is held down, as the wand sees it: true from a press whose cast went through until its release. A press the game refused (a cooldown, stopped input, a locked spell) never reads as held. False without a wand.

number

Diamond slot 0-3. Omitted: the basic cast, the left click.

boolean

isLoadoutKeysEnabled(): boolean

False while any resource holds the spell-set keys.

boolean

isLoadoutWheelEnabled(): boolean

False while any resource holds the mouse wheel’s spell-set switching.

boolean

loadout(loadoutIndex?): SpellLoadoutState | null

Reads one live spell-diamond loadout through QuickActionManager.

number

Defaults to the currently selected loadout.

SpellLoadoutState | null

setCurrentLoadout(loadoutIndex): boolean

Selects a spell set as the player’s set keys do: the HUD switches to it and casting follows, and spellLoadoutChanged fires. Works while setLoadoutKeysEnabled or setLoadoutWheelEnabled holds the player’s own switching. Silent, unlike a key press, which plays the game’s swap sound. True once the set is selected, including when it already was. False when the index is out of range, the set is not unlocked (the game opens one set plus one per bonus loadout, see setPolicy), or there is no player or HUD to take the switch yet.

number

The spell set to select, 0-3.

boolean

setLoadoutKeysEnabled(enabled): void

Stops the game’s spell-set keys from switching sets, so a resource can put its own menus on them: F1-F4 and 5-8 by default, or whatever keys the player bound to the four sets. The keys still reach Key.bind, and the mouse wheel is separate (setLoadoutWheelEnabled). Spells.setCurrentLoadout still switches, and so does the action screen’s own set row (Game.setActionScreenEnabled shuts that screen). Same contract as Game.setPauseMenuEnabled: one idempotent hold per resource, held while any resource holds, dropped when the resource stops or reloads and on disconnect.

boolean

false stops the set keys from switching spell sets; true gives this resource’s hold back.

void

setLoadoutSlot(slot, spellName, loadoutIndex?, emitAssignmentEvent?): boolean

Assigns a live native spell-diamond slot through QuickActionManager, verifies readback, and emits spellAssignment with source ‘api’ after success. Modded record paths are valid persistence identities but require a modded slot provider rather than QuickActionManager.

number

Diamond slot 0-3.

string | null

Native gameplay name or plugin-rooted modded SpellToolRecord path, or null to clear.

number

Defaults to the currently selected loadout.

boolean

Defaults to true. Internal state restoration passes false to avoid reporting synchronization as a user assignment.

boolean

setLoadoutWheelEnabled(enabled): void

Stops the mouse wheel from switching spell sets, so a resource can use the wheel itself (Key.bind(“wheelup”) and “wheeldown” still fire). The set keys are separate (setLoadoutKeysEnabled), and Spells.setCurrentLoadout still switches. Same contract as Game.setPauseMenuEnabled: one idempotent hold per resource, held while any resource holds, dropped when the resource stops or reloads and on disconnect.

boolean

false stops the mouse wheel from switching spell sets; true gives this resource’s hold back.

void

setPolicy(lockIds, bonusLoadouts?, relockIds?): void

Sets the spell policy.

string[]

number

string[]

Granted-then-revoked spell LockIDs to actively re-lock and clear from every quick slot — dropping an id from lockIds cannot undo an unlock on its own. ‘Spell_Stupefy’ also takes back the basic (left-click) cast.

void