- Joined
- Oct 11, 2012
- Messages
- 711
There is no syntax error in this trigger, but war3 does not allow me to start game when I use this trigger.
If I delete the "if...else...endif" in the loop, the trigger can work and game can be started. Why is that? I also changed the"IsUnitVulnerable" to "IsUnitEnemy", still did not work.
I do not see any syntax error.... Help please. Thanks.
JASS:
function lichking1_actions takes nothing returns nothing
local group g=CreateGroup()
local real x=GetSpellTargetX()
local real y=GetSpellTargetY()
local unit u
if GetSpellAbilityId() == 'A421' then
//call GroupEnumUnitsInRange(g,x,y,800.,null)
call GroupEnumUnitsInRange(g,x,y,800.,Condition(function Group_TrgU_Filter))
set lichking1=CreateGroup()
call GroupAddGroup(g,lichking1)
loop
set u=FirstOfGroup(g)
exitwhen u==null
call GroupRemoveUnit(g,u)
if IsUnitInvulnerable(u) then //when I delete this "if..else..endif" lines, trigger can work. Why?
call SetUnitInvulnerable(u,false)
else
call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u,UNIT_STATE_LIFE)*0.50)
endif
set lichking2=CreateGroup()
call GroupAddGroup(lichking1,lichking2)
call GroupRemoveUnit(lichking2,u)
call IssueTargetOrder(u,"attackonce",GroupPickRandomUnit(lichking2))
call DestroyGroup(lichking2)
endloop
call DestroyGroup(lichking1)
call DestroyGroup(g)
endif
set g=null
endfunction
function InitTrig_lichking1 takes nothing returns nothing
set gg_trg_lichking1=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_lichking1, EVENT_PLAYER_UNIT_SPELL_EFFECT )
//call TriggerAddCondition(gg_trg_lichking1, Condition(function lichking1_actions))
call TriggerAddAction(gg_trg_lichking1,function lichking1_actions)
endfunction
If I delete the "if...else...endif" in the loop, the trigger can work and game can be started. Why is that? I also changed the"IsUnitVulnerable" to "IsUnitEnemy", still did not work.
I do not see any syntax error.... Help please. Thanks.