• 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.

How to issue Group attack/move order to coordinates in JASS?

Level 5
Joined
May 10, 2024
Messages
57
Hello! I see it's possible to issue an order to single unit like this
JASS:
call IssuePointOrder(unit, orderString, x, y)
But I can't find jass function to do the same with the unit group. How to do it?
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
You don't. You order every unit in the group to do the order, either using a ForGroup callback (like GUI uses) or iterating over the group sequentially:
JASS:
function YourCallback takes nothing returns nothing
  call IssuePointOrder(GetEnumUnit(), orderstring, x, y) //note these variables are not directly accessible in this function
endfunction                                              //so you will need to use some globals or other method to know


//...
set x = foo()
set y = bar()
set orderstring = "balloon"
set YourGroup = SomeGroupHoweverYouGetOrMakeIt()
call ForGroup(YourGroup, function YourCallback)
JASS:
set x = foo()
set y = bar()
set orderstring = "balloon"
set YourGroup = SomeGroupHoweverYouGetOrMakeIt()
loop
  set u = FirstOfGroup(YourGroup)
  exitwhen u == null
  call GroupRemoveUnit(YourGroup, u) //this method inherently removes all units from the group (but does not destroy the group)
  call IssuePointOrder(u, orderstring, x, y) //these variables are accessible here
endloop
 
Level 5
Joined
May 10, 2024
Messages
57
It's quite difficult to control unit one by one in a large wave due to differences in movement speed, formation rank and terrain. Some units, like Knights, can reach destination point before the rest of the units arrives or support units, like Priests, can move in the frontline and so on.

I already found function what I was looking for. It's GroupPointOrder. Unfortunately this function works the same as GUI and can't control more then 12 units at once. So I split the wave into chunks of 12 each and use GroupPointOrder for each chunk. But it also is not perfect because first chunk may contain only knights so they will not wait for the rest of the units as well. This approach seems to require some attention to work well.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
How do you choose which units to spawn, and how (and how frequently) do you spawn them? It might be relatively straightforward to automatically split them between predetermined groups to issue orders where slow and fast units exist.

Truly every group just needs to have one of the slowest units in it, right? You could probably get away with putting one invisible, invulnerable, unselectable unit into each group and setting its movement speed appropriate to the aggregate group's minimum speed. 11 units + 1 dummy in each group.
 
Top