• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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!
 
Level 27
Joined
May 18, 2018
Messages
397
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 64
Joined
Aug 10, 2018
Messages
6,554
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