function RangeCheck takes group g, unit u returns boolean
local unit v
local unit array w
local integer i = 0
loop
set v = FirstOfGroup (g)
exitwhen v == null
if not IsUnitInRange(u, v, 543.05801)
if ( IsPlayerInForce(GetLocalPlayer(), udg_UserForce) ) then
call DisplayTextToPlayer(GetLocalPlayer(), 50.00, 50.00, "All heroes must be within the area to proceed.")
endif
return false
endif
set w[i]= v
set i = i + 1
call GroupRemoveUnit (g, v)
endloop
loop
exitwhen i < 0
call GroupAddUnit (g, w[i])
set w[i] = null
set i = i - 1
endloop
return true
endfunction
function TriggerAmbush takes nothing returns nothing
if RangeCheck(udg_UserUnitGroup, gg_unit_du00_0001) == true then
if TriggerEvaluate(gg_trg_Ambush_Cine) then
call DisableTrigger(GetTriggeringTrigger())
call TriggerExecute(gg_trg_Ambush_Cine)
call RemoveUnit(gg_unit_du_0001)
endif
endif
endfunction
//===========================================================================
function InitTrig_Ambush_Trigger takes nothing returns nothing
local trigger tri = CreateTrigger()
local region re = CreateRegion()
call TriggerAddAction(tri, function UserUnitGroupRegister)
call RegionAddRect(re, gg_rct_Ambush_Trigger)
call TriggerRegisterUnitInRange(tri, gg_unit_du00_0001, 543.05801, null)
set re = null
set tri = null
endfunction