scope TestIllusion initializer init
private function onCast takes nothing returns boolean
local unit u = GetSpellTargetUnit()
call Illusion.create(GetTriggerPlayer(), GetUnitTypeId(u), GetUnitX(u), GetUnitY(u), 0)
set u = null
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function onCast))
set t = null
endfunction
endscope