- Joined
- Jul 6, 2009
- Messages
- 1,885
I'd like to know how to use filters for
For example,i want to pick all units that are heroes.
JASS:
GroupEnumUnitsInRangeOfLoc
GroupEnumUnitsInRangeOfLoc
function filterOnlyHeroes takes nothing returns boolean
if IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) then
// do things
endif
return false
endfunction
//
call GroupEnumUnitsInRange(bj_lastCreatedGroup, 0.0, 0.0, 500.0, Filter(function filterOnlyHeroes))
function MyFunction takes nothing returns nothing
local group g
call GroupEnumUnitsInRange(g, 0.0, 0.0, 500.0, Filter(IsUnitType(GetFilterUnit()),UNIT_TYPE_HERO)
function filterOnlyHeroes takes nothing returns boolean
return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO)
endfunction
Ok,thanks.
Just 1 thing,why is it 'return false' at Bribe's example? Shouldn't it be:Off-topic: Internal error strikes againJASS:function filterOnlyHeroes takes nothing returns boolean return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) endfunction
![]()
Don't use "in range of loc". Use "in range".
JASS:function filterOnlyHeroes takes nothing returns boolean if IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) then // do things endif return false endfunction // call GroupEnumUnitsInRange(bj_lastCreatedGroup, 0.0, 0.0, 500.0, Filter(function filterOnlyHeroes))