1
0
EQ2Emu/docs/lua_functions/AddSpellTimer.md
2025-05-14 09:46:52 -04:00

29 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Function: AddSpellTimer(DelayMS, FunctionName, Caster, Target)
Description: Used only in a Spell Script. Schedules a call to a function (by name) in the spawns script after a specified delay in milliseconds. This is typically used within NPC scripts to create timed events (like delayed attacks or actions) without blocking the main thread.
Parameters:
DelayMS: Int32 The delay in milliseconds before the function is called.
FunctionName: String The name of the function in the NPCs Lua script to call when the timer expires.
Caster: Spawn The source spawn who was the caster/originator.
Target: Spawn The target spawn who will be included as a secondary argument
Returns: None.
Example:
-- taken from Spells/Commoner/Knockdown.lua
-- Timer argument taken from spell data in the database, after Timer elapses we call RemoveStunBlur
function cast(Caster, Target, Timer)
if not IsEpic(Target) then
PlayAnimation(Target, 72)
AddControlEffect(Target, 4)
BlurVision(Target, 1.0)
AddSpellTimer(Timer, "RemoveStunBlur")
end
end
function RemoveStunBlur(Caster, Target)
RemoveControlEffect(Target, 4)
BlurVision(Target, 0)
end