[Solved] Player Group / Force win

Level 2
Joined
Feb 24, 2010
Messages
8
I'm having problems in making a message showing that a player group won the game. I have two other triggers working with this one, one that removes players that doesn't have any units in the map from the player group, and other that removes players that loses their main building from the player group. Still, the message doesn't trigger even if I play alone and there are no other units on the map.

  • Team Victory
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of players in Team[1]) Greater than 0
          • (Number of players in Team[2]) Equal to 0
        • Then - Actions
          • Game - Display to (All players) the text: (Team 1 has won!)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of players in Team[1]) Equal to 0
              • (Number of players in Team[2]) Greater than 0
            • Then - Actions
              • Game - Display to (All players) the text: (Team 2 has won!)
            • Else - Actions
It should be simple, but any thoughts about why it doesn't work? Also, would anyone be able to post other method of how to do a team victory trigger?
 
Level 2
Joined
Feb 24, 2010
Messages
8
Ok, I checked my triggers again to paste here and it seems that my team victory triggers are flawed :vw_sad:


Can someone explain me a way to do a team victory trigger?
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
I hope you have declared and added players properly to player forces.

Those 'two' other triggers (you should have shown them here too) can be combined into one since both refer to Unit dies event.

  • remove
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units owned by (Triggering player)) matching (((Matching unit) is alive) Equal to True))) Equal to 0
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering player) is in Team1Group
            • Then - Actions
              • Player Group - Remove (Triggering player) from Team1Group
            • Else - Actions
              • Player Group - Remove (Triggering player) from Team2Group
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit type of (Triggering unit)) Equal to <Main structure>
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering player) is in Team1Group
            • Then - Actions
              • Player Group - Remove (Triggering player) from Team1Group
            • Else - Actions
              • Player Group - Remove (Triggering player) from Team2Group
        • Else - Actions
Both player forces should be non array variables.
  • Team Victory
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of players in Team1Group) Equal to 0
        • Then - Actions
          • Game - Display to (All players) the text: (Team 2 has won!)
          • Player Group - Pick every payer in Team1Group and do Actions
            • Loop - Actions
              • Game - Defeat (Picked player) with the message: Defeat!
          • Player Group - Pick every payer in Team2Group and do Actions
            • Loop - Actions
              • Game - Victory (Picked player) (Show dialogs, Show scores)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of players in Team2Group) Equal to 0
            • Then - Actions
              • Game - Display to (All players) the text: (Team 1 has won!)
              • Player Group - Pick every payer in Team2Group and do Actions
                • Loop - Actions
                  • Game - Defeat (Picked player) with the message: Defeat!
              • Player Group - Pick every payer in Team1Group and do Actions
                • Loop - Actions
                  • Game - Victory (Picked player) (Show dialogs, Show scores)
            • Else - Actions
 
Level 2
Joined
Feb 24, 2010
Messages
8
Allllllllllll right, I was able to do the trigger run fine by making it count units owned by both teams, then checking if it was equal or not to zero. Thanks to everyone who tried to help :grin: +reps
 
Top