Binary arithmetic.
You need to progressively count how many spawning pools the player has. Have triggers like this:
Current player commands at least 16 spawning pools & [other spawn conditions]
-> Give 16 spawning pools to Player 10
-> Create 32 zerglings for current player at 'spawn location'
-> Move location 'blah' to map revealer owned by current player at 'anywhere'
Current player commands at least 8 spawning pools & [other spawn conditions]
-> Give 8 spawning pools to Player 10
-> Create 16 zerglings for current player at 'spawn location'
-> Move location 'blah' to map revealer owned by current player at 'anywhere'
Current player commands at least 4 spawning pools & [other spawn conditions]
...
Current player commands at least 2 spawning pools & [other spawn conditions]
...
Current player commands at least 1 spawning pools & [other spawn conditions]
...
[other spawn conditions]
-> Give all spawning pools owned by Player 10 to Current Player
Now say the player has 11 spawning pools. The triggers for 8, 2 and 1 will run, spawning you a total of 22 zerglings. If the player owned 19 spawning pools then they'll get 32 + 4 + 2 = 38 zerglings.
The triggers here will spawn a maximum of 62 zerglings: (16 + 8 + 4 + 2 +1) * 2 = 62. Add another trigger for "commands 32 spawning pools" and you can spawn up to 126: (32 + 16 + 8 + 4 + 2 + 1) *2.
Note that the "move location 'blah' to map revealer owned by current player at 'anywhere'" is an action that achieves nothing, but this is REQUIRED for the triggers presented here to work. The reason is because Starcraft only updates unit ownership on unit kill/remove and location move actions, but does *not* update as a result of give actions. If you don't include this location movement, then if the player owned exactly 8 spawning pools, the first trigger will fire, and so will the 2nd one that checks for 4 spawning pools because it hasn't registered that you gave all 8 spawning pools to P10. It'll keep checking all the remaining triggers and you'll end up spawning 62 zerglings instead of the 16 you expected.
You can use any dummy location here, you could probably even use "move location 'anywhere' to map revealer owned by current player at 'anywhere'". Personally I just have a dummy location that I use for generic tasks for this.
This is the spawning system that I use in DS Night Fixed. So it *does* work.
Post has been edited 1 time(s), last time on Sep 5 2011, 6:27 am by Lanthanide.
None.