I'm using GetUnitsInRangeOfLocMatching and I want to set a group = units in range 500 points of casting range of units that are allied...So what I'm left with is: GetUnitsInRangeOfLocMatching(500.00, GetUnitLoc(GetSpellAbilityUnit()), <blank>)
What is the code I need to insert into the <blank> to restrict the selection only to allied units (preferably to allied units of the unit casting the ability)
blank? -_- What you need there is a boolexpr as parameter. You would have to use an additional function, which returns boolean...and you would have to use gamecache to give that code function the unit...which is bothersome. Now since we are using JASS, let's do the group looping:
...
local location loc = GetUnitLoc(GetSpellAbilityUnit())
local rect loc_rect = GetRectFromCircleBJ(loc,500) //Creates a rect from the location with a radius of 500
local group ally_group = CreateGroup() //creates a group
local unit first
call GroupEnumUnitsInRect(ally_group,loc_rect,null)
//All units within the rect are in the group now
loop
set first = FirstOfGroup(ally_group)
exitwhen ( first == null )
if ( not IsUnitAlly(first, GetTriggerPlayer() )) then//If the first of the group is not an ally
call GroupRemoveUnit(ally_group,first)//He will be removed
endif
endloop
...
local group g = CreateGroup()
local unit u
call GroupEnumUnitsInRange(g,500,GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), null)
loop
set u = FirstOfGroup(g)
exitwhen u == null
if IsUnitAlly(first, GetOwningPlayer(GetTriggerUnit()) ) then//this is the filter, checking oif the unit is an ally
call GroupRemoveUnit(g,u)
endif
endloop
do u mean the fact that i used your code as a rough basis for mine, to avoid typing out the alt ForGroup method bc my cousin was nagging me to get off the computer?