Why doesn't this work? You can compare players using == right?
Code:
function Trig_Retire_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'ANtm' ) ) then
return false
endif
return true
endfunction
function Trig_Retire_Actions takes nothing returns nothing
local unit a
local player p = GetOwningPlayer(GetSpellTargetUnit())
set a = GetSpellTargetUnit()
call UnitRemoveAbilityBJ( 'AInv', a )
call UnitRemoveAbilityBJ( 'A00K', a )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 12
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if p == udg_Player[GetForLoopIndexA()] ) ) then
set udg_Numb[1] = GetUnitUserData(GetSpellTargetUnit())
call AdjustPlayerStateBJ( udg_Numb[1], udg_Player[GetForLoopIndexA()], PLAYER_STATE_RESOURCE_GOLD )
else
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call PolledWait( 3.00 )
call RemoveUnit( a )
endfunction
//===========================================================================
function InitTrig_Retire takes nothing returns nothing
set gg_trg_Retire = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Retire, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Retire, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Retire, Condition( function Trig_Retire_Conditions ) )
call TriggerAddAction( gg_trg_Retire, function Trig_Retire_Actions )
endfunction