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

How do you make multiple Victory Conditions?

Status
Not open for further replies.
Level 12
Joined
Jun 10, 2008
Messages
1,043
Hello! The title of this thread probably doesn't make much sense so I'll just give a long explanation of what I mean.

For my map, you need to construct ike 10 Farms, 3 Barracks, etc. to win. I can figure out how to make it so that when you build one you win, but cannot figure out how to make it so that when like you build the tenth one you win, or when you build all the buildings you win. I was told it was something with Integers, so I experimented with the integer variables for a while and couldn't even figure out how to make it so that you win when you build 10 farms, much less when you build 10 farms and 3 barracks. +Rep if you help, and thanks for reading!
 
Yes, you need integer variable with array option ticked.
  • Trigger1
  • Events
    • Unit - A unit finishes construction
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Farm
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Count[Player Number of (Owner of (Triggering unit))]) Not Equal to 10
      • Then - Actions
        • Set Count[Player Number of (Owner of (Triggering unit))] = (Count[Player Number of (Owner of (Triggering unit))] + 1)
      • Else - Actions
        • Game - Victory (Owner of (Triggering unit)) (Show dialogs, show scores)
 
Level 12
Joined
Jun 10, 2008
Messages
1,043
I'm guessing it's similar, but how would you make it so you have to make the 10 Farms and 3 Barracks? Will it be 2 different triggers?
 
Not triggers, variables.
  • Trigger1
  • Events
    • Unit - A unit finishes construction
  • Conditions
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Farms[Player Number of (Owner of (Triggering unit))]) Not Equal to 10
        • (Barracks[Player Number of (Owner of (Triggering unit))]) Not Equal to 10
      • Then - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • (Unit-type of (Triggering unit)) Equal to Barracks
          • Then - Actions
            • Set Barracks[Player Number of (Owner of (Triggering unit))] = (Barracks[Player Number of (Owner of (Triggering unit))] + 1)
          • Else - Actions
            • If (All conditions are true) then do (Actions) else do (Actions)
              • If - Conditions
                • (Unit-type of (Triggering unit)) Equal to Farm
              • Then - Actions
                • Set Farms[Player Number of (Owner of (Triggering unit))] = (Farms[Player Number of (Owner of (Triggering unit))] + 1)
              • Else - Actions
      • Else - Actions
        • Game - Victory (Owner of (Triggering unit)) (Show dialogs, show scores)
There are many ways to achieve this effect. You can even store the values in hashtables, but this is the easiest solution.
 
Level 12
Joined
Jun 10, 2008
Messages
1,043
Thank you very much, helps a lot! +Rep

Edit: Says I need to spread around some rep before giving it to you, even though I don't recall ever seeing you/giving you rep before. I'll keep this thread bookmarked and +Rep you later.
 
Status
Not open for further replies.
Top