- Joined
- Jul 9, 2008
- Messages
- 1,248
Nothing special here, I needed the code for a project of mine and thought others may find it useful. Can easily be modified to unit group
JASS:
function AreAnyUnitsInRegionInForce takes rect r, force f returns boolean
local group regionUnits = CreateGroup()
local unit currentUnit
local boolean unitFound = false
call GroupEnumUnitsInRect(regionUnits, r, null)
loop
set currentUnit = FirstOfGroup(regionUnits)
exitwhen currentUnit == null
if (IsUnitInForce(currentUnit, f)) then
set unitFound = true
exitwhen true
endif
call GroupRemoveUnit(regionUnits, currentUnit)
endloop
call DestroyGroup(regionUnits)
set regionUnits = null
set currentUnit = null
return unitFound
endfunction