How do you do the GUI equivalent of "Matching Unit" conditions in JASS?

MasterRofl

New Member
Reaction score
8
I want to set a unit group to all the heroes within 5000 range of unit God, having less than 50% hp, and on the enemy team. What is the simplest way to do this in JASS? I'm hoping it's simpler than what GUI gives (multiple functions that filter out units).

Thank you very much. ;)
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
>Matching unit is GetEnumUnit I think
No, GetEnumUnit is Picked Unit, Matching Unit is GetFilterUnit().

You would use the function Demi666 has posted, and use a filter function that looks like this. It filters so the group is the units that have less then 50% life and are enemies of the God unit's owner.
JASS:
function filter takes nothing returns boolean
    return GetUnitStatePercent(GetFilterUnit(),UNIT_STATE_LIFE,UNIT_STATE_MAX_LIFE) < 50. and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(God)) == true //Replace God with however you would refer to the God unit
endfunction
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top