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
Quote from name:Azrael.Wrath
3) You can also do this with death counts, as explained above. You can also use switches but it's not recommended for obvious reasons.
How would you do it with switches at all? You can't set switches for Foes.
Quote from name:Azrael.Wrath
Edit: Looking at the death count explanation, I'm guessing you use 8 separate death counts for the sake of simplicity. You really only need 1.
Correct.
However since it's been mentioned I'll show you this alternative which you can use if you are comfortable with binary count-offs. If not, feel free to use 8 separate dcs as you probably never will run out of dcs.
Here's how it works with 1 dc: You code the player numbers as binary values to the same dc "Foes coded". (e.g. add 1 for P1, add 2 for P2, add 4 for P3, etc.)
So unallying P6, P3 and P1 would result in 32+4+1 = 37. Then you'd need 8 triggers, each checking for at least 128, 64, 32, 16, 8, 4, 2 and 1 respectively and each time unallying the associated player if it returns true and subtracting the value you just surpassed.
For this example:
At least 128 and 64 would be ignored.
At least 32 would return true, so unally associated player (P6) and subtract 32 from the dc. Resulting in 5 dc counts left over.
At least 16 and 8 would be ignored again.
At least 4 returns true, so unally associated player (P3) and subtract 4 from the dc. Resulting in 1 dc counts left over.
At least 2 would be ignored again.
The last trigger of this sequence, "at least 1" returns true again, so unally associated player (P1) and subtract 1 from the dc. Resulting in 0 dc counts left over.
Oh and yes, it has to be from the largest to the smallest number or it won't work. Read up on binary count-offs for more information.
Problem here is trigger order *. You need another dc that ensures that while P1-8 are setting the dc the resolution triggers that check for the binary values and unally the associated player(s) aren't subtracting prematurely. Basically like a switch, but each player has its own count. Let it run for 2 trigger loops in add mode, then 2 trigger loops in subtract mode.
*Actually I'm not entirely sure if it would glitch if you didn't implement this precaution since I have a hard time figuring what happens with various cross-player combinations of unallying. I guess you could try without this switching dc and if it glitches add it, if you really have to save on this one dc or if you are a perfectionist.