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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

SaveGame not working?

My SaveGame won't work. I have my blueprint below. So I have a highscore variable, and if a player has a score greater than the highscore, the highscore gets set to that score. I have that blueprint running in user interface widget. So let's say that the player had a last score of 100, and the player gets a score of 110. Then the HighScore will get set to 110. However, the highscore is still 0. I know for a fact that the score isn't the problem because I used a print string and it outputted that the highscore is 0 and the score is 110. How would i fix this? Help is appreciated! Thanks! alt text

Product Version: UE 4.20
Tags:
capture.png (248.3 kB)
more ▼

asked Nov 20 '18 at 06:04 PM in Blueprint Scripting

avatar image

CODE REDBALLG
115 2 5 15

avatar image Dune Nov 21 '18 at 03:09 PM

Not 100% sure, but it looks like you are saving the SubClass variable that you set, as opposed to the casted one you change the high score of?

avatar image CODE REDBALLG Nov 21 '18 at 05:14 PM

When I save it, the save game object pin is connected to the sub class. What should I do from there?

avatar image SupDeity Nov 23 '18 at 08:19 AM

Give me a summary on where u are saving these things from, What are the variables and where are the variables saved. ill send u a project link then with a working copy :).

avatar image CODE REDBALLG Nov 23 '18 at 05:39 PM

So I am saving these variables from a user interface widget blueprint. I am trying to set a high score variable float, that is located in the save game, to a score float variable from my game mode. In my game, when the player gets a high score, it sends them to a user interface widget called Highscore, where they can type in their name. Once they press enter, their name and the highscore gets saved.

avatar image M.FatihSaglam Nov 24 '18 at 03:55 AM

Is this single player or multiplayer?

avatar image CODE REDBALLG Nov 24 '18 at 04:40 AM

single player

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

2 answers: sort voted first

This is working one. I tested it with PrintString.

Note that, first cast and promote to variable next. As you can see below, I casted to GameModeReal and promoted to variable 'GameModeReal'

Next, I casted the save file (loaded from slot) and promoted to 'SubClass' variable. So, 'SubClass' is not a SaveGameObject directly. It's a RealSaveGame class that is inherited subclass from SaveGame class.

And then, I compared if Score(GM) is bigger than HighScore(Save) or not. If Score(GM) is bigger, then set it to HighScore(Save) and Save the SubClass to slot as SaveGameObject.

alt text

test.png (213.9 kB)
more ▼

answered Nov 24 '18 at 10:22 AM

avatar image

M.FatihSaglam
133 4 7 9

avatar image SupDeity Nov 24 '18 at 02:32 PM

Promoting to Variable isnt really needed but this works.

avatar image CODE REDBALLG Nov 24 '18 at 06:26 PM

Ok I see how to do it now. Thank you so much! It works!

avatar image M.FatihSaglam Nov 24 '18 at 08:25 PM

I did it for maybe he would use later. I didn't know how he will use this because I didn't work on single player games so far. I would use Save/Load in PlayerController or GameInstance.

avatar image CODE REDBALLG Nov 26 '18 at 01:12 AM

So, I tried the code for a second time and now it doesn't work. It was working before but, why isn't it working now?

https://youtu.be/fzxWbEPuNB4

avatar image M.FatihSaglam Nov 26 '18 at 09:00 AM

Don't use cast in GameModeReal. When you CreateSaveGameObject, you already return it as SaveGameReal type. Delete unnecessary castings. The blueprint you show in video isn't same as mine. AND You are trying to print value from a newly created savefile which isn't saved to slot, in GameModeReal. The BP I sent you is taking HighScore value from GameaMode itself, not from newely created save object's score value.

avatar image CODE REDBALLG Nov 26 '18 at 04:03 PM

Ok, Thank you for telling me this. I will try this later in the day.

avatar image CODE REDBALLG Nov 27 '18 at 02:51 AM

Hello Ottoman. I have done what you have said to do and it doesn’t work still. I have decided to link my project right here, so you can actually download it and access my project. Please help my find this error together. Thank you so much for your help so far!

http://www.mediafire.com/file/5kv8j8c07nbxu5l/Carbonade.zip

avatar image M.FatihSaglam Nov 29 '18 at 06:24 AM

This is saving the last score I achieved to save slot if my last score is bigger than last saved highscore. https://www.mediafire.com/file/xebt2alqytrwukg/Content.rar/file

avatar image CODE REDBALLG Nov 29 '18 at 03:57 PM

Thank you. I will try this later in the day and give you updates.

avatar image CODE REDBALLG Nov 30 '18 at 05:22 AM

Hi Ottoman! Sorry if I am being rude but it is it ok if you send me back the uproject file because I am having trouble getting it in my game. This would be very much appreciated so I can test out the project that you edited. Also if you have a discord, can you message me at RedBall#5640 so we can keep in touch.

avatar image M.FatihSaglam Nov 30 '18 at 06:06 AM

I deleted rest of the project files because I don't have much free space in my disk. It is very easy to copy and paste the files under Content folder to where they should be, isn't it? I edited your files with 4.20.3 version of engine. If you have below v4.20.3, ofc you won't be able to open files in your engine.

avatar image CODE REDBALLG Nov 30 '18 at 03:57 PM

Ok. I will do this later in the upcoming day. Let you know what happens.

avatar image CODE REDBALLG Dec 01 '18 at 10:20 PM

Hi Ottoman! It works now! Thank you so much for your help! Before I resolve this question, I was wondering if you can explain to me what my error was. Thanks!

avatar image M.FatihSaglam Dec 02 '18 at 07:04 AM

I don't remember very well but; I deleted unnecessary save/loads from your files. I deleted unnecessary castings. You were saving newly created save object to save slot in GameMode. That was the main problem. Other similar problems were on GameMode or Controller or Pawn BP. I am not sure which one because there were too many unnecessary usings of Save/Load. And I deleted all of them. You need to save highscore from UI BP with checking if Score is greater than HighScore as I posted at first answer. For example you didn't check that IF anywhere on your blueprints.

avatar image CODE REDBALLG Dec 02 '18 at 07:26 AM

Ok Thanks so much!

avatar image M.FatihSaglam Dec 02 '18 at 10:17 PM

Glad I could help! Have fun with your project.

avatar image M.FatihSaglam Dec 08 '18 at 10:29 PM

You need to accept the answer btw :)

avatar image CODE REDBALLG Dec 09 '18 at 06:05 PM

Sorry my bad

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

I was with the same problem. I was generate a key for a spawnable object to avoid it to be spawned again when level is loading and awlays receive a false when trying to save.

The reason for that, for me is a '|' character that i was used to generate this key. I remove it and everthing is fine. So avoid special characters from the save slot name.

more ▼

answered May 03 '19 at 05:09 PM

avatar image

shark3ds
1 1

(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