Save player location and teleport back to that location

Hello,

I’m trying to figure out how to setup the following:

I’m on a ledge, I press E(double tap or single for now) now my character’s position is saved after pressing E.

I fall off the ledge, or go somewhere in the map, press another input(double tap F or single for now) and then my character teleports back to where I saved with E.

Any pointers or directions would be lovely!

Hi man ,
You can store your location in a variable vector type.
Add this vector call it “OLDlocation”.
When you pressed “E” set the OLDlocation with your location with the node “get actor location.”
When you press “F” set your actor world location to your OldLocation.

To use the key press you have to enable the input on that actor.
If you are using a pawn you need to possess it.

Hello, thank you for the reply, I manged to get it working with the following image:

However, as you can see with the last set of code, is that when I press E, it is destroying everything including the one I just spawned. I’m wanting to destroy all in the world/map but the one I just spawned, any ideas?

First, if you have just one checkpoint. there is no purpose in using an array .
You should just relocate your checkpoint. instead of spawning it

If you want more than one check point , and your question is how i keep the last i used.
Since we dont know in wich way the get all actor of class order the checkpoint.
You could just get their location first, check wich one is the nearest, and kill all but that.

However i suggest you to keep just 1 checkpoint spawned, or just use a variable in your char. to store the checkpoint location.

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.