• 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

Status
Not open for further replies.
Level 4
Joined
Feb 27, 2008
Messages
71
  • LeaderBoard
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Leaderboard - Create a leaderboard for (Player group((Player((Integer A))))) titled Kills
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) controller) Equal to User
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Leaderboard - Add (Player((Integer A))) to (Last created leaderboard) with label (Name of (Player((Integer A)))) and value 0
            • Else - Actions
      • Leaderboard - Show (Last created leaderboard)
  • Kill update leaderboard
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
    • Actions
      • Set kills[(Player number of (Owner of (Killing unit)))] = kills[((Player number of (Owner of (Killing unit))) + 1)]
      • Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to kills[(Player number of (Owner of (Killing unit)))]
      • Leaderboard - Sort (Last created leaderboard) by Value in Descending order
Is this right? for when i kill a mob i dont get 1+ i stand on 0 always....
 
Level 5
Joined
Oct 27, 2007
Messages
158
  • LeaderBoard
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 0 to 9, do (Actions)
        • Loop - Actions
          • Leaderboard - Create a leaderboard for (Player group((Player((Integer A))))) titled Kills
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) controller) Equal to User
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Leaderboard - Add (Player((Integer A))) to (Last created leaderboard) with label (Name of (Player((Integer A)))) and value 0
            • Else - Actions
      • Leaderboard - Show (Last created leaderboard)
  • Kill update leaderboard
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
    • Actions
      • Set kills[(Player number of (Owner of (Killing unit)))] = kills[((Player number of (Owner of (Killing unit))) + 1)]
      • Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to kills[(Player number of (Owner of (Killing unit)))]
      • Leaderboard - Sort (Last created leaderboard) by Value in Descending order
Is this right? for when i kill a mob i dont get 1+ i stand on 0 always....


User player indexes go from 0 throughout 11. You need to set the loop from 0 to 9
 
Level 5
Joined
Oct 27, 2007
Messages
158
im not sure either if they start at 0... i dont see why ti would xD

Correction on my part...

They do start at 0, however I forgot that the GUI uses a function that subtracts 1 from the player index. So actually they do start from 0, but the GUI handles this pretty stupid, because it doesn't check for a 0 index, so only indexes 1 through 12 are used to address players.

So using 1 through 10 in the loop is fine. Using index 0 will result in player -1 getting fetched, which obviously is a non existing player. My guess is that maybe the kills array isn't properly set up to match the player indexes.
 
Level 5
Joined
Aug 27, 2007
Messages
138
Player indexes in GUI start at one and go through... sixteen or so? That's not your problem though. It's here:

  • For each (Integer A) from 1 to 10, do (Actions)
  • Loop - Actions
  • Leaderboard - Create a leaderboard for (Player group((Player((Integer A))))) titled Kills
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
  • ((Player((Integer A))) controller) Equal to User
  • ((Player((Integer A))) slot status) Equal to Is playing
  • Then - Actions
  • Leaderboard - Add (Player((Integer A))) to (Last created leaderboard) with label (Name of (Player((Integer A)))) and value 0
  • Else - Actions
You're creating a separate leaderboard for each player. This means that only the last created leaderboard will be shown, the one created for player 10, so only if player 10 gets a kill will it update. Instead, you need to create one leaderboard and add all the players to it.

  • Leaderboard - Create a leaderboard for All Players titled Kills
  • For each (Integer A) from 1 to 10, do (Actions)
  • Loop - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • ((Player((Integer A))) controller) Equal to User
  • ((Player((Integer A))) slot status) Equal to Is playing
  • Then - Actions
  • Leaderboard - Add (Player((Integer A))) to (Last created leaderboard) with label (Name of (Player((Integer A)))) and value 0
    • Else - Actions
  • Leaderboard - Show (Last created leaderboard)
Or something like that. I haven't done GUI in a while.
 
