GroupEnumUnitsInRangeCounted?

DrinkSlurm

Eat Bachelor Chow!
Reaction score
50
JASS:
native GroupEnumUnitsInRangeCounted         takes group whichGroup, real x, real y, real radius, boolexpr filter, integer countLimit returns nothing


At first I thought this would get units within range, with a maximum count as defined by "countLimit." But when I tried it, it doesn't seem to work the way I thought. Here's a portion of my code

JASS:
function MLG_Actions takes nothing returns nothing
    local MLGStruct data = MLGStruct.create()
    local timer t = NewTimer()
    local real dur = GetUnitAbilityLevel(GetTriggerUnit(), ab_MLGp) + 5 //duration of spell
    local integer mt = GetUnitAbilityLevel(GetTriggerUnit(), ab_MLGp) + 5 //max # of targets
    local real X = GetUnitX(GetTriggerUnit())
    local real Y = GetUnitY(GetTriggerUnit())
    local group g = CreateGroup()
    local unit targ
    local unit u
    call DisplayTextToForce(GetPlayersAll(), "mt = " + I2S(mt))
    set data.hero = GetTriggerUnit()
    set data.c = (GetUnitAbilityLevel(GetTriggerUnit(), ab_MLGp) + 5) * 2
    set filter = Condition(function MLG_GroupFilter)
    call GroupEnumUnitsInRangeCounted(data.tgroup, X, Y, radius, filter, mt)
    call DisplayTextToForce(GetPlayersAll(), I2S(CountUnitsInGroup(data.tgroup)) + " units in data.tgroup")
...


In game, I see the following text messages:
mt = 8 [which is what it should be for this spell at level 3]
12 units in data.tgroup

And in fact, all 12 picked units are being affected by the spell.

What does GroupEnumUnitsInRangeCounted do exactly? If it doesn't do what I'm looking for, is there another function that does? (Otherwise, I'll just have to manually remove extra picked units from the group--which I know how to do, so you don't have to explain it to me.) Thanks.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top