HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Gold Leader Board Question

03-08-2003, 08:35 AM#1
silvery2k
In my map you have 25 minutes and you try to be on the team with the most gold. How do I make a leader board that will track gold and end the game aetr 25 minutes to declare a winner.
03-08-2003, 08:59 AM#2
Guest
Just set up an integer array (called GoldAmount[index]) for every player that reflects the amount of gold they have. Use this to update the leaderboard every 2 seconds. This would be something like:

Every 2 Seconds

set GoldAmount[1] = Get Gold Amount Player(1)
set GoldAmount[2] = Get Gold Amount Player(2)
set GoldAmount[3] = Get Gold Amount Player(3)
set GoldAmount[4] = Get Gold Amount Player(4)
...

Update Leaderboard value for Player(1) with GoldAmount[1]
Update Leaderboard value for Player(1) with GoldAmount[2]
Update Leaderboard value for Player(1) with GoldAmount[3]
Update Leaderboard value for Player(1) with GoldAmount[4]
...

Then create another trigger with an event elapsed time of 25 minutes that checks the values of all these integers. You'll need an integer variable called HasMostGold. Example:

Set HasMostGold = 1

For each integer A from 1 to 12, do
if GoldAmount[integerA] > GoldAmount[HasMostGold] then
set HasMostGold = integerA
else do nothing

For each player in player group (all players), do
if HasMostGold = GetPlayerNumber(picked player) then
Run Victory for picked player
else
Run Defeat for picked player

The only problem with this trigger is if two or more players TIE, it will return the LAST unit. So if 12 and 1 tie, then 1 loses and 12 wins.

To solve that situation is a little more tricky and I would prefer solving it in Custom Text to make my life way easier. The best way to avoid it is to just make it hard for people to have the same gold amounts. (i.e. make sure scores aren't 300, 400, 500, but 232, 367, 845)
03-10-2003, 11:09 PM#3
silvery2k
Thanks but how do i make it so all of the teams gold is together?
03-10-2003, 11:58 PM#4
Guest
Easy. Just have two more vars for team gold in the periodic event trigger. Example:

Set T1_Gold = 0
Set T2_Gold = 0

For each integer A, from 1 to 6, set T1_Gold = T1_Gold + Get Gold Amount Player(A)

For each integer A, from 7 to 12, set T2_Gold = T1_Gold + Get Gold Amount Player(A)

Then just update the leaderboard with Team Gold amounts. What I do for this is create a label/value in the leaderboard for Nuetral Victim and Nuetral Passive. Then Rename the Label T1 Gold and T2 Gold. You would the update the values for Passive and Victim to reflect the Team_Gold situation.
03-11-2003, 01:04 AM#5
STURMguy22
this is really off topic but i just had a retarded moment. When i was looking through the threads i saw this and it said gold leader board. All i looked at was the Gold Leader. I was like why the hell is this dude askin a star wars question on this board.....

Then i proceeded to stab myself in the head with a fork when i realised what u were talkin about (not really)

srry bout that, jus kinda thought it ws funny