• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Victory Condition help

Status
Not open for further replies.
Level 11
Joined
May 11, 2008
Messages
830
Hello Hiveworkshop

I have a small problem with the victory trigger thing. Here's how it works. There are 2 ways to win in my map either destroy all the enemies main building or they leave, now i've tried the Melee Game - Enforce Victory/Defeat but it when I test it, it shows that you need to build a (town hall) or you will be reveal thing so that isn't the answer.

Now i've tried multiple events like (Name of Building) dies and did it with the other buildings, the result? If one of them is destroy it's considered a victory so that's not the answer to.
 
Level 9
Joined
Apr 3, 2008
Messages
700
And for the case when all players leave make another trigger:
_____________________________________________________________
Event: Player Leaves the Game
If: Number of players matching: slot status comparison - playing = 0
Do: <Win>
_____________________________________________________________
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
Put all buildings and players into 2 player / unit groups.

  • Victory 1
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • ((Triggering unit) is in BuildingGroup1) Equal to True
          • ((Triggering unit) is in BuildingGroup2) Equal to True
    • Actions
      • -------- This trigger checks main buildings --------
      • -------- It defeats a player as soon as he loses his main building --------
      • -------- It defeats a player as soon as he loses his main building --------
      • -------- Now we must remove building and player from their respective groups --------
      • Unit Group - Remove (Triggering unit) from BuildingGroup1
      • Unit Group - Remove (Triggering unit) from BuildingGroup2
      • Player Group - Remove (Owner of (Triggering unit)) from PlayerGroup1
      • Player Group - Remove (Owner of (Triggering unit)) from PlayerGroup2
      • Game - Defeat (Owner of (Triggering unit)) with the message: Defeat!
      • -------- Checking if all players in one group are defeated / left --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in BuildingGroup1) Equal to 0
        • Then - Actions
          • -------- Pick every player in opposite group here and make him win --------
          • Player Group - Pick every player in PlayerGroup2 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 units in BuildingGroup2) Equal to 0
        • Then - Actions
          • -------- Pick every player in opposite group here and make him win --------
          • Player Group - Pick every player in PlayerGroup1 and do (Actions)
            • Loop - Actions
              • Game - Victory (Picked player) (Show dialogs, Show scores)
        • Else - Actions
  • Victory 2
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • Player - Player 3 (Teal) leaves the game
    • Conditions
    • Actions
      • -------- This trigger checks player leaves --------
      • -------- Add as many players as you want in events --------
      • Player Group - Remove (Owner of (Triggering unit)) from PlayerGroup1
      • Player Group - Remove (Owner of (Triggering unit)) from PlayerGroup2
      • -------- Checking if all players in one group are defeated / left --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of players in PlayerGroup1) Equal to 0
        • Then - Actions
          • -------- Pick every player in opposite group here and make him win --------
          • Player Group - Pick every player in PlayerGroup2 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 PlayerGroup2) Equal to 0
        • Then - Actions
          • -------- Pick every player in opposite group here and make him win --------
          • Player Group - Pick every player in PlayerGroup1 and do (Actions)
            • Loop - Actions
              • Game - Victory (Picked player) (Show dialogs, Show scores)
        • Else - Actions
You could use arrays for building and player groups too.
 
Level 12
Joined
Aug 22, 2008
Messages
911
I offer simply using integer variables to count how many bases did the player kill or how many are left. In this case the default initial value of the integer variable Basecount is 5, because there are 5 main buildings.
  • Victory 1
    • Events
      • Unit - A unit dies
    • Conditions
      • And (All conditions are true)
        • Conditions
          • ((Triggering Unit) is a town hall) equal to True
          • (Owner of (Triggering Unit) is an enemy of Player 1) equal to True
    • Actions
      • Set Basecount = Basecount + 5
      • If (Basecount equal to 0) Then do (Then Actions) Else do (Else Actions)
        • Then - Actions
          • Player - Victory Player 1, Show Dialog, Show score
        • Else - Actions
Use this way only if you know how many main buildings are going to be in the first place.
 
Status
Not open for further replies.
Top