library SelectEscape initializer Init
globals
private group selected = CreateGroup()
endglobals
private function FilterGroup takes nothing returns boolean
/* ensure that the selected unit(s) have an id of 'hfoo' */
return GetUnitTypeId(GetFilterUnit()) == 'hfoo'
endfunction
private function Escape takes nothing returns boolean
/* enumerate the units selected by the player */
call GroupEnumUnitsSelected(selected, GetTriggerPlayer(), Filter(function FilterGroup))
if FirstOfGroup(selected) != null then
/* one or more of the selected units follow the condition */
endif
return false
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
exitwhen i == 12
call TriggerRegisterPlayerEvent(t, Player(i), EVENT_PLAYER_END_CINEMATIC)
set i = i + 1
endloop
call TriggerAddCondition(t, Condition(function Escape))
endfunction
endlibrary