global rect udg_tempRectangle = Rect(500,500,-500,-500)
function Trig_Conditions takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),Player(0)) == true
endfunction
function Trig_Actions takes nothing returns nothing
local location tempLocation
if not IsUnitGroupEmptyBJ(GetUnitsSelectedAll(Player( X ))) then
set tempLocation = GetUnitLoc(GroupPickRandomUnit(GetUnitsSelectedAll(Player( X ))))
call MoveRectToLoc(udg_tempRectangle,tempLocation)
call GroupTargetOrder(GetUnitsSelectedAll(Player( X )),"attack",GroupPickRandomUnit(GetUnitsInRectMatching(udg_tempRectangle,Condition(function Trig_Conditions))))
endif
call RemoveLocation(tempLocation)
set tempLocation = null
endfunction
function InitTrig takes nothing returns nothing
set gg_trg = CreateTrigger()
call TriggerRegisterPlayerEventEndCinematic(gg_trg,Player( X ))
call TriggerAddAction(gg_trg,function Trig_Action)
endfunction