- Joined
- Jun 26, 2020
- Messages
- 1,921
I create this function in Jass to the units keeping attacking to a point even if they stop in some moment, but it doesn't work, what is happening?
And no, disabletrigger is not the reason.
JASS:
function UnitsCond takes nothing returns boolean
local unit u=GetFilterUnit()
if GetUnitTypeId(u)=='ndrl' then
set u=null
return false
endif
if GetOwningPlayer(u)!=Player(0) or GetOwningPlayer(u)!=Player(6) then
set u=null
return false
endif
if GetUnitCurrentOrder(u)==String2OrderIdBJ("attack") or IsUnitInGroup(u,udg_Se_van)==false then
set u=null
return false
endif
if IsUnitType(u,UNIT_TYPE_STRUCTURE)==true then
set u=null
return false
endif
if IsUnitType(u,UNIT_TYPE_HERO)==true then
set u=null
return false
endif
if IsUnitInGroup(u,udg_Unidades_del_verde)==true then
set u=null
return false
endif
set u=null
return true
endfunction
function Trig_Ataquen_2_Actions takes nothing returns nothing
local group attackers=CreateGroup()
local unit u
call GroupEnumUnitsInRect(attackers,GetPlayableMapRect(),Condition(function UnitsCond))
loop
set u=FirstOfGroup(attackers)
exitwhen u==null
call IssuePointOrderLoc(u,"attack",udg_Punto_de_ataque[GetUnitUserData(u)])
call GroupRemoveUnit(udg_Se_van,u)
call GroupRemoveUnit(attackers,u)
endloop
call DestroyGroup(attackers)
set attackers=null
endfunction
//===========================================================================
function InitTrig_Ataquen_2 takes nothing returns nothing
set gg_trg_Ataquen_2=CreateTrigger()
call DisableTrigger(gg_trg_Ataquen_2)
call TriggerRegisterTimerEventPeriodic(gg_trg_Ataquen_2,2.00)
call TriggerAddAction(gg_trg_Ataquen_2,function Trig_Ataquen_2_Actions)
endfunction