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"

Highscore saving even when lower

alt text

The above blueprint is in the playerBP and fires once the actor dies. It "works" in that it saves the current score as highscore and the highscore is loaded on the next run.

It does not work however as even when current score is lower than high score it saves current score as high score.

I don't see what is wrong here as it should be checking that the current score is higher?

Please help!

Product Version: UE 4.8
Tags:
more ▼

asked Jul 24 '15 at 02:52 PM in Blueprint Scripting

avatar image

Mikachu_92
3 2 5

avatar image Mikachu_92 Jul 24 '15 at 06:28 PM

Yes - when you die and end the level it triggers.

So it would be better/right to create a savegame object at the start of the game opening (if no savegame exists) then simply cast to savehighscore each death?

avatar image Fanto88 Jul 25 '15 at 11:50 AM

Yes, you should create only one savegame at the begin of the game and then, every time the player dies, using the cast, you check if the score is greater than the score saved.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You fires that "script" every time the actor dies? Because every time the system will create a new SaveGameObject, so when you cast to saveHighScore i think it will be always the default value.

more ▼

answered Jul 24 '15 at 06:10 PM

avatar image

Fanto88
318 23 15 28

avatar image Narghile Jul 25 '15 at 01:40 PM

But I am with TAM. Why would the branch not stop it being written?

Narg

avatar image Fanto88 Jul 25 '15 at 01:47 PM

Because if you create a new save game object everytimes the "high score" value will be set to default value, and every time the new score will be higher than 0, so he will write that value.

avatar image Narghile Jul 25 '15 at 01:50 PM

Even with the branch? Good to know.

So if you make a Savefile the first time the games plays, you never make one again or do you create one every time the game loads?

Narg

avatar image Fanto88 Jul 25 '15 at 01:53 PM

You should just create one savegame file at the begin and then, when the game start, you control if the savegame already exists. You save the value of the savegame into a var, then during your game you use that var for a cast, and modify every value into the savegame, and when you want to save those changes you have to use the node called "savegame to slot".

I can create an example if you need

avatar image Narghile Jul 25 '15 at 01:57 PM

So when you load a second, third time etc, would you use a Is Valid to make sure you do not over right by mistake?

Sorry, have not done Save Game yet, and chugging Tam's post.

Narg

avatar image Fanto88 Jul 25 '15 at 02:04 PM

When you load your savegame through the "Load savegame from slot" you should set the var "savegame" with the value that this node return, and then yes, you can check if is valid, but should be if the savefile exist.

And when you have to modify a value you just pin out that var and use a cast

(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