Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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

function IsUnitGroupEmptyBJ takes group g returns boolean
[...]
set bj_isUnitGroupEmptyResult = true
call ForGroup(g, function IsUnitGroupEmptyBJEnum)
[...]
return bj_isUnitGroupEmptyResult
endfunction
function IsUnitGroupEmptyBJEnum takes nothing returns nothing
set bj_isUnitGroupEmptyResult = false
endfunction
