• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Victory Conditions

Status
Not open for further replies.
Level 2
Joined
Dec 17, 2010
Messages
18
Oh Mighty Hive!!

Again I apologize if this is answered elsewhere but....

I am trying to set up custom melee victory conditions, and I don't really know where to begin. I added a lot of custom buildings, some of which I would like to be classified as town halls so as not to cause a reveal if everything else is destroyed, but that turned out to be easier said than done, so I just created my own custom defeat condition (I can post it if anyone would like to see it) which works just fine, people lose when they lose all of their units. However, I can't get the victory condition to work. IE, when every other player is defeated, I want the last player standing to get a victory message like in a standard unmoded melee game.

I've searched high and low, and am completely lost, so any tips would be greatly appreciated. Thanks in advance!
 
Level 13
Joined
Jun 22, 2004
Messages
783
In essence what you want to do is monitor how many people started playing and how many are defeated. A simple method that can be applied basically consists out of 2 steps and 2 player forces. (I put some triggers below the explanation of how it CAN be done with the GUI triggers.

The first bit is easy, put all players that are actively playing from the start in the 1st group (example "initialPlayers").

  • Add players
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Actions)
        • Loop - Actions
          • Player Group - Add (Picked player) to innitialPlayers

Once a player doesn't have a force left(no units), apply them to the defeated player group and check if the defeated group consists out of one less player then the "innitialPlayers" group.

Player is defeated
  • Player is defeated
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units owned by (Owner of (Dying unit)) matching (((Matching unit) is alive) Equal to True))) Equal to 0
        • Then - Actions
          • Player Group - Add (Owner of (Dying unit)) to defeatedPlayers
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of players in defeatedPlayers) Equal to ((Number of players in innitialPlayers) - 1)
            • Then - Actions
              • Player Group - Pick every player in innitialPlayers and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked player) is in defeatedPlayers) Equal to False
                    • Then - Actions
                      • Game - Victory (Picked player) (Show dialogs, Show scores)
                    • Else - Actions
            • Else - Actions
              • Do nothing
        • Else - Actions

The looping is done through the "innitialPlayers" group to see which player is not defeated. that is then the winner.

EDIT: heck, I added the map so you can have a look
 

Attachments

  • Custom victory.w3x
    18.4 KB · Views: 65
Last edited:
Level 2
Joined
Dec 17, 2010
Messages
18
You people are amazing, I only kindof follow that trigger. I'll try that this afternoon and let you know how it goes. This is the final piece of an enormous custom melee map that i've been working on for years. Thanks a ton!
 
Status
Not open for further replies.
Top