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

[Trigger] Leaderboard Help

Status
Not open for further replies.
I tried to create this leaderboard but im having trouble. this is what i have so far:

  • leader1
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Leaderboard - Create a leaderboard for (All players) titled Wins in a Duel
      • Leaderboard - Add Player 1 (Red) to (Last created leaderboard) with label Harry Potter and value 0
      • Leaderboard - Add Player 2 (Blue) to (Last created leaderboard) with label Ron Weasly and value 0
      • Leaderboard - Add Player 3 (Teal) to (Last created leaderboard) with label Hermione Granger and value 0
      • Leaderboard - Add Player 4 (Purple) to (Last created leaderboard) with label <Empty String> and value 0
      • Leaderboard - Add Player 5 (Yellow) to (Last created leaderboard) with label <Empty String> and value 0
      • Leaderboard - Add Player 6 (Orange) to (Last created leaderboard) with label <Empty String> and value 0
      • Leaderboard - Add Player 7 (Green) to (Last created leaderboard) with label Drako Malfoy and value 0
      • Leaderboard - Add Player 8 (Pink) to (Last created leaderboard) with label <Empty String> and value 0
      • Leaderboard - Add Player 9 (Gray) to (Last created leaderboard) with label Crabbe and value 0
      • Leaderboard - Add Player 10 (Light Blue) to (Last created leaderboard) with label Goyle and value 0
and the other one to work with it:

  • leader2
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Leaderboard - Change the value for (Owner of (Dying unit)) in (Last created leaderboard) to (Value) - 1)
and for the last one:

  • leader3
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to (Value + 1)
what i want it to do is so in a duel if a unit kills another unit it gets +1 and if that unit dies gets -1.
 
Level 6
Joined
Feb 2, 2005
Messages
205
hmm

i would create an interger array named "Points", merge the other two triggers into one trigger, and in addition create an trigger called update (for Updating the leaderboard)

Here the Triggers

  • Leaderboard create
    • Events
      • Time - Elapsed game time is 0.05 seconds
    • Conditions
    • Actions
      • Leaderboard - Create a leaderboard for (All players) titled Leaderboard
      • Set Leaderboard = (Last created leaderboard)
      • Leaderboard - Add Player 1 (Red) to Leaderboard with label Harry Potter and value Points[1]
      • Leaderboard - Add Player 2 (Blue) to Leaderboard with label Dirty Harry and value Points[2]
  • Points
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set Points[(Player number of (Owner of (Killing unit)))] = (Points[(Player number of (Owner of (Killing unit)))] + 1)
      • Set Points[(Player number of (Owner of (Triggering unit)))] = (Points[(Player number of (Owner of (Triggering unit)))] - 1)
      • Trigger - Run Update <gen> (ignoring conditions)
  • Update
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Leaderboard - Change the value for (Player((Integer A))) in Leaderboard to Points[(Integer A)]
Not the perfect solution but a good one, you could also add an loop to the leaderboard creation trigger.
 
Last edited:
Level 6
Joined
Feb 2, 2005
Messages
205
hmm i tested thos in an created map and they work fine for me, i attached it. Have a look.

Maybe the loop creates the crash, did you use more loops in your map?

Did you create all Variables?

Leaderboard (Leaderboard)
Points (Interger Array)

Maybe the map will get you the idea what is wrong.
 

Attachments

  • leaderboard.w3x
    17.9 KB · Views: 65
Status
Not open for further replies.
Top