Changing victory conditions

P

prevch

Guest
I have a map right now that features a custom made hero on the blue team and a few human soldiers on the red team.

I am playing as the blue team the computer controls the red team.

When I use the enforce victory/defeat conditions for all players action and run the map, the game immediately says that both red and blue teams were defeated. Mind you, there is no peons/peasants/resources etc.

Basically, I am wanting to change the victory conditions. When either team wipes out the other team, I want the match to be over. So if my hero takes out the human soldiers on the red team, I want the match to be over. Could someone please tell me the code for this?

IT's part of a school project so any help you could offer would be much appreciated. Thanks!
 
Z

Zell

Guest
Ugh I pretty much answered this qustion before, but I can't find it so here we go again -_-

Melee winning conditions (the ones you are enforcing) call Defeat when the player controls no buildings that can produce units (I.E. a Barracks or Town Hall, but not Farms). What you want to do is create a trigger acting when a unit dies, and check if the owner of the dying unit controls zero units. Then, call Defeat for that player.
 
P

prevch

Guest
Ugh I pretty much answered this qustion before, but I can't find it so here we go again -_-

Melee winning conditions (the ones you are enforcing) call Defeat when the player controls no buildings that can produce units (I.E. a Barracks or Town Hall, but not Farms). What you want to do is create a trigger acting when a unit dies, and check if the owner of the dying unit controls zero units. Then, call Defeat for that player.

I understand the concept, but I don't know the correct triggers/code to get this to work. Could you point me in the right direction?

Here is what I have, but it does not seem to be working

Upon Death
Events
Unit - Paladin 0025 <gen> Dies
Unit - Footman 0021 <gen> Dies
Unit - Footman 0020 <gen> Dies
Unit - Footman 0019 <gen> Dies
Unit - Spell Breaker 0018 <gen> Dies
Conditions
((Number of units in (Units owned by Player 1 (Red))) Equal to 0)
Actions
Game - Victory Player 2 (Blue) (Show dialogs, Show scores)


Yes, it's actually my senior thesis project for college at UW Whitewater. I am majoring in multimedia and we have to do some kind of interactive piece, so I chose a warcraft 3 campaign. I am pretty new to the map editor, but I am hoping that once it's done, it will be at least a little entertaining. Thanks for the help.
 
Z

Zell

Guest
That trigger is just about what you need, except for one addition and one simplification. In the Event, just use the Generic Unit Event (A Unit dies) since you want it to check any unit (this will make it easier for when you start to add a lot more units to the map). Also, you need to make Player 1 lose as well (or at least I think...?). Anyways, add "Game - Defeat Player 1 (Red) with the message: Defeat!" to your Actions for good measure.

The reason that your version isn't working is because anything in the Event or Condition field (even when using If / Then / Else) has an intrinsic "And" function. That means the trigger waits for all of the selected units to die first.
 
M

Manachicken

Guest
On the subject...

On the subject of victory conditions, I was wondering how to make it so when a player has a barracks. 4 farms and a lumber mill he wins. I am trying to recreate the human / orc campaign from tides of darkness on reign of chaos.
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
simply use this trigger:
Code:
Victory Condition
    Event
        Every 1.00 second
    Conditon
    <<None>>
    Action
        For Each integer A from 1 to <<Number of Players>> Do (Actions)
           Loop
              If (Condtion) Then Do (Actions) Else Do (Actions)
                  Conditon
                      Player (Integer A) Owns Building of type Barracks
                      Player (Integer A) Owns Building of type Farm
                      Player (Integer A) Owns Building of type Lumber Mill
                  Then
                      If (Number of Building of type Farm) Greater or Equal to 4 Then Set Victory..... Else Do nothing
                  Else
                      Do nothing
that should do it
 
P

prevch

Guest
That trigger is just about what you need, except for one addition and one simplification. In the Event, just use the Generic Unit Event (A Unit dies) since you want it to check any unit (this will make it easier for when you start to add a lot more units to the map). Also, you need to make Player 1 lose as well (or at least I think...?). Anyways, add "Game - Defeat Player 1 (Red) with the message: Defeat!" to your Actions for good measure.

The reason that your version isn't working is because anything in the Event or Condition field (even when using If / Then / Else) has an intrinsic "And" function. That means the trigger waits for all of the selected units to die first.

Unfortunately, this did not work either. Here's what I have

Death
Events
Unit - A unit owned by Player 1 (Red) Dies
Conditions
(Number of units in (Units owned by Player 1 (Red))) Less than or equal to 0 (i also tried 0)
Actions
Game - Defeat Player 1 (Red) with the message: Defeat!
Game - Victory Player 2 (Blue) (Show dialogs, Show scores)


I also tried the (A Unit dies but with no luck.

I also have another theory. I tried this code

Death
Events
Unit - A unit owned by Player 1 (Red) Dies
Conditions
(Number of units in (Units owned by Player 1 (Red))) Less than or equal to 0
Actions
Melee Game - Enforce victory/defeat conditions (for all players)

But this did not work either. I thought that once I killed all the red players, the game would declare deafeat for both teams, but it did not. That being the case, I'm thinking the game does not understand my condition. Does the game not autmatically keep track of the number of players each team has? Do I need to set number of red players = to some integer, then each time one dies add negative 1 to that number? If so, how is that done?

Does anyone here have a lot of experience with this command? Any additional help/ideas would be much appreciated.
 

Lanboy

TH.net Regular
Reaction score
22
On the subject of victory conditions, I was wondering how to make it so when a player has a barracks. 4 farms and a lumber mill he wins. I am trying to recreate the human / orc campaign from tides of darkness on reign of chaos.

Code:
Melee Initialization
    Events
        Unit - A unit Finishes construction
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Unit-type of (Constructed structure)) Equal to Barracks
                (Unit-type of (Constructed structure)) Equal to Farm
                (Unit-type of (Constructed structure)) Equal to Lumber Mill
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to (Owner of (Constructed structure))) and ((Unit-type of (Matching unit)) Equal to Farm)))) Equal or Greater than 4
                (Number of units in (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to (Owner of (Constructed structure))) and ((Unit-type of (Matching unit)) Equal to Barracks)))) Equal or Greater than 1
                (Number of units in (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to (Owner of (Constructed structure))) and ((Unit-type of (Matching unit)) Equal to Lumber Mill)))) Equal or Greater than 1
            Then - Actions
                Game - Victory (Owner of (Constructed structure)) (Show dialogs, Show scores)
                Game - Defeat EVERYONE ELSE? with the message: Defeat!
            Else - Actions
 
P

prevch

Guest
I did actually get this to work, but this is the code I had to use

Death
Events
Unit - A unit owned by Player 1 (Red) Dies
Conditions
And - All (Conditions) are true
Conditions
(Number of living Footman units owned by Player 1 (Red)) Equal to 0
(Number of living Paladin units owned by Player 1 (Red)) Equal to 0
(Number of living Spell Breaker units owned by Player 1 (Red)) Equal to 0
Actions
Game - Defeat Player 1 (Red) with the message: Defeat!
Game - Victory Player 2 (Blue) (Show dialogs, Show scores)
 

The Helper

Necromancy Power over 9000
Staff member
Reaction score
1,697
Need more help with this? Check out The Hive Workshop!

#1 Warcraft 3 Reforged Modding Community
The Hive Workshop is the largest Warcraft III community since 2004 with over 100k users, centered around map making, modeling, custom games, programming & art.

www.hiveworkshop.com


That is the absolute BEST resource for Warcraft 3 World Editor Help in 2023 and beyond. Everyone that was here is there.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top