edited May 2014 in ORK Support
Is something like a highscore possible through the event system?
I'm trying to experiment with collecting stuffs as fast as possible in a limited time limit, with every stuff I collect, my float variable score will go up by 1, showing up on a HUD. I got this part. I was just wondering if there's any way to do it so that it'll save my score afterward, and it will only be replace with every higher score.
Post edited by gamingislove on
  • You can use the PlayerPrefs steps to save/load the highscore - the PlayerPrefs are persistent between plays.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Ah, I kind of have a feeling I was suppose to use that.
    After trying so hard, I still can't XD
    I set up a quick test project to see if I can try to make a highscore. Basically, there is a blank screen and every second a red or blue cube will appear on the screen, and I have 1 second to click on the blue or red button that is showing on the screen, depending on the cube.
    Everytime I make a correct click, the float variable score will go up by one, and my HUD will show that. On my HUD, I put in the text code "Score:#varfloatscore#".

    If I failed to click on the button within the 1 second time limit, the node will than go to the set float playerprefabs and inside the node:
    PlayerPrefs Variable
    Value type : Value
    Value: score

    Float Value
    Value Type: Game Variable
    Variable Key: score

    And then I called the game over node. Is this the correct way to use the playerprefabs? And I'm not really sure how to make the float playerprefabs show up on the HUD, representing the highscore since I don't see any textcode for showing float playerprefabs.
  • The PlayerPrefs are only used to save a highscore between games, else it would be lost without a save game.

    To display the current highscore (and check it with the score of the player), use a 2nd game variable for the highscore.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I've manage to set up the current highscore using a 2nd variable as you mention. But I still can't seem to set it up with the playerprefs to save the score, so everytime I call the game over scene and hit play again, my highscore went back to 0. I'm getting there XD.
    I'm using the set float playerprefs node with
    PlayerPrefs Variable
    Value type : Value
    Value: scoreTracker

    Float Value
    Value Type: Game Variable
    Variable Key: highscore

    Since it won't work, I have no clue left.
  • edited May 2014
    I'll give it a try, probably a bug :)
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks! Hopefully it's a bug, so I can feel more relieve to know that it isn't my suckiness XD
  • edited May 2014
    It's working on my end, but could be that the player prefs aren't saved sometimes - I'll add an extra call to save them after setting them in the next update :)

    Edit: Can you give me some details on your settings to load the player prefs?
    To load the PlayerPrefs into a variable again, you simply set a game variable and use the value of a player pref.
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • An extra call to save them would be awesome(if needed, of course)
    Annnnnnnnnd I solve it, all thanks to you. I didn't know that I have to load the PlayerPrefs back into a variable again. I did that, and tadaa, got it to work. Thanks, GiL!
Sign In or Register to comment.