
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
First of all I think your trigger has a mistake - assuming Force 1 is the player force. When you detect deaths of a whole force then starcraft will add up the deaths for each player. So if 5 players all have exactly 2 deaths you had to check for 10 deaths. As this obviously depends on number of players in the game you would not want that. Instead have Player 8 count the deaths.
To your problem:
Do you really need it randomized? Because giving the units to the player with the lowest player number would be much easier. But here's the complete randomization system plus the respective giving triggers.
Feel free to ask if you don't fully understand a part. But for now I let the triggers speak for themselves:
Trigger 1a: Giving the regular unitsPlayer 1
Conditions:Player 8 has suffered Exactly 2 deaths of "Alan Turret"
Actions:Give All units of Player 8 at "Level2 P1" to Current Player
Trigger 1b: Giving the regular unitsPlayer 2
Conditions:Player 8 has suffered Exactly 2 deaths of "Alan Turret"
Actions:Give All units of Player 8 at "Level2 P2" to Current Player
... etc. until Trigger 1e for all 5 Players.
This ensures that only present players grab the units and they are not given to ghost players. (You
can give units to players not present if you use their specific player number. But absent players
can not execute triggers.)
Then the system that distributes the units that no one grabbed:
Trigger 2: Marking the units for distributionPlayer 8
Conditions:Player 8 has suffered Exactly 2 deaths of "Alan Turret"
Actions:Give All units of Player 8 at "Level2 P1" to Neutral (P12)
Give All units of Player 8 at "Level2 P2" to Neutral (P12)
Give All units of Player 8 at "Level2 P3" to Neutral (P12)
Give All units of Player 8 at "Level2 P4" to Neutral (P12)
Give All units of Player 8 at "Level2 P5" to Neutral (P12)
Note that Player 8's triggers are checked last so most of the actions will not give units as they have already been taken by a player. Trigger order in the editor does
not matter here.
Trigger 3a: Randomization initPlayer 8
Conditions:Always
Actions:Set deaths to 1 of 'Rand' for Player 1
Set deaths to 2 of 'Rand' for Player 2
Set deaths to 3 of 'Rand' for Player 3
Set deaths to 4 of 'Rand' for Player 4
Set deaths to 5 of 'Rand' for Player 5
Only runs once at game start. Players have their individual counts always 1 apart from each other.
Trigger 3b: Randomization counterForce 1
Conditions:Always
Actions:Subtract 1 death of 'Rand' for Current Player
Preserve
Trigger 3c: Randomization resetForce 1
Conditions:Current Player has suffered at most 0 deaths of 'Rand'
Actions:Set deaths to 4 death of 'Rand' for Current Player
Preserve
Last 2 triggers loops the death value between 0-4
Trigger 4a: Distributing units that should have gone to P1Force 1
Conditions:Current Player has suffered exactly 0 deaths of 'Rand'
Actions:Give all units of Neutral at Level2 P1 to Current Player
Trigger 4b: Distributing units that should have gone to P2Force 1
Conditions:Current Player has suffered exactly 1 deaths of 'Rand'
Actions:Give all units of Neutral at Level2 P2 to Current Player
... etc until 4e to care for each of the 5 possible missing players.
Note that some triggers need a preserve, while others do not.
Post has been edited 1 time(s), last time on Nov 17 2008, 8:30 pm by NudeRaider.