• 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] Leaderboard Win/lose

Status
Not open for further replies.
Level 4
Joined
Jun 22, 2009
Messages
63
How do i make a trigger that at the end of the games shows the winner with most kills and gives victory,and lose for the others?
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
I assume you know how to create a multiboard. There's a tutorial for that.

Then:

  • Untitled Trigger 103
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set Kills_Array[(Player number of (Owner of (Killing unit)))] = (Kills_Array[(Player number of (Owner of (Killing unit)))] + 1)
^That keeps up player kills.

When the game ends, run this:

  • Untitled Trigger 103 Copy
    • Events
    • Conditions
    • Actions
      • Set Temp_Integer_1 = 0
      • Set Temp_Integer_2 = 0
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Kills_Array[(Integer A)] Greater than Temp_Integer_1
            • Then - Actions
              • Set Temp_Integer_1 = Kills_Array[(Player number of (Player((Integer A))))]
              • Set Temp_Integer_2 = (Player number of (Player((Integer A))))
            • Else - Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Temp_Integer_2 Not equal to (Player number of (Player((Integer A))))
            • Then - Actions
              • Game - Defeat (Player((Integer A))) with the message: Defeat!
            • Else - Actions
              • Game - Victory (Player((Integer A))) (Show dialogs, Show scores)
Note that a draw isn't possible with this script, you need to modify it a bit. I can do that if needed.
 
Status
Not open for further replies.
Top