• 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.

[Trigger] Structure building-related victory conditions.

Status
Not open for further replies.
Level 1
Joined
Sep 21, 2011
Messages
7
Hello, Hive Workshop community. This is my first post here, as I am not really a person that requires formal introductions.

This post regards the commonly mentioned victory conditions. I am looking to recreate the Warcraft 2 campaigns in Warcraft 3 (yes, it's been tried before, but I haven't seen anything concludent). I have figured out what most triggers and If/Then/Else actions do, but I haven't been able to find out exactly how to set a victory condition to... say, build 4 farms/1 barracks etc.

Everything I've found on the internet - regarding victory conditions - is only related to destruction or getting a unit to a certain region.

I wanted my trigger to look similar to Pharaoh_'s second post in this thread
http://www.hiveworkshop.com/forums/...-you-make-multiple-victory-conditions-166100/

But so far I could only come up with this
sheesh.jpg


I cannot figure out how he got rid of the "Name of" thing! Or if I'm actually doing something right in this whole trigger business.

http://www.mediafire.com/?i4lgar2ih1iu848 This is the Zul'dare map, to whom it may concern.

Yes, it's a mess, I've just started last night. I also have a campaign file, but I need to make some balance changes to fit the Warcraft 2 feel. Like making unit costs equivalent between the two races, and change unit stats so the Orcs won't be like The Incredible Hulk fighting Bruce Banner.
 
Last edited:
Level 4
Joined
Aug 17, 2008
Messages
81
  • Events
    • Unit - A unit Finishes construction
  • Conditions
    • ((Unit-type of (Constructed structure)) Equal to Farm) or ((Unit-type of (Constructed structure)) Equal to Barracks)
  • Actions
    • Set Victory_Integer_Farm = 0
    • Set Victory_Integer_Barracks = 0
    • Set VictoryGroup = (Units owned by (Owner of (Constructed structure)))
    • Unit Group - Pick every unit in VictoryGroup and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Picked unit)) Equal to Farm
            • ((Picked unit) is alive) Equal to True
          • Then - Actions
            • Set Victory_Integer_Farm = (Victory_Integer_Farm + 1)
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Unit-type of (Picked unit)) Equal to Barracks
                • ((Picked unit) is alive) Equal to True
              • Then - Actions
                • Set Victory_Integer_Barracks = (Victory_Integer_Barracks + 1)
              • Else - Actions
    • Custom script: call DestroyGroup (udg_VictoryGroup)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Victory_Integer_Barracks Greater than or equal to 1
        • Victory_Integer_Farm Greater than or equal to 5
      • Then - Actions
        • Game - Victory (Owner of (Constructed structure)) (Show dialogs, Show scores)
      • Else - Actions
This is one way of doing it. Maybe not the best (I may be overlooking a simpler way) but it should do the job.

Welcome to the hive :)

For future reference, it's a lot easier to just right click and "copy as text" your trigger and place it in a [trigger] [/trigger] snippet instead of making an image of it and hosting it somewhere.
 
Last edited:
Level 1
Joined
Sep 21, 2011
Messages
7
Nice, but how does the editor know which structure is a farm? I'm trying to introduce the Pig Farms as such. Also, how do I add those "Set Victory_Integer_Farm" actions?
 
Level 4
Joined
Aug 17, 2008
Messages
81
Nice, but how does the editor know which structure is a farm? I'm trying to introduce the Pig Farms as such. Also, how do I add those "Set Victory_Integer_Farm" actions?

The editor knows which structure is a farm because you condition it to check if the unit is a farm or not. You can condition it to check if the unit is one type of farm or another, like so:

  • Conditions
  • (Unit-type of (Picked unit)) Equal to Farm OR Unit-type of (Picked unit)) Equal to Pig Farm)
Proper conditions are vital for making triggers that only run under the exact circumstances you want them to run.

Those "Set Victory_Integer_Farm" are variables created under Variables (CTRL+B)
They're classified as a Integer, and the "VictoryGroup" variable is a Unit Group.

After you create them, you can set your previously created variables by searching "set variable" in actions. You can also call on them in the variables drop down menu for most actions if it's the proper variable type for the action/condition.

I'd like to suggest you read an essential guide to wc3 trigger editor if you're confused, however I have no idea where to find a decent one. Google it or maybe someone else can direct you the right way. If you have more questions I can do my best to answer them, but I'm a pretty shitty teacher lol.
 
Level 1
Joined
Sep 21, 2011
Messages
7
I should have forseen these technical difficulties >_> I'd have to find a team of trigger...ers now. Thanks for your help nonetheless, fellow hive dweller.
 
Level 4
Joined
Aug 17, 2008
Messages
81
Triggers aren't hard (mind you there is a lot of technical bullshit as well as limitations if you aren't using JASS.) you just have learn the basics of what you have to work with and practice through trial and error. Also if you're stuck with something you can always ask for help here. You don't need a team. You just some time and willingness to learn.

Hell, you could learn everything yourself just by playing around with other maps triggers to figure out how and why things work. (That's what I did, pssh Guides!) It's also useful in a player aspect because you can understand WHY and HOW everything triggered in the map you're playing works, because you understand it.
 
Level 1
Joined
Sep 21, 2011
Messages
7
Thank you for your help so far Tazuwukei, but I still haven't been able to figure out how to get that desired "Set <x> = <something" effect. All I've found is a "Quest" option. I'm not sure if it affects gameplay or just displays what you have to do in the Quest tab in-game.

EDIT: Nevermind, I'm an idiot and I should've just used the "Search For Text" function. :)

