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"

CreateSaveGameObject Question

I am creating a save game object as class name "Blueprint".and casting it to "Blueprint".

I then connect it to a SaveGameToSlot node with the save name "save"

How is this viewable inside "Blueprint"?

i.e. I want to store data inside this "Blueprint" but no object appears after the save event is called.

Product Version: UE 4.9
more ▼

asked Dec 11 '15 at 05:39 AM in Blueprint Scripting

avatar image

170 47 49 60

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

1 answer: sort voted first

So for example, lets save and load your health, you would start by creating a variable in the save game blueprint called something like "saved health" and then whenever your character dies, you would cast to your save game object and send your characters health variable to the save health variable, then on your characters begin play, you would load the save health from your save game blueprint and set it to your charavters health

more ▼

answered Dec 11 '15 at 01:33 PM

avatar image

57 1 3 6

avatar image nmm131 Dec 11 '15 at 03:52 PM

I can't cast my Struct (which holds my two variables) to savegame blueprint, "New Blueprint". It needs an object but struct cannot connect to object/interface.

alt text

Here is the whole blueprint, what am I doing wrong?

alt text

My "Saved Inventory" variable of type struct is inside my savegame blueprint (the whole savegame blueprint is empty besides that one variable) and it has the same inputs as "Inventory" inside the actor blueprint that properly gets values from the level blueprint thru event Store.

untitled.png (221.3 kB)
untitled1.png (294.6 kB)
avatar image behrtron Dec 11 '15 at 05:57 PM

When you load your game you have to again set the loaded game file to the save game object so it can be further used, im sorry if this isnt the question you were asking im having trouble understanding what your trying to accomplish In your case you will have to make another save game object refrence in your level blueprint and set the loaded save slot to that object

avatar image nmm131 Dec 11 '15 at 08:08 PM

I have this in my level bp to load a game alt text

My values that I want to save are being received and set to a struct, Inventory. Then in that bp that has SaveGame, LoadGame, and Store (store is receiving the struct), I am confused as to what to do with those values that are received, coming from event Store. My SaveGame does not occur because when I load a game, nothing happens. No stored values are brought out.

1.png (99.4 kB)
avatar image behrtron Dec 11 '15 at 08:21 PM

I would try to either,

  1. Instead of creating the save file in your other blueprint, drag off the false node in your level blueprint and create the save there.

And if that doesnt work i would also make sure that your saved variable is marked as public

avatar image nmm131 Dec 11 '15 at 09:14 PM

For my Inventory Struct there is a check box on the right hand side for SaveGame: "Should this variable be serialized for saved games?" Private remains unchecked.

When you say, "set the loaded game file to the save game object", does that mean I will have to cast to NewBlueprint for this node?:


How should I alter my blueprint then? alt text

If I want to save my game from the level blueprint, do I get the Inventory, plug it into SetInventory (which is in savegame blueprint, "New Blueprint") and then SaveGameToSlot?

1.png (87.4 kB)
2.png (265.8 kB)
avatar image nmm131 Dec 11 '15 at 09:15 PM

My SaveGameReference has a value of none: alt text

3.png (29.5 kB)
avatar image nmm131 Dec 11 '15 at 09:24 PM

I think my problem is Inventory isn't setting its two Int values CT and ST to be added to SavedInventory two Int values CT and ST

alt text

That's why I'm printing the values but the values keep remaining the same.

12.png (311.1 kB)
avatar image behrtron Dec 11 '15 at 11:01 PM

Once you have loaded the game you must set the save game object in your level blueprint exactly like you do when you create the save game, i also suggest clicking the eyeball next to your inventory variable in the same game blueprint, it marks the variable as "editable"

avatar image behrtron Dec 11 '15 at 11:06 PM

Also at the end of your create save game file in your level blueprint you forgot to put in a save game slot name

avatar image nmm131 Dec 12 '15 at 12:03 AM

I clicked the eye and wrote in the slot name. alt text

With most nodes already in the level blueprint can I delete my blueprint that holds the events SaveGame, LoadGame, and Store?

My only question is how I can get Inventory variables to keep adding to SavedInventory variables, and get SavedInventory variables so I can print them.

I printed from doesSaveGameExist->True && ->False and got different messages for each one, so I know my game is capable of CreateSaveGameObject and LoadGameFromSlot, along with SaveGameToSlot. Thank you for help with that!

1.png (152.4 kB)
avatar image behrtron Dec 12 '15 at 12:16 AM

Yes you should remove any saving and loading inside the save game variable, and only save things inside the blueprints you wish to have variables saved and loaded, how are things working did you get your variables to save and load? If not maybe you should right print strings that say "failed" in areas that you feel may be incorrect, it helps to diagnose where the problem happens

avatar image nmm131 Dec 12 '15 at 12:18 AM

I got everything just am unsure of how to get SavedInventory to stack (add) the values that Inventory keeps giving it every play and exit of the game --> wanting to print those.

avatar image behrtron Dec 12 '15 at 12:34 AM

Try dragging off the inventory variable and clicking "make struct" and do the same for savedinventory and click "break struct" and hook the nodes up when loading your game in the level blue print

avatar image nmm131 Dec 12 '15 at 12:40 AM

I can't access SavedInventory since it is only in savegame blueprint, "New Blueprint".

I only had SavedInvetory set because I got it from a CastToNewBlueprint node, where the LoadGameFromSlot had the return value for the object of the CastToNewBlueprint.

avatar image behrtron Dec 12 '15 at 12:49 AM

Yes so instead of setting it to inventory directly, pull off from the node set saved inventory and the option to break struct will be there and do the same for inventory

avatar image behrtron Dec 12 '15 at 12:38 AM

And if that doesnt work, trying using the "event level reset" event and saving your variables off it, it will save them everytime the map has to reload

avatar image nmm131 Dec 12 '15 at 12:58 AM

Well I have my two variables that I want to keep adding to the SavedInventory variables alt text

2.png (104.9 kB)
avatar image behrtron Dec 12 '15 at 01:02 AM

So now set those new variables to your inventory variable and when the inventory variable is set to savedinventory than it should be updated if im thinking of it correctly

avatar image nmm131 Dec 12 '15 at 01:09 AM

It is just returning 0's For CT and ST SavedInventory is set to editable

The values of CT and ST are printing when I am setting them to Inventory But when the game loads after I hit play, the CT and ST values print 0

avatar image behrtron Dec 12 '15 at 01:13 AM

Try renaming the save slot and starting with a new save file and then reloading, if that doesnt work if you want to send me an email with your project i could take a look at it

(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