Level 4
Joined
Feb 27, 2008
Messages
71
See here , i kill still on 0 and my Trigger is still this
  • LeaderBoard
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Leaderboard - Create a leaderboard for (Player group((Player((Integer A))))) titled Kills
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) controller) Equal to User
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Leaderboard - Add (Player((Integer A))) to (Last created leaderboard) with label (Name of (Player((Integer A)))) and value 0
            • Else - Actions
      • Leaderboard - Show (Last created leaderboard)
  • Kill update leaderboard
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
    • Actions
      • Set kills[(Player number of (Owner of (Killing unit)))] = kills[((Player number of (Owner of (Killing unit))) + 1)]
      • Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to kills[(Player number of (Owner of (Killing unit)))]
      • Leaderboard - Sort (Last created leaderboard) by Value in Descending order
What is Wrong !??! :(((

Just look at my picture here
Please help <.<
 

Attachments

  • LeaderBoards.jpg
    LeaderBoards.jpg
    58.8 KB · Views: 121
You're still creating a leaderboard for each player. Do as Alkonis suggested and create it before your loop.

  • LeaderBoard
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Leaderboard - Create a leaderboard for (All Players) titled Kills
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) controller) Equal to User
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Leaderboard - Add (Player((Integer A))) to (Last created leaderboard) with label (Name of (Player((Integer A)))) and value 0
            • Else - Actions
      • Leaderboard - Show (Last created leaderboard)
Should fix your problem.
 
Level 4
Joined
Feb 27, 2008
Messages
71
Hmm Lets see :grin: Hope it work:grin::grin::grin:

3 minutt Later.....

It dident work just look

And my trigger is this like Illidan(Evil)X say

  • LeaderBoard
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Leaderboard - Create a leaderboard for (All players) titled Kills
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) controller) Equal to User
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Leaderboard - Add (Player((Integer A))) to (Last created leaderboard) with label (Name of (Player((Integer A)))) and value 0
            • Else - Actions
      • Leaderboard - Show (Last created leaderboard)

  • Kill update leaderboard
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
    • Actions
      • Set kills[(Player number of (Owner of (Killing unit)))] = kills[((Player number of (Owner of (Killing unit))) + 1)]
      • Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to kills[(Player number of (Owner of (Killing unit)))]
      • Leaderboard - Sort (Last created leaderboard) by Value in Descending order
Just look at the Picture :confused:
 

Attachments

  • LeaderBoard.jpg
    LeaderBoard.jpg
    93.1 KB · Views: 136
Level 40
Joined
Dec 14, 2005
Messages
10,532
It's because you have the +1 inside the array index of kills, instead of outside it (to add to the value), so thus you set the value of player xxx's kills to player xxx+1's kills.

Set kills[(Player number of (Owner of (Killing unit)))] = kills[((Player number of (Owner of (Killing unit))) + 1)]

Should be

Set kills[(Player number of (Owner of (Killing unit)))] = (kills[(Player number of (Owner of (Killing unit)))] + 1)
 
Level 19
Joined
Sep 4, 2007
Messages
2,826
It's because you have the +1 inside the array index of kills, instead of outside it (to add to the value), so thus you set the value of player xxx's kills to player xxx+1's kills.

Set kills[(Player number of (Owner of (Killing unit)))] = kills[((Player number of (Owner of (Killing unit))) + 1)]

Should be

Set kills[(Player number of (Owner of (Killing unit)))] = (kills[(Player number of (Owner of (Killing unit)))] + 1)

Heh, you posted before me... Such stuff are sometimes hard to see but now this bug is solved.
 
Level 4
Joined
Feb 27, 2008
Messages
71
Hmm This time i get Kills but only 2 and so it stand on still

LeaderBoard
Events
Time - Elapsed game time is 0.01 seconds
Conditions
Actions
Leaderboard - Create a leaderboard for (All players) titled Kills
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Player((Integer A))) controller) Equal to User
((Player((Integer A))) slot status) Equal to Is playing
Then - Actions
Leaderboard - Add (Player((Integer A))) to (Last created leaderboard) with label (Name of (Player((Integer A)))) and value 0
Else - Actions
Leaderboard - Show (Last created leaderboard)


Kill update leaderboard
Events
Unit - A unit Dies
Conditions
((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
Actions
Set kills[(Player number of (Owner of (Killing unit)))] = kills[((Player number of (Owner of (Killing unit))) + 1)]
Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to kills[(Player number of (Owner of (Killing unit)))]
Leaderboard - Sort (Last created leaderboard) by Value in Descending order

is this right?
 
Status
Not open for further replies.
Top