EDIT #2: Here is what I've succeeded:

  • Victory Conditions
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • ((Unit-type of (Constructed structure)) Equal to Pig Farm) or ((Unit-type of (Constructed structure)) Equal to Barracks)
    • Actions
      • Set Victory_Integer_Farm = 0
      • Set Victory_Integer_Barracks = 0
      • Set VictoryGroup = (Units owned by (Owner of (Constructed structure)))
      • Unit Group - Pick every unit in VictoryGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Unit-type of (Picked unit)) Equal to Farm) or ((Unit-type of (Picked unit)) Equal to Pig Farm)
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Set Victory_Integer_Farm = (Victory_Integer_Farm + 1)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Barracks
                  • ((Picked unit) is alive) Equal to True
                • Then - Actions
                  • Set Victory_Integer_Barracks = (Victory_Integer_Barracks + 1)
                • Else - Actions
      • Custom script: call DestroyGroup (udg_VictoryGroup)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Victory_Integer_Farm Greater than or equal to 4
          • Victory_Integer_Barracks Greater than or equal to 1
        • Then - Actions
          • Game - Victory (Owner of (Constructed structure)) (Show dialogs, Show scores)
        • Else - Actions
Unfortunately, after I build 4 farms the game gives me the victory menu. Another weird thing is that the orc sound scheme is the human one (when peons finish building stuff you hear "Job's done!", and when you're under attack it says "Our forces are under attack!"). I haven't changed any sound schemes in my customized units. :\

Edit #3

I think I've noticed something, in the end I could put an "And" between the two If conditions. I'll return with results. It worked but... I've set the number of required farms to 4, yet I only won after I had finished the 5th, strange.
Regardless, I've completed this map in an 80% proportion (various tweaks and balancing stuff here and there, and I need to add the quest(s) ^^')

Edit #4

Damn it :| I've tried playing the map again, and as soon as the peon finished building the barracks the victory menu came up -_- I guess I'm just... *puts shades on* Forsaken.

YEEEEEEEAAAAAAAAAAH!!
 
Last edited:
Level 1
Joined
Sep 21, 2011
Messages
7
I've figured that out, Tazu, now I just need to figure out what's wrong with my victory conditions, so that I may set them both as prerequisites to win.
 
Level 4
Joined
Aug 17, 2008
Messages
81
There's only one thing wrong with the trigger, and it's the fact that the initial condition isn't triple OR, it should be
  • ((Unit-type of (Constructed structure)) Equal to Pig Farm) or ((Unit-type of (Constructed structure)) Equal to Barracks) or ((Unit-type of (Constructed structure)) Equal to Pig Farm)
The only other possibility is that you already have farms built on the map, so it's counting those farms for the victory condition (because of it's nature to pick all player owned units), so when you build Barracks, the farm requirement is already fulfilled. It can be fixed so that only new farms count towards the victory condition if that's the case by changing the trigger slightly.
 
Level 1
Joined
Sep 21, 2011
Messages
7
I have 1 Pig Farm built on the map, because that's how it was in the original W2 map :) Should I just correct Set Victory_Integer_Farm = 0 to 1?

Edit: Yup, that solved it o_0
Edit 2: Solved it... somewhat. I've tried building 6 farms now, and then constructing the Barracks. Guess what, no victory -_- I'm beginning to think that this program is mocking me.

  • Victory Conditions
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • ((Unit-type of (Constructed structure)) Equal to Pig Farm) or ((Unit-type of (Constructed structure)) Equal to Barracks)
    • Actions
      • Set Victory_Integer_Farm = 1
      • Set Victory_Integer_Barracks = 0
      • Set VictoryGroup = (Units owned by (Owner of (Constructed structure)))
      • Unit Group - Pick every unit in VictoryGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Unit-type of (Picked unit)) Equal to Farm) or ((Unit-type of (Picked unit)) Equal to Pig Farm)
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Set Victory_Integer_Farm = (Victory_Integer_Farm + 1)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Barracks
                  • ((Picked unit) is alive) Equal to True
                • Then - Actions
                  • Set Victory_Integer_Barracks = (Victory_Integer_Barracks + 1)
                • Else - Actions
      • Custom script: call DestroyGroup (udg_VictoryGroup)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Victory_Integer_Farm Greater than or equal to 4) and (Victory_Integer_Barracks Greater than or equal to 1)
        • Then - Actions
          • Game - Victory (Owner of (Constructed structure)) (Show dialogs, Show scores)
        • Else - Actions
I have one more question, unrelated to the trigger, why does my idle worker icon keep changing into something else each time I start this map? At the moment I see a wisp. Oh, and the sound scheme is changed to Night Elf, as I've mentioned in an earlier post (when it was human-esque).
 
Level 4
Joined
Aug 17, 2008
Messages
81
It's because you're building regular farms instead of pig farms. You haven't updated the condition yet to include regular farms towards the goal (according to your new trigger posting) as I told you to do in my last post.

Also increase the
  • (Victory_Integer_Farm Greater than or equal to 4) and (Victory_Integer_Barracks Greater than or equal to 1)
count instead of changing the variables default setting.
 
Level 1
Joined
Sep 21, 2011
Messages
7
Well, while I search for someone to give me guidance in the world of triggers, I'll get to work on the second map's basic structure. Raid at Hillsbrad!
 
Status
Not open for further replies.
Top