the last solution seems especially elegant, but I believe I'd need to refactor it a bit as it's competing forces of three capturing the beacons in my map.
Given your computer players aren't in these forces just use Force 1, Force 2, Force 3 instead of Force 1.
ihjel solution is nice, but would need an extension if one needs to do something for the offended side (as I understand, it's not that important for the moment).
The thing that I don't quite like about it is as players with higher or equal numbers than of the current player contribute to the counter with their command the most data from the previous trigger cycle and players with lower numbers - with their up-to-date data. This may lead to a scenario when for instance P1 takes the beacon and P2 takes the beacon on the same trigger cycle or when the transfer is delayed on a cycle.
Not a big deal probably, but if I would be making this I would let the state accumulate in a separate DC that is copied to the final DC at start of each trigger cycle. For instance:
Collapsable Box
Trigger("Force 1"){
Conditions:
Deaths("Current Player", "Independent Starport", Exactly, 1);
Deaths("Force 1", "Independent Starport", Exactly, 1);
Bring("Current Player", "Start Location", "Location 0", Exactly, 0);
Actions:
Give Units to Player("All players", "Current Player", "Start Location", All, "Location 0");
Display Text Message(Always Display, "You gained control of the location!");
Preserve Trigger();
}
//-----------------------------------------------------------------//
Trigger("Force 1"){
Conditions:
Commands the Most At("Men", "Location 0");
Actions:
Set Deaths("Current Player", "Independent Command Center", Set To, 1);
Preserve Trigger();
}
//-----------------------------------------------------------------//
Trigger("Player 8"){
Conditions:
Always();
Actions:
Set Deaths("Force 1", "Independent Starport", Set To, 0);
// Or better specifically for each player in Force 1.
Preserve Trigger();
}
//-----------------------------------------------------------------//
// REPEAT THE FOLLOWING TRIGGER FOR EACH N FROM 1 TO NUMBER OF PLAYERS
Trigger("Player 8"){
Conditions:
Deaths("Player N", "Independent Command Center", At Least, 1);
Actions:
Set Deaths("Player N", "Independent Command Center", Set To, 0);
Set Deaths("Player N", "Independent Starport", Set To, 1);
Preserve Trigger();
}
Also note that when there are no units at location all players command the most (and the least) units simultaneously. It doesn't break anything, but a thing that should be always remembered. For instance this will lead to the player taking all beacons (start locations) at the beginning of a game where he is the only non-computer player.
EDIT: I realized it won't work as I initially thought, so it requires the last player to be a computer now. Still can be done without computers, but technique isn't very elegant.
EDIT2: OK, nonetheless I'll put the solution without computers here for reference. If we need to select the last player from a force to execute stuff we can do the following. Put this series of triggers on the bottom of the list (i.e. after all triggers for Force 1 players).
Collapsable Box
// REPEAT THE FOLLOWING TRIGGER FOR EACH N FROM 1 TO NUMBER OF PLAYERS
Trigger("Player N"){
Conditions:
Always();
Actions:
// REPEAT THE FOLLOWING ACTION FOR EACH M FROM 1 TO (N-1)
// AND DON'T PUT THIS ACTION WHEN N = 1
Set Deaths("Player M", "Danimoth (Arbiter)", Set To, 0);
Set Deaths("Player N", "Danimoth (Arbiter)", Set To, 1);
Preserve Trigger();
}
For a trigger that needs to execute only once for the last player in the Force 1 you put the condition: Deaths("Current Player", "Danimoth (Arbiter)", Exactly, 1).
For instance the last 2 triggers from the first code box would be rewritten as:
Collapsable Box
Trigger("Force 1"){
Conditions:
Deaths("Current Player", "Danimoth (Arbiter)", Exactly, 1);
Actions:
Set Deaths("Force 1", "Independent Starport", Set To, 0);
// Or better specifically for each player in Force 1.
Preserve Trigger();
}
//-----------------------------------------------------------------//
// REPEAT THE FOLLOWING TRIGGER FOR EACH N FROM 1 TO NUMBER OF PLAYERS
Trigger("Force 1"){
Conditions:
Deaths("Current Player", "Danimoth (Arbiter)", Exactly, 1);
Deaths("Player N", "Independent Command Center", At Least, 1);
Actions:
Set Deaths("Player N", "Independent Command Center", Set To, 0);
Set Deaths("Player N", "Independent Starport", Set To, 1);
Preserve Trigger();
}
The described system kicks in with a cycle delay after the last player leaves the game.
It works simpler when we need to select the first player from a force due to same reasons. The only trigger is required on the top of the triggers list.
Collapsable Box
Trigger("Force 1"){
Conditions:
Deaths("Force 1", "Danimoth (Arbiter)", Exactly, 0);
Actions:
Set Deaths("Current Player", "Danimoth (Arbiter)", Set To, 1);
// Preserve trigger isn't needed.
}
This one kicks in instantly.
Post has been edited 14 time(s), last time on Apr 18 2017, 8:08 pm by Wormer.
Some.