function TRAUTD_Actions takes nothing returns nothing
local integer i = 0
loop
call TriggerRegisterUnitEvent(udg_t[i],GetTriggerUnit(),EVENT_UNIT_ATTACKED)
set i = i+1
exitwhen i >= JASS_MAX_ARRAY_SIZE
endloop
endfunction
function TriggerRegisterAnyUnitTakesDamage takes trigger t returns nothing
local integer max = CountUnitsInGroup(GetUnitsInRectAll(bj_mapInitialPlayableArea))
local integer i = 0
local unit u = null
local group g = CreateGroup()
local trigger t2 = CreateTrigger()
call GroupAddGroup(GetUnitsInRectAll(bj_mapInitialPlayableArea),g)
loop
exitwhen i == max
set u = FirstOfGroup(g)
call TriggerRegisterUnitEvent(t,u,EVENT_UNIT_ATTACKED)
call GroupRemoveUnit(g,u)
set u = null
endloop
set udg_t[udg_index] = t
set udg_index = udg_index+1
call TriggerAddAction(t2, function TRAUTD_Actions)
call TriggerRegisterEnterRectSimple(t2,bj_mapInitialPlayableArea)
set g = null
endfunction