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

Winning Condition with Property

Status
Not open for further replies.
Level 7
Joined
May 30, 2018
Messages
290
In my game the winning condition looks as follows:

  • Untitled Trigger 002
    • Events
      • Player - Player 1 (Red)'s Current gold becomes Greater than or equal to 500.00
    • Conditions
    • Actions
      • Game - Victory Player 1 (Red) (Show dialogs, Show scores)
      • Game - Defeat Player 2 (Blue) with the message: Defeat!
Is there a way to simplyfi the process of setting up this condition for every player seperatly, since I have 12 Players it would be a chore to do this for every 12 Players individually.

Thanks in advance!
 
Not the most effective solution, but try this:

  • Custom Win
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) Current gold) Greater than or equal to 500
            • Then - Actions
              • Game - Victory (Picked player) (Show dialogs, Show scores)
              • Player Group - Pick every player in (All players matching (((Matching player) is an enemy of (Picked player)) Igual a True)) and do (Actions)
                • Loop - Actions
                  • Game - Defeat (Picked player) with the message: Defeat!
            • Else - Actions
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,869
This trigger runs when a player's gold becomes >= 500. It picks through all of the players, checking if they're the Triggering Player-which will be equal to the player who won. If they are the Triggering Player, they win the game, if they aren't, they lose the game.
  • Win The Game
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Picked player) Equal to (Triggering player)
            • Then - Actions
              • Game - Victory (Picked player) (Show dialogs, Show scores)
            • Else - Actions
              • Game - Defeat (Picked player) with the message: Defeat!
This trigger adds the needed Events to the "Win The Game" trigger.
  • Setup Win Trigger
    • Events
      • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Win Trigger <gen> the event (Player - (Picked player)'s Current gold becomes Greater than or equal to 500.00)
If you don't want certain players such as Computers to be added to the Event then you will want to use something other than "All players".
 
Level 14
Joined
Sep 28, 2011
Messages
968
To Ricky Martin:
While it works it favours players that are picked first in the list.(ex: if player 1 and 2 reach 500 within the same tenth of second then player 1 might win even if they did actually reach 500 0.05 seconds later)
The huger the time step is the huger the advantage for low numbered players is but the least calculation intensive it is.
An alternative(useful only if you want a third way to do the exact same thing) is making victory checks on triggers that grants money.

Uncle did a clean implementation of what I described in my first post.
 
Status
Not open for further replies.
Top