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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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