
We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch
Since Im not very good at this, I'm confused. It seems I need to cycle through all of them beforehand to cycle through them afterwards
Yes
- for every dynamically created barracks, I would have to create one zergling for P11. Doesn't that require a cycle already? How do I do that? Is it possible to cycle through dynamic buildings that way?
For now lets assume you already have the stacked units under the barracks.
Then it goes like this:
Center on P11 ling
Give ling to P10
If unit A at ling location convert unit A to B
-> repeat until P11 owns no lings
Give all P10 lings back to P11.
-> restart
Now for how you get those lings under the barracks? Well if they are all preplaced it's easy:
Use buildings instead (e.g. bunkers) or cycle though all the barracks at map start and recenter the lings. This is necessary because even burrowed lings will be pushed out of the buildings. If there's no room you'll get an unplaceable error.
If barracks can get created dynamically, things get ugly: there's several methods but which to choose depends on how the barracks are used/created.
Option A:Once in a while you cycle through all barracks and check if they have a ling under it. This works very similar to the above method but causes a deselect. But since it's not very often it might be okay.
Option B:You have triggers for every possible number of barracks in existence and just compare the current nr. of barracks with the nr. of barracks last trigger loop:
init (runs only at map start):
set dc 'rax now' to 0
set dc 'rax last' to 0
Player x brings exactly 1 barracks to anywhere
=> set deaths for 'rax now' to 1
Player x brings exactly 2 barracks to anywhere
=> set deaths for 'rax now' to 2
Player x brings exactly 3 barracks to anywhere
=> set deaths for 'rax now' to 3
... etc. until max nr. of barracks
Do
binary countoff to subtract do 'rax now' - 'rax last'
If 'rax now' > 0
cycle through all the barracks until you found one without ling (again, dreaded deselect)
create the ling, recenter the ling.
After all that, set 'rax last'. That way it'll always lag 1 trigger loop behind 'rax now'.
Again, 1 trigger for each possible nr. of rax. Trigger duplicators are your friend.
Option C:Only possible if there's only 1 scv.
Uhh actually I just realized this might be difficult/very circumstantial/unreliable.
The idea is to detect when the scv is over the unfinished buildings. Because unfinished buildings can be used in actions (e.g. center location) but are not detected through conditions.
But this needs a long build time at least so the scv has time go through the building to another corner to build there.
If the detection fails the player can always land his building on the scv to trigger it.