• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!

Leaderboard Problems

Status
Not open for further replies.
Level 7
Joined
Apr 3, 2009
Messages
83
Hey, I and my brother is working on a map that is suposed to use a leaderboard. But when we tries the map, doesn't the leaderboard count more then just 1. It doesn't matter how many zombies (in this case) we are killing, the leaderboard stops after the first kill.
Please help us.

Triggers
  • Board
    • Events
      • Unit - A unit enters Portal <gen>
    • Conditions
    • Actions
      • Leaderboard - Create a leaderboard for (All players) titled Zombie Kills
      • Leaderboard - Show (Last created leaderboard)
      • Leaderboard - Add Player 1 (Red) to (Last created leaderboard) with label ((Name of Player 1 (Red)) + 's kills) and value LeaderValue[1]
      • Leaderboard - Add Player 2 (Blue) to (Last created leaderboard) with label ((Name of Player 2 (Blue)) + 's kills) and value LeaderValue[2]
      • Leaderboard - Add Player 3 (Teal) to (Last created leaderboard) with label ((Name of Player 3 (Teal)) + 's kills) and value LeaderValue[3]
      • Leaderboard - Add Player 4 (Purple) to (Last created leaderboard) with label ((Name of Player 4 (Purple)) + 's kills) and value LeaderValue[4]
      • Leaderboard - Add Player 5 (Yellow) to (Last created leaderboard) with label ((Name of Player 5 (Yellow)) + 's kills) and value LeaderValue[5]
      • Leaderboard - Add Player 6 (Orange) to (Last created leaderboard) with label ((Name of Player 6 (Orange)) + 's kills) and value LeaderValue[6]
      • Leaderboard - Add Player 7 (Green) to (Last created leaderboard) with label ((Name of Player 7 (Green)) + 's kills) and value LeaderValue[7]
      • Leaderboard - Add Player 8 (Pink) to (Last created leaderboard) with label ((Name of Player 8 (Pink)) + 's kills) and value LeaderValue[8]
      • Leaderboard - Add Player 9 (Gray) to (Last created leaderboard) with label ((Name of Player 9 (Gray)) + 's kills) and value LeaderValue[9]
      • Leaderboard - Add Player 10 (Light Blue) to (Last created leaderboard) with label ((Name of Player 10 (Light Blue)) + 's kills) and value LeaderValue[10]
  • Untitled Trigger 001 Copy
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Zombie
    • Actions
      • Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to (LeaderValue[(Player number of (Owner of (Killing unit)))] + 1)
variable is "LeaderValue" that is a integer with size 8192. I'll send a pic soon.
 
Why did you set the value to 8192? Let it be just 1. Plus, you might also want to save the leaderboard in a variable.

Replace this:
  • Leaderboard - Add Player 1 (Red) to (Last created leaderboard) with label ((Name of Player 1 (Red)) + 's kills) and value LeaderValue[1]
  • Leaderboard - Add Player 2 (Blue) to (Last created leaderboard) with label ((Name of Player 2 (Blue)) + 's kills) and value LeaderValue[2]
  • Leaderboard - Add Player 3 (Teal) to (Last created leaderboard) with label ((Name of Player 3 (Teal)) + 's kills) and value LeaderValue[3]
  • Leaderboard - Add Player 4 (Purple) to (Last created leaderboard) with label ((Name of Player 4 (Purple)) + 's kills) and value LeaderValue[4]
  • Leaderboard - Add Player 5 (Yellow) to (Last created leaderboard) with label ((Name of Player 5 (Yellow)) + 's kills) and value LeaderValue[5]
  • Leaderboard - Add Player 6 (Orange) to (Last created leaderboard) with label ((Name of Player 6 (Orange)) + 's kills) and value LeaderValue[6]
  • Leaderboard - Add Player 7 (Green) to (Last created leaderboard) with label ((Name of Player 7 (Green)) + 's kills) and value LeaderValue[7]
  • Leaderboard - Add Player 8 (Pink) to (Last created leaderboard) with label ((Name of Player 8 (Pink)) + 's kills) and value LeaderValue[8]
  • Leaderboard - Add Player 9 (Gray) to (Last created leaderboard) with label ((Name of Player 9 (Gray)) + 's kills) and value LeaderValue[9]
  • Leaderboard - Add Player 10 (Light Blue) to (Last created leaderboard) with label ((Name of Player 10 (Light Blue)) + 's kills) and value LeaderValue[10]
With this:
  • Actions
  • For each (Integer A) from 1 to 10, do (Actions)
    • Loop - Actions
      • Leaderboard - Add Player(IntegerA) to (Last created leaderboard) with label ((Name of (Player(IntegerA)) + 's kills) and value LeaderValue[(IntegerA)]
The Player(IntegerA): When it asks you to add a player, scroll to "Conversion - Convert Player to Player Index".

Edit: Here is a test map: http://www.hiveworkshop.com/forums/triggers-scripts-269/leaderboard-bug-160397/#post1494970
 
Status
Not open for further replies.
Top