Want to save last jump position and use it in respawning

On Jump function that already exists in the in the character blueprint , I try to save the position when it jumps. but I don’t know how to call it? The second image is of BP of trigger box of water and I want call it there so when my character collide with water it respawns on the location from it just jumped on water

Hey @SD_Gamer45!

What I would suggest is on beginplay, start a “SetTimerByEvent”, and set that to something like 5 seconds, looping.

For the event, have it do a line trace down, (so start would be current character location, end would be location then -100 on the Z axis for the end) and on a hit, Get actor’s current location and save it into a variable. Then when you respawn, you can reference that location as the place to spawn! :slight_smile:
Hope that helps, let us know if we can help walk you through any part of that!

If you wont mind can you demonstrate this with Blueprint as I am beginner so it would be grate for me and ThankU

Sure thing! Here’s most of it, you’ll have to work out your respawn code elsewhere, but this will be the way to set it. We’ll put a “Set Timer By Function Name” node on begin play, looping every 5 seconds- so every five seconds, if your player is on the ground, it will set this location as the respawn point. (to turn off the red line, set draw debug type to “None” on the Line Trace by Channel)

Add to beginplay:

Add a new function called F_SetRespawnPoint (preface your functions with F_ for quick searching!)

And set up the function itself:

Let us know how it goes! :slight_smile:

1 Like

Thank you, brother, so much. I appreciate it. I will definitely try it, but now I am using this code by 3DRaven.