Store the score and preload it at next game

Septimus

New Member
Reaction score
58
Save/Load Highest Score

I currently trying to make the leaderboard to show the highest score.

For example, if the player play the game and earn the score of 500 at easy difficulty. The score would be saved and would be display at leaderboard if the score was the highest score at easy mode such as this sample below.

Top Score

Easy - 500
Normal - 234
Hard - 118

So far I already make the leaderboard, but I am not sure which trigger could be use for saving the highest score.
 

CaptDeath

New Member
Reaction score
103
just use if thens and interger comps
like


if Value A > Value B
then Set HighestScore=a string
if vaule A > Value C
then Set Highest Score = Value A




repeat for values B and C




then for writing its name


if highest score = Value A
then set string(prefix)=Easy
or else
if highest score = Value B
then set string(prefix)=Normal
or else
if highest score = Value C
then set string(prefix)=Hard
or else
 

Dinowc

don't expect anything, prepare for everything
Reaction score
223
CaptDeath that's not a very good method..

you could make an array integer variable, each array index representing player number

like this:

set PlayerScore[1] = (Player 1's score)
set PlayerScore[2] = (Player 2s score)
set PlayerScore[3] = (Player 3's score)
set PlayerScore[n] = (Player n's score)

and then in action:

Code:
for each (Integer A) from 1 to 12
    Loop
     if then else
       if HighestScore less than PlayerScore[Integer A]
       then
          set HighestScore = PlayerScore[Integer A]
          set ArrayValue = (Integer A)
       else

and the winner would be Player[ArrayValue]

hope it helped
 

CaptDeath

New Member
Reaction score
103
dinowc the problem with what you posted wont get which one of a players values is the highest casue easy/normal arent players there difficlutys
 

Septimus

New Member
Reaction score
58
Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        Difficulty Equal to 1
    Then - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Scores Greater than High_Score[1]
            Then - Actions
                Set High_Score[1] = Scores
                Game Cache - Store High_Score[1] as HighScore1 of HighScore in (Last created game cache)
            Else - Actions
    Else - Actions

I try to set it to saves the scores shall the score higher than the high score. But, when i restart the game. The high score doesn't seems to be store into it.
 

Azlier

Old World Ghost
Reaction score
461
Well, give us more information! Is this a multiplayer map? Is it in a campaign? Just a normal single player map?
 

Azlier

Old World Ghost
Reaction score
461
Huh. I don't know if game cache extends to them. *calls in for a game cache expert, looking worried*
 

Septimus

New Member
Reaction score
58
I try to make the highest score to be saved.

For example, if the user play the game and earn a score of 347 and the score was the highest. The score would be saved and be show at the leaderboard shall he play the game again.
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
Yup, use a game cache

How?
Create it,
Set a game cache variable to last created game cache
Save the score in it
Save the cache

In another trigger, for the next time you play
Create a game cahe (with the same filename than the previous)
Set Score = Load Integer blah
 

Azlier

Old World Ghost
Reaction score
461
O, you blind guides! He is using game cache!

From the first post:

Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Difficulty Equal to 1
    • Then - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Scores Greater than High_Score[1]
        • Then - Actions
          • Set High_Score[1] = Scores
          • Game Cache - Store High_Score[1] as HighScore1 of HighScore in (Last created game cache)
        • Else - Actions
    • Else - Actions
 

Septimus

New Member
Reaction score
58
bob, I already do that and you can see it from this leaderboard.

Trigger:
  • Leaderboard
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Leaderboard - Create a leaderboard for (All players) titled Top Scores
      • Leaderboard - Add Player 1 (Red) to (Last created leaderboard) with label Easy and value 0
      • Leaderboard - Add Player 2 (Blue) to (Last created leaderboard) with label Normal and value 0
      • Leaderboard - Add Player 3 (Teal) to (Last created leaderboard) with label Hard and value 0
      • Leaderboard - Add Player 4 (Purple) to (Last created leaderboard) with label Hardcore and value 0
      • Leaderboard - Add Player 5 (Yellow) to (Last created leaderboard) with label Speedy Clicker and value 0
      • Leaderboard - Change the color of the label for Player 1 (Red) in (Last created leaderboard) to (0.00%, 0.00%, 100.00%) with 0.00% transparency
      • Leaderboard - Change the color of the value for Player 1 (Red) in (Last created leaderboard) to (0.00%, 0.00%, 100.00%) with 0.00% transparency
      • Leaderboard - Change the color of the label for Player 2 (Blue) in (Last created leaderboard) to (0.00%, 100.00%, 0.00%) with 0.00% transparency
      • Leaderboard - Change the color of the value for Player 2 (Blue) in (Last created leaderboard) to (0.00%, 100.00%, 0.00%) with 0.00% transparency
      • Leaderboard - Change the color of the label for Player 3 (Teal) in (Last created leaderboard) to (100.00%, 100.00%, 0.00%) with 0.00% transparency
      • Leaderboard - Change the color of the value for Player 3 (Teal) in (Last created leaderboard) to (100.00%, 100.00%, 0.00%) with 0.00% transparency
      • Leaderboard - Change the color of the label for Player 4 (Purple) in (Last created leaderboard) to (100.00%, 0.00%, 0.00%) with 0.00% transparency
      • Leaderboard - Change the color of the value for Player 4 (Purple) in (Last created leaderboard) to (100.00%, 0.00%, 0.00%) with 0.00% transparency
      • Leaderboard - Change the color of the label for Player 5 (Yellow) in (Last created leaderboard) to (100.00%, 0.00%, 100.00%) with 0.00% transparency
      • Leaderboard - Change the color of the value for Player 5 (Yellow) in (Last created leaderboard) to (100.00%, 0.00%, 100.00%) with 0.00% transparency
      • Leaderboard - Change the value for Player 1 (Red) in (Last created leaderboard) to (Load HighScore1 of HighScore from (Last created game cache))
      • Leaderboard - Change the value for Player 2 (Blue) in (Last created leaderboard) to (Load HighScore2 of HighScore from (Last created game cache))
      • Leaderboard - Change the value for Player 3 (Teal) in (Last created leaderboard) to (Load HighScore3 of HighScore from (Last created game cache))
      • Leaderboard - Change the value for Player 4 (Purple) in (Last created leaderboard) to (Load HighScore4 of HighScore from (Last created game cache))
      • Leaderboard - Change the value for Player 5 (Yellow) in (Last created leaderboard) to (Load HighScore5 of HighScore from (Last created game cache))
      • Leaderboard - Sort (Last created leaderboard) by Player in Ascending order
      • Leaderboard - Show (Last created leaderboard)
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
No you didnt, you keep using Last created game cache

You have to set it to a variable

And did you even create a game cache first?
 

Septimus

New Member
Reaction score
58
This is the area where i store it.

Trigger:
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game Cache - Create a game cache from Click To Kill.w3v
      • Set Score_Cache = (Last created game cache)
      • Visibility - Disable black mask
      • Visibility - Disable fog of war
      • Unit - Change color of Rifleman 0023 <gen> to Red
      • Set Point[1] = (Center of Start <gen>)
      • Set Point[2] = (Center of End <gen>)
      • Quest - Create a Optional quest titled Credit with the description Loading Screen & Pr..., using icon path ReplaceableTextures\CommandButtons\BTNSorceressMaster.blp
      • Quest - Create a Optional quest titled Version with the description Version 1.01 -Ad..., using icon path ReplaceableTextures\CommandButtons\BTNSpellBookBLS.blp
      • Quest - Create a Optional quest titled Contact & Info with the description E-mail - Alexis_Sep..., using icon path ReplaceableTextures\CommandButtons\BTNSorceressAdept.blp
      • Set Hint[1] = You will lose 1 lives if a Acolyte is killed.
      • Set Hint[2] = Naga Myrmidon will grant you additional five lives if it is killed.
      • Set Hint[3] = If a Wisp is killed, every Orc will be killed as well.
      • Set Hint[4] = You will lose 3 lives if a Ghoul is killed.
      • Set Hint[5] = You will lose 5 lives if a Abomination is killed.
      • Set Hint[6] = Once your scores exceed 300, the difficulty would increase.
      • Set Hint[7] = Once your scores exceed 500, a Blademaster would arrive. Do not worry, he only spawn once.
      • Set Hint[8] = Kill Orc hero would give you 10 scores.
      • Set Hint[9] = Kill Human unit would resulted into score deduction.
      • Set Hint[10] = If your score goes below 300, the difficulty would be back to normal as long as you do not achieve 700 scores and above.
      • Set Hint[11] = Raider and Fel Orc Raider are the hardest to kill.
      • Set Hint[12] = Chaos Orc are harder to kill, but they give additional 1 point.
      • Set Hint[13] = If your score exceed 700, weaker orc unit such as peon would no longer be available.
      • Set Hint[14] = If your score exceed 700, unit would respawn much quicker.
      • Set Hint[15] = If your score exceed 700, the only undead unit that would appear is Abomination.
      • Set Hint[16] = You will lose 3 points if a Peasant is killed
      • Set Hint[17] = You will lose 7 points if a Footman is killed
      • Set Hint[18] = You will lose 15 points if a Knight is killed
      • Set Hint[19] = If your score exceed 900, the only orc unit available would be Raider and Fel Orc Raider.
      • Set Hint[20] = In order to reach Impossible stage, you must rake a score of 1,500.
      • Set Hint[21] = The only Orc unit available at Impossible stage is Drak'thul.
      • Set Hint[22] = At Impossible Stage, killing a human or undead unit could resulted into heavy loss.
      • Set Hint[23] = Wisp and Naga Myrmidon are not available at Impossible stage.


I change last created to game cache instead.

Trigger:
  • Leaderboard
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Leaderboard - Create a leaderboard for (All players) titled Top Scores
      • Leaderboard - Add Player 1 (Red) to (Last created leaderboard) with label Easy and value 0
      • Leaderboard - Add Player 2 (Blue) to (Last created leaderboard) with label Normal and value 0
      • Leaderboard - Add Player 3 (Teal) to (Last created leaderboard) with label Hard and value 0
      • Leaderboard - Add Player 4 (Purple) to (Last created leaderboard) with label Hardcore and value 0
      • Leaderboard - Add Player 5 (Yellow) to (Last created leaderboard) with label Speedy Clicker and value 0
      • Leaderboard - Change the color of the label for Player 1 (Red) in (Last created leaderboard) to (0.00%, 0.00%, 100.00%) with 0.00% transparency
      • Leaderboard - Change the color of the value for Player 1 (Red) in (Last created leaderboard) to (0.00%, 0.00%, 100.00%) with 0.00% transparency
      • Leaderboard - Change the color of the label for Player 2 (Blue) in (Last created leaderboard) to (0.00%, 100.00%, 0.00%) with 0.00% transparency
      • Leaderboard - Change the color of the value for Player 2 (Blue) in (Last created leaderboard) to (0.00%, 100.00%, 0.00%) with 0.00% transparency
      • Leaderboard - Change the color of the label for Player 3 (Teal) in (Last created leaderboard) to (100.00%, 100.00%, 0.00%) with 0.00% transparency
      • Leaderboard - Change the color of the value for Player 3 (Teal) in (Last created leaderboard) to (100.00%, 100.00%, 0.00%) with 0.00% transparency
      • Leaderboard - Change the color of the label for Player 4 (Purple) in (Last created leaderboard) to (100.00%, 0.00%, 0.00%) with 0.00% transparency
      • Leaderboard - Change the color of the value for Player 4 (Purple) in (Last created leaderboard) to (100.00%, 0.00%, 0.00%) with 0.00% transparency
      • Leaderboard - Change the color of the label for Player 5 (Yellow) in (Last created leaderboard) to (100.00%, 0.00%, 100.00%) with 0.00% transparency
      • Leaderboard - Change the color of the value for Player 5 (Yellow) in (Last created leaderboard) to (100.00%, 0.00%, 100.00%) with 0.00% transparency
      • Leaderboard - Change the value for Player 1 (Red) in (Last created leaderboard) to (Load HighScore1 of HighScore from Score_Cache)
      • Leaderboard - Change the value for Player 2 (Blue) in (Last created leaderboard) to (Load HighScore2 of HighScore from Score_Cache)
      • Leaderboard - Change the value for Player 3 (Teal) in (Last created leaderboard) to (Load HighScore3 of HighScore from Score_Cache)
      • Leaderboard - Change the value for Player 4 (Purple) in (Last created leaderboard) to (Load HighScore4 of HighScore from Score_Cache)
      • Leaderboard - Change the value for Player 5 (Yellow) in (Last created leaderboard) to (Load HighScore5 of HighScore from Score_Cache)
      • Leaderboard - Sort (Last created leaderboard) by Player in Ascending order
      • Leaderboard - Show (Last created leaderboard)


Trigger:
  • Game End
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Lives Equal to 0
        • Then - Actions
          • Trigger - Turn off Reach End <gen>
          • Trigger - Turn off (This trigger)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Difficulty Equal to 1
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Scores Greater than High_Score[1]
                • Then - Actions
                  • Set High_Score[1] = Scores
                  • Game Cache - Store High_Score[1] as HighScore1 of HighScore in Score_Cache
                • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Difficulty Equal to 2
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Scores Greater than High_Score[2]
                • Then - Actions
                  • Set High_Score[2] = Scores
                  • Game Cache - Store High_Score[2] as HighScore2 of HighScore in Score_Cache
                • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Difficulty Equal to 3
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Scores Greater than High_Score[3]
                • Then - Actions
                  • Set High_Score[3] = Scores
                  • Game Cache - Store High_Score[3] as HighScore3 of HighScore in Score_Cache
                • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Difficulty Equal to 4
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Scores Greater than High_Score[4]
                • Then - Actions
                  • Set High_Score[4] = Scores
                  • Game Cache - Store High_Score[4] as HighScore4 of HighScore in Score_Cache
                • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Difficulty Equal to 5
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Scores Greater than High_Score[5]
                • Then - Actions
                  • Set High_Score[5] = Scores
                  • Game Cache - Store High_Score[5] as HighScore5 of HighScore in Score_Cache
                • Else - Actions
            • Else - Actions
          • Game Cache - Save Score_Cache
          • Cinematic - Turn cinematic mode On for (All players)
          • Cinematic - Fade out over 2.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
          • Wait 4.00 seconds
          • Game - Defeat Player 1 (Red) with the message: (Defeat with + ((String(Scores)) + scores.))
        • Else - Actions


I am not familiar with game cache since this was the first time I ever use it.
 

CaptDeath

New Member
Reaction score
103
on the gamecache creation
have like a if then
if there is a game cache copy it or load or w/e
if there isnt one create it
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
"Create Game Cache" automatically does that, I believe.

The only thing I can see to do is remove the spaces from the file name
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top