• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

JASS Unit Groups

Status
Not open for further replies.
Level 8
Joined
Jul 3, 2011
Messages
251
Hi guys, i am making a spell but i am stuck on unit groups, im not really sure how to do them in JASS, everything else i know fine except groups, so could someone please make me a really simple example of setting a unit group of units in range of something, then picking a random unit in that group? Rep + credits and my gratitude.
 
Hope this helps:

JASS:
function Group_Actions takes nothing returns nothing
    call KillUnit(GetEnumUnit())
endfunction

JASS:
function Group takes nothing returns nothing
    call GroupEnumUnitsInRangeOfLoc(Your_Group, Your_Point, Your_Radius, Your_Filters)
    call ForGroup(Your_Group, function Group_Actions)
endfunction
 
JASS:
function Group_Actions takes nothing returns nothing
    call KillUnit(GetEnumUnit())
endfunction

function Group takes nothing returns nothing
    local real x = Your_X_Co-ord
    local real y = Your_Y_Co-ord
    call GroupEnumUnitsInRange(Your_Group, x, y, Your_Radius, Your_Filters)
    call ForGroup(Your_Group, function Group_Actions)
endfunction
 
Status
Not open for further replies.
Back
Top