I'm using the teleport node to teleport the player to another place. But it only works one way?

Hi. I’ve used the teleport node to use the doors in my game. It worked for the first door. But when I copy pasted the command to the second door and changed the value of that teleport node there, both of the doors now teleport me to the same area (aka just infront of the first door)

Screenshot (633)
Screenshot (634)

They are clearly different, but it always teleports me to the same area. It’s almost as if it’s using the same Dest Location values even though it’s not.

Would be a cool bug.

But before we call it that, can we see a bit more of the script. How is this triggered?

Here. It look like this.

They both basically look like this. (with different values on the teleport node, of course.)

So… if you place a Print String node after teleport, I bet it will not print - or will print only once even though you have many doors. Do tell.


This is not set up correctly. The Input is in the door blueprint? Is there a reason why the door is handling player input?

So… if you place a Print String node after teleport, I bet it will not print. Do tell.

I tested the Print String. It only prints the string of one of the doors. (Which makes me stuck on one room)

Is there a reason why the door is handling player input?

That’s the only thing I could think of that could make sense. If I just copy paste this command to every door and just change the dest location values it should work.

I see. It will not work this way. It’s not a problem with the teleport, it’s a logic issue.

The Input should be in the player and in the player only. It’s the player that interacts with the environment.

How would you like this to work, how do we know which door to interact with? The player looks at the door and presses the interact button?

The player looks at the door and presses the interact button?

Yep! then it teleports them to a different room.

  • create a BP interface in the content browser:

image

  • open it, add a function:

  • in the door blueprint:

and then, in the same door blueprint → right click the interface function and Implement Event:

  • in the player BP:


You can disable input in door actors. It’s the player’s job to look around, point at stuff and interact with everything.

To make the coordinates handling more managable:

Use a billboard to indicate the target location. So you can now place many doors in the editor and move (and rotate) their billboard to where you need that door to teleport:

Optional, but more visual this way - consider it. Punching in numbers is meh!


And if you were wondering why your setup wouldn’t work:

  • each actor had input
  • each actor tried to execute this input
  • but only one actor can execute input at a time (unless consumption is disabled - but then we’d be attempting to teleport through all doors at once!)
  • we do not know which actor will execute it, in your case it was the door that managed to use & consume input first
  • so you were trying to teleport to the very same door over and over again

Can I replace this

  • in the player BP:

…with something like pressing Q? Because I’m working with a 2d side scroller.

1 Like

Yup. Any input will do. You seem to have it set up:

image

I’d use this input but in the player BP, not in the door BP.

Do I still need to do the Line Trace By Channel? I thought I didn’t need it since it doesn’t need my mouse.

But at the same time, I couldn’t get a target reference for the USE DOOR.

You need to tell the engine which door you mean somehow. If this is for 2d, don’t use the camera, obviously. Use the character location.

You could give the player a sphere overlap instead. That would work, too.