Lua functions

AddSpellTimer

Registered in this checkout as EQ2Emu_lua_AddSpellTimer; implementation found at WorldServer/Lua/LuaFunctions.cpp:10006.

Historical signature: AddSpellTimer(…) via current binding

Parameter and behavior details in the historical explanation are under review against the current implementation.

Function: AddSpellTimer(time, function, caster, target)

Description: Schedules a named callback for the current spell after a delay. Requires an available current spell, caster and zone. Valid optional actor overrides remember their original allocation through weak observations; scheduling does not keep those actors alive for the delay. An override that can no longer be borrowed becomes nil, and never falls back to a replacement actor or another default target. Omitted overrides retain the normal spell argument selection.

Parameters:

  • time (unsigned integer) - Delay in milliseconds; zero is rejected.
  • function (string) - Nonempty Lua callback name.
  • caster (Spawn, optional) - Override for the callback's first actor argument; omission uses the spell caster.
  • target (Spawn, optional) - Override for the callback's second actor argument; omission uses the normal spell target selection.

Returns: None.

Spell caster lifetime: When this function reads a spell's caster, it retains that allocation for the native operation. Retirement or callback reentry cannot replace its caster with a different allocation at the same address or runtime ID. A known expired or cleared caster is not rediscovered through a replacement connection. An actor already owned by the active callback remains usable through that callback. See Lua actor lifetime.

Checked example

Active call in a local runtime Lua script. Argument count matches current fixed C++ readers. This is a contextual call pattern, not a tested standalone script.

AddSpellTimer(Effect00Value00 * 1000, "RemoveClassicRefreshSnare00", Caster, Target)

Evidence: server/Spells/ClassicRefresh/Fighter/Crusader/Shadowknight/AbominableWrath-2550653.lua:17; binding EQ2Emu_lua_AddSpellTimer.

Current registration: WorldServer/Lua/LuaInterface.cpp.