Lua API

Magic module

Functions for working with magic.

Usage

local Magic = ELONA.require("core.Magic")

Functions

cast (caster, target, effect_id, effect_power) Makes a character cast a spell targeting another character.
cast (caster, effect_id, effect_power, target_location) Makes a character cast a spell targeting themselves or a position.

Functions

# cast (caster, target, effect_id, effect_power)

Makes a character cast a spell targeting another character.

Parameters:
  • caster : (LuaCharacter) (mut) the casting character
  • target : (LuaCharacter) (mut) the target character
  • effect_id : (num) the spell ID
  • effect_power : (num) the power of the spell
Usage:
local caster = Chara.player()
 local target = Chara.create(0, 0, "core.putit")
 Magic.cast(caster, target, 414, 100) -- Magic missile
# cast (caster, effect_id, effect_power, target_location)

Makes a character cast a spell targeting themselves or a position.

Parameters:
  • caster : (LuaCharacter) (mut) the casting character
  • effect_id : (num) the spell ID
  • effect_power : (num) the power of the spell
  • target_location : (LuaPosition) (const) the position the spell targets
Usage:
local pos = Map.random_pos()
  Magic.cast(Chara.player(), 432, 100, pos) -- Ball magic