• 🏆 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!

Victory trigger

Status
Not open for further replies.
Level 2
Joined
Jul 27, 2006
Messages
7
Hi


I need some help to do a victory trigger to my map:

when all players are defeated except 1 make the 1 left victory

I kow it should be easy but I can't figure it out =S
 
Level 16
Joined
Oct 30, 2004
Messages
1,277
When a player leaves pick all players matching condition is still playing. Then check if its only one player matching the condition and set him victory. Dont have the time to open editor atm. That should atleast guide you to right direction.
 
Heres what you do. Create a variable for each player setting [use a boolean variable] when a player leaves/is deffeated/isnt there period make it set that variable to false. then create a trigger that runs every so often [might need a few of these] so that when all but one player's staus is 'here equal to false' the remaining player wins
 
Level 16
Joined
Oct 30, 2004
Messages
1,277
This should work, though havent tested it, whipped it up in couple of secs (player_count is a integer variable default 0):

  • leaver
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • Player - Player 3 (Teal) leaves the game
      • Player - Player 4 (Purple) leaves the game
      • Player - Player 5 (Yellow) leaves the game
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Actions)
        • Loop - Actions
          • Set player_count = (player_count + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • player_count Equal to 1
        • Then - Actions
          • Player Group - Pick every player in (All players) and do (Game - Victory (Picked player) (Show dialogs, Show scores))
        • Else - Actions
          • Set player_count = 0
 
Status
Not open for further replies.
Top