- Joined
- Mar 23, 2008
- Messages
- 942
Hi, I'm getting a strange issue with a trigger, it only work correctly the first time my unit cast the spell.
The spell should create 1 illusion for every level of the spell, it works the first time, many illusion are spawned, but them only one start to spawn every time I cast the spell.
Thanks in advance
The spell should create 1 illusion for every level of the spell, it works the first time, many illusion are spawned, but them only one start to spawn every time I cast the spell.
JASS:
function Trig_Kage_Bushin_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A045' )
endfunction
function Trig_Kage_Bushin_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer ti = GetUnitAbilityLevel(caster, 'A045')
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local unit u
set u = CreateUnit( GetOwningPlayer(caster), 'h00E', x, y, 0.00 )
call UnitAddAbility( u, 'A044' )
loop
exitwhen 1 > ti
call IssueTargetOrderById(u, 852274, caster)
set ti = ti - 1
endloop
call UnitApplyTimedLife( u, 'BTLF', 1.00 )
set caster = null
set u = null
call RemoveLocation(udg_temppoint)
endfunction
//===========================================================================
function InitTrig_Kage_Bushin takes nothing returns nothing
set gg_trg_Kage_Bushin = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Kage_Bushin, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Kage_Bushin, Condition( function Trig_Kage_Bushin_Conditions ) )
call TriggerAddAction( gg_trg_Kage_Bushin, function Trig_Kage_Bushin_Actions )
endfunction
Thanks in advance