x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How can I get my highscore working?

I have a game with a save object that adds one and saves the score every second. This part is working perfectly, but the highscore isn't. I have it checking every frame (event tick) if the curent score saved is higher than the current saved highscore. If it is, it saves the highscore every frame to the value of the current score. What's happening is it always says the highscore is just whatever the player scored last turn.

Product Version: UE 4.12
Tags:
more ▼

asked Jul 31 '16 at 06:10 PM in Blueprint Scripting

avatar image

Im A Hefty Lad
6 1 3 6

avatar image Erasio Jul 31 '16 at 07:57 PM

Could we see some pictures?

That sounds like you're not properly saving your savegame object to me but it's hard to tell and there are a couple of things that could've gone wrong.

avatar image Im A Hefty Lad Aug 01 '16 at 02:06 AM

Here you go, I wasn't actually using a save game, instead it was a simplified marketplace plug in (easy save and load). alt text

capture.jpg (142.4 kB)
capture2.jpg (110.9 kB)
capture3.jpg (135.9 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

That code is driven by "Event Construct". This means when the widget is created it's run once and the highscore won't update afterwards unless you create it again.

Instead you could create a custom event which updates the Highscore of your widget and trigger it on event construct AND from an external source. Or just use Event Tick within that widget to check for the current highscore.

Anyway. You need to update the text value. Because as it seems the stored highscore variable is updated properly. Only the text display isn't!

more ▼

answered Aug 01 '16 at 10:53 AM

avatar image

Erasio
5.9k 291 86 293

avatar image Im A Hefty Lad Aug 02 '16 at 01:15 AM

I tried what you said (thank you for commenting) but it functioned exactly the same.

avatar image Erasio Aug 02 '16 at 10:32 AM

Are you sure you're using the plugin correctly?

I don't have access to it and have no idea how it works. But that is the most likely issue I see if you're properly updating the highscore value driven by event tick.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question