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,701
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
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top