So I'm havign a trigger problem. My trigger runs when a certain king units die. The trigger forces the person whose king died into an alliance with the person who killed it. The trigger also compares the number of players who are playing and allied together with the total number of players playing, and if these 2 numbers are equal, the victory event runs.
The trigger works fine, if all players stay in the game, however if someone leaves after being conquered a problem occurs. For example if there are 4 players, here is what is supposed to happen. Player 1 kills player 2. They are now both allied, they then kill player 3, and player 3 joins their alliance. Finally, they kill player 4, and the victory event then runs.
However, say player 2 leaves the game after Player 1 conquers him, but before they conquer player 3, the victory event runs when player 1 kills player 3, even though player 4 is still alive (even though player 2 has left the game, he is still allied with player 1.
Any idea whats wrong with my trigger? The problem code is below
The trigger works fine, if all players stay in the game, however if someone leaves after being conquered a problem occurs. For example if there are 4 players, here is what is supposed to happen. Player 1 kills player 2. They are now both allied, they then kill player 3, and player 3 joins their alliance. Finally, they kill player 4, and the victory event then runs.
However, say player 2 leaves the game after Player 1 conquers him, but before they conquer player 3, the victory event runs when player 1 kills player 3, even though player 4 is still alive (even though player 2 has left the game, he is still allied with player 1.
Any idea whats wrong with my trigger? The problem code is below
Code:
Player Group - Make (All allies of (Owner of (Triggering unit))) treat (All allies of (Owner of (Killing unit))) as an Ally with shared vision
Player Group - Make (All allies of (Owner of (Killing unit))) treat (All allies of (Owner of (Triggering unit))) as an Ally with shared vision
Set playergroup = (All allies of (Owner of (Killing unit)))
Set playergroup2 = (All players matching (((Matching player) slot status) Equal to Is playing))
Set playergroup3 = (All players matching ((((Matching player) is in playergroup) Equal to True) and (((Matching player) is in playergroup2) Equal to True)))
If ((Number of players in playergroup3) Equal to (Number of players in playergroup2)) then do (Player Group - Pick every player in playergroup and do (Game - Victory (Picked player) (Show dialogs, Show scores))) else do (Do nothing)