Mmm..something like this?..Lol sorry, first time with looping so not sure if it could be more compact..
Code:
Untitled Trigger 001
Events
(Your Event)
Conditions
Actions
Set Players[1] = Player 1 (Red)
Set Players[2] = Player 2 (Blue)
Set Players[3] = Player 3 (Teal)
Set Players[4] = Player 4 (Purple)
Set Players[5] = Player 5 (Yellow)
For each (Integer A) from 1 to 11, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of living Wisp units owned by Players[(Integer A)]) Greater than 6
Then - Actions
Unit - Remove (Random unit from (Units owned by Players[(Integer A)] of type Wisp)) from the game
Else - Actions
Do nothing
erik123 wrote:
I hope you understood what i wanted whit the code.. Im new to this GUI triggering so I don't realy understand whats wrong, to me it seems pretty okay...
Alright since i dont know how far along you are, ill run ya through this step-by-step.
First in the trigger editor, press Ctrl+B, to open the Variable section. Next make a variable, name it whatever you want, in my case i used "Players". Then, for the type scroll down and select "Player". Next check the box next to "Array", and make the size 11.
Next, create a new action "Set Variable" its the 8th from the top under "Do Nothing". Next, select the "Players" variable. Then for "[Index]" select 1, of course for player 1. Then for the value, go to the top and click "Preset", "Player 1 (Red)". After thats done, just copy and paste that for every player, i just did that till yellow, you should do it for however many players ya have.
After, create a new trigger, "For Each Integer A, Do Multiple Actions", again its not that far from the top of the list. Then create an "If/Than/Else Multiple Functions". Wont explain that since ya already know it.
The rest is pretty much as youve made, "Integer Comparison", instead of Player 1 (Red), select the variable Players, for the index pick "For Loop Integer A"
Alright, the remove should be self-explanatory..lol it took more type typing this out than making the actual trigger ;x..truth be told i dident actually test this..however i dont see why it wouldent work. The reason yours dont work, is simply because your removeing from the unit group only, not the game..if you dont want to go through all the trouble, just use this instead
Code:
If ((Number of living Wisp units owned by Player 1 (Red)) Greater than 6) then do (Unit - Remove (Random unit from (Units owned by Player 1 (Red) of type Wisp)) from the game) else do (Do nothing)
Its just that my way and black-holes are more leakless.
Edit : I just tested both my ways and they work, meaning that your only problem was as ive said, just the removing part. Meaning that Black-Hole's will work as well. ;D