Save player position.

Hello. I would like to know how can I save player position in order to spawn him in the right place when he continues playing after a saved game.

Hello,
Have you seen this question ?

How can I add a savegame or specific variables? - Editor Scripting - Unreal Engine Forums

YEa, but I can’t figure out how to save players vector.

  • Create savegame class blueprint type
  • players location are stored as transform type(combination of location ,rotation and scale), so make a transform variable in you savegame blueprint
  • Add an instance of your savegame subclass to the blueprint in which you want to save data.
  • set the values you need to save in the savegane variable (in your case it’s player transform ,and you can get that by using get player pawn/character function ,then drag another node and choose get actor transform and set it to the savegame variable) and pass that to the Save Game to Slot node

I have created the savegame blueprint and inside, the transform variable. What is a savegame subclass?

Can you post an image of a blueprint?. Thanks a lot!

Here is my blueprint. I want to make the playerstart move to a desired position when the level starts. (or when a level is load) to keep track of where eas the player when the game was saved.

I have no idea why the player doesn’y move at all.

savegame subclass is your new savegame blueprint class.

you need to make a variable of the new type.

I’m making one right now I’ll share it

Here’s is how to do so (NOT TESTED)

In the new Savegame blueprint

In blueprint which you want to save data

You are not setting the player transform to your save game variable (settings in your blueprint),

Here is how to solve this:

drag a node from settings variable and choose set player transform,

target pin is settings

transform pin is you transform

drag another node from settings and choose save game to slot

This should work. Why is failing?

SOLVED. SEEMS to return true. :slight_smile:

It should work,

you are not executing the last set node (set test)

EDIT:don’t forget to mark an answer to close the thread :slight_smile:

I made a tutorial which make it more clear and simple process to save and load, I hope it reply all your questions about that matter :

https://www.youtube.com/watch?v=6l7uynUwm5M

Why are the image links dead?

I updated the image :slight_smile:

Thank you sir!By the way i am just watching your tutorial.may i ask a question?
when you have successfully created your save file do you need anything more than just the “Load game from slot” command to load it?
I have a setup like this. If player is overlapping checkpoint create a save game.
If player is dead and the save game exists then " Load game from slot".
Do you have any idea why it is not loading?


Thank you!!
EDIT: on second thought i must load my level and then set the spawning coordinates to my “Player start” volume so my player can start from there.Any directions on how to achieve this? :slight_smile:

The node (Load Value From Slot) should be followed by some procedurals to use the value you have loaded. I can see now it is the end of the graph in your screen shot. So you need to cast the value after loading it & then use the value.

Similar to the video posted above by mamoniem, we’ve create a tutorial video on the subject. However our tutorial is completely specialised on the subject of player location saving, including things like making sure to not save player location whilst the player is in mid air, only saving once the player has landed on solid ground.

https://www.youtube.com/watch?v=i-OJW1fZd4E