I was working with a pretty normal unit grid:
32 burrowed Drones owned by P9 in 4 rows with 8 drones each. These rows get filled with units one by one; the topmost row from left to right, then the next row and so on. I made the correct triggers for that, it was working well until some point.
The triggers effectively were like this:
C:
Brings exactly 0 units to GridLocation
A:
Give all Drones by P10 to P9
Give 3 Drones by P9 to P10
Move Location1 on Drone by P9
Then the new unit is spawned at Location1. Next trigger:
C:
Brings exactly 0 units to GridLocation
A:
Give all Drones by P10 to P9
Give
7 Drones by P9 to P10
Move Location1 on Drone by P9
Should be clear now.
Ok, as I said, everything worked well, I was able to fill all the rows a dozen times.
Additional information: I was using SCMD2 for all of this; might be important because of the order it saves the preplaced units.
Then I removed the top-left-most Drone for testing purposes, as well as the one directly to the right of it. The first 2 Drones in the first row. Then I added them back in.
Here it begins: The units don't spawn correctly anymore. The first unit is placed in the second row, first column. Next is second row, second column, then first row, third column. The two spots at the top-left are filled when normally 4-1 and 4-2 would be filled. The first 2 colums are shifted down by one, so to speak.
I backupped that version. Then I removed all the drones and added them back in in the correct order, row1, row2 and so on.
NO other changes. Works as it should now.
Actually, this is not the first time I experience something like this, but it's the first time I backupped it and took it seriously.
Soooo... I guess we have a wrong understanding of the way how SC chooses a unit in actions like "give". It is usually assumed that SC chooses the leftmost, then bottommost unit there is. But since this doesn't seem to be correct, we will have to rethink this.
I once heard that SCXE saves the preplaced units in this order: leftmost-bottommost. Sounds familiar. SE would save them the same way then, probably. But how does SCMD2/SF save them? Does someone know? SI/Heimdal especially
Finding out with a hex-editor would be annoying.
So I suspect that SC chooses units based on the unit list (which would be a lot more reasonable programming-wise). I have not yet thought it through in detail, so there may be some more specifications.
Yeah, well, start discussing.
Btw, maybe I'll upload the 2 maps later.
Edit: I hex-checked the unit order... In the weird-behaviour-one the units are listed in this order:
(Some other units, no Drones included)
1: Row1, Column3
2: 1-4
3: 1-5
...
6: 1-8
7: 2-1
8: 2-2
...
14: 2-8
15: 3-1
...
22: 3-8
23: 4-1
...
30: 4-8
Then there are lots of other units, including 32*3 P9 Drones, all placed to the right in similar shape.
"31": 1-1
"32": 1-2
These are the very last units in the list.
So from this I assume that SCMD2 keeps the order you inserted your units. But then again I am not too sure about that because I don't think I placed the very first units (some pylons) in the order they are listed. I might be wrong though.
So how does this fit together...