Download

How i can teleport in another world and come back in the place where I was

I am a new user UE4. It will looks like Fable 3, when I press ESC I teleport to shelter. And when I press ESC again, i come back in same place where I was. How I can to do that.

How about this:

Press T once and you teleport to the shelter. Press T again and you are back to the location you were before teleporting. Press T again and …

PS: to use the ESC key, you need to change the binding in the Editor Preferences.

Thank you!

Thank you for help:)

I’am sorry for the stupid question, but where I need to create “shelter location-vector”? In BP level shelter, or in the BP my character? And how I can set this value?
And really thanks for the help!

do it in your character blueprint, and do it just the way he showed in the script, youre simply saving the starting location of your character from the “getactorlocation” node to call up that location at a later time

Hello,
you have to store the value of the variable in the gameinstance. So it will be available if you want to change level you called world.

It’s just like burntbyhellfire said, the main point to retain is to save the current location so you can use it later.

As for the shelter location-vector, it all depends on your game structure. There are too many ways to do it. So here is an example:

  • Create an actor consisting of only a billboard to visually pinpoint the teleport destination (BP_TeleportTarget);

1.jpg

  • drag this actor to where you want the player to be teleported to;

  • if you want to set the teleport system in your player BP, then at the begin play event, use “Get all actors of class” to get the location of that actor:

2.png

PS: in this example, I called *TeleportDestination *and not shelterlocation. I also assumed that there is only one teleport destination.