Basically I'm getting all the units in a region and looping through them with something like this:
What I also need is to get the units in a specific order.
Now the code above actually works most of the time, it will give me the units in the order that I created them inside the World Editor.
The problem is that sometimes it doesn't work, for example maybe two units get swapped around.
Does anybody know why it does this and how I could get around this or if there is another way to do this that will ensure that the units are given to me in the same order that I create them?
JASS:
set g = GetUnitsInRectAll( region )
set unitCount = CountUnitsInGroup(g)
loop
exitwhen a == unitCount
set u=FirstOfGroup(g)
call GroupRemoveUnit(g, u)
set a = a + 1
endloop
What I also need is to get the units in a specific order.
Now the code above actually works most of the time, it will give me the units in the order that I created them inside the World Editor.
The problem is that sometimes it doesn't work, for example maybe two units get swapped around.
Does anybody know why it does this and how I could get around this or if there is another way to do this that will ensure that the units are given to me in the same order that I create them?