Ok check out this thread. Also about random
http://www.battleforums.com/showthread.php?s=&threadid=68799
Anyways to randomize between 13 units you have to do something special. Because it isn't a power of 2.
If you randomize 3 switches you have 8 possibities but if you randomize 4 you have 16. So you will need to randomize 4 switches if you want more than 8 units.
The possibities for 4 switches are
0000, 0001, 0010, 0100, 1000, 0011, 0110, 1100,
1001, 1010, 0101, 0111, 1110, 1101, 1011, 1111,
1 represents a set switch and 0 represents a cleared one. You will have to make a trigger for each one of these combinations.
Your first trigger is thi
Conditions:
-Player X, Brings at least 1, unit, to location
-Switch 'randomize on' is clear
Actions:
-Set switch 'randomize on'
-Randomize 'random A'
-Randomize 'random B'
-Randomize 'random C'
-Randomize 'random D'
-Preserve Trigger
Now first were going to do the 3 extra combinations. It is best to have them before the ones with actions inorder to speed things up.
Conditions:
-Switch 'Randomize on' is set
-Switch 'random a' is clear
-Switch 'random b' is clear
-Switch 'random c' is clear
-Switch 'random d' is clear
Actions:
-Comment ( Re-Randomize 0000)
-Randomize 'random A'
-Randomize 'random B'
-Randomize 'random C'
-Randomize 'random D'
-Preserve Trigger (this needs to be preserved even if you don't plan to randomize more than once)
Then you would put two more of these using differant combinations. Lastly you would have your 13 other triggers that would look like this.
Conditions:
-Switch 'Randomize on' is set
-Switch 'random a' is clear
-Switch 'random b' is set
-Switch 'random c' is clear
-Switch 'random d' is clear
Actions:
-create 'random unit 1' at location for player
-clear 'randomize on'
-Preserve Trigger
Note: Extra Info, If your one number over a perfect sqaure it can be slow finding the random. For an example of you need 9 random units then that makes 7 possibities that do not create a unit (9+7=16). Because the chance of picking one that doesn't create a unit is extra high. Therefore if you do this will have to wait for the "re-randomizer" to fire again. (part of the problem is solved by putting the re-randomizers before the second half).