The save system is set up so that it works from BP_CharacterBase, this makes it easier to save the inventory and other character related stats. All data gets sent to BP_Save, then when the character is spawned, it reads the data from there and sets the variables.
See how money is being saved as reference for saving and loading “normal” variables.
Weapons are saved automatically, you don’t need to make any changes to any Blueprint in order to save the weapons you made, just create a weapon, pick it up, save, done.
Enemies and other world objects do not get saved, as they aren’t part of the Character or its inventory.
In this tutorial we will save the players location and restore it when the player spawns, to begin, create a new variable (vector) inside BP_Save
Then open BP_CharacterBase and open the SaveGame function and set the actors location to be the saved location vector we made in BP_Save
Last, still in the character, on begin play, set the location to be the saved location and check the teleport checkbox
…and that’s it, the save system now has the player location too. You can repeat the entire process for rotation as well if you want.
Basically the idea is to send the data from BP_CharacterBase to BP_Save, then bring it back during loading.
TIP: when working with save data, it’s good to delete the save file after each change and start a new game, to avoid unexpected behavior.
EDIT: somebody contacted me on Facebook (of all places XD) and asked how to save and load the last played level too, so I thought I’ll update it here in case somebody else needs this info.
UPDATE: This part is now integrated by default, you no longer need to do the level name stuff bellow.
In BP_Save create a new variable (string) like this:
In the SaveGame function in BP_CharacterBase add this (you can keep the location and other variables, this is just from a blank example):
And in the widget W_SaveMainMenu add this (“Testing” being the first level where the game actually starts when a new game is started):