HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Leaderboard problem

10-22-2003, 04:44 AM#1
arknick
I created a Leaderboard following 3DGuy's tutorial but it doesn't update. I keep going through it again and again but can't get it to work.

Below is what I have.


Leaderboard
Events
Time - Elapsed game time is 5.00 seconds
Conditions
Actions
Leaderboard - Create a leaderboard for (All players) titled Kills
Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Leaderboard - Add (Picked player) to (Last created leaderboard) with label (Name of (Picked player)) and value 0)
Leaderboard - Show (Last created leaderboard)

UpdateLeaderboard
Events
Unit - A unit owned by Player 1 (Red) Dies
Unit - A unit owned by Player 2 (Blue) Dies
Unit - Blah Blah
Conditions
(Owner of (Killing unit)) Not equal to (Owner of (Triggering unit))
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 Player in Ascending order


I tried finding the problem by using the following trigger:


Temp
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
For each (Integer A) from 1 to 12, do (Actions)
Loop - Actions
Set Temp = (Temp + (String(Kills[(Integer A)])))
Game - Display to (All players) the text: Temp
Set Temp = <Empty String>


But it still won't work. Please someone help. Sorry if it's something really stupid, but I went through it more than a dozen times. :(
10-22-2003, 04:49 AM#2
Shvegait
Where you have (Owner of (Triggering Unit)), I think you mean (Owner of (Dying Unit)).

My guess is that the game is interpreting that as (Owner of (Killing Unit)), which is never "Not Equal to" (Owner of (Killing Unit)).
10-22-2003, 05:01 AM#3
arknick
Thanks for the reply. I tried it and went on a killing spree but the scores don't update. Just lots of 0s.
10-22-2003, 05:30 AM#4
AllPainful
Don't use "Last Created Leaderboard" in your second (Updating) trigger... that can be the problem.

Instead, create a variable called leaderboard, and in the trigger you create the leaderboard, set the variable to the leaderboard. And then call that variable in the above trigger...
10-22-2003, 06:37 AM#5
arknick
I created a variable Leaderboard of type Leaderboard, but there is no option to set any variables in the "Leaderboard - Create" action.

I'm not sure if that's what you meant...

I tried changing "Last created leaderboard" to the variable I made. I done this for both triggers and it didn't work, I also tried it for only the update trigger but it didn't work.
10-22-2003, 09:45 AM#6
AllPainful
What I meant was, at the end of the trigger where you create the leaderboard do the action "Set Variable Leaderboard to leaderboard(last created leaderboard)" and then replace the "Lase Created leaderboard" thing in the updating trigger with the variable instead.

Wierd that its not working.

Here is an attached map from another post of mine that has a working leaderboard.... Check it out. You can find the board itself here.
10-23-2003, 01:51 AM#7
arknick
I got it working!

I used your method and it worked, but had to do one other thing.

I deleted the Kills variable and remade it. I think the problem was that when I first made the variable I forgot to check it as an array, but set it as one later and even set a size for the array of 12. When remaking it I made sure to set it as an array as it was created and it worked, that and I didn't bother setting a size for the array.

How awkward and tedious can a problem get. :rollseyes: I knew it was going to be something stupid like this. Sorry for wasting the time of everyone who helped.