Using editable variables?

I am trying to develop this method of door teleporting through the use of booleans and waypoints. The game consists of heading to doors that will lead to different places in different conditions.

What I do is:
-check if the player is outside,

-then if so I get all actors of class of my waypoints in the level,

-each one of them have a position editable int and an arrow

  • I added one in each side of the doors and their “Position” numbers.

  • Then, I will check if the number of the waypoint is equal to a certain one (e.g. inside of kitchen)

  • If true, get all actors of class of doors where each one has a door number Int

  • If it’s equal to that door number, it will teleport to the waypoint whose “Position” variable it found by getting the location of the waypoint and also the rotation of the arrow and where it’s faced.

  • There is a problem which is it sends me to the last waypoint number it exists, not the waypoint position variable I get.

  • List item

Am I missing anything regarding get all actors of class?

I might be wrong, but I thought when it gets to the waypoint of my choice, it would also get it’s position.

You could post your blueprints so we can check if you do something wrong.

Also i think it would be better if you would use object varables insted of intigiers, i would let you skip whole finding all actors of class stuff. IF you use object varable and place object on the level in details tab in object varables you can pick diffrent actors on the level.

Also after the teleport, if I try to do a simple cast to character and set a variable from it, it simply doesn’t work, I’ve tried to print string but the code doesn’t go past the cast to character for some reason :/. Also thank you very much for trying to help!

Update :

Tried doing a line trace to all the waypoints and if the 1st result that got hit was equal to the actor of the variable that this specific blueprint is referencing in the editor whose trigger I am overlapping then it would teleport me there. It seems this option also doesn’t work :confused:

That means it gets wrong object with wrong class then one you trying to cast to, or it gets none/null which makes cast automaticly fail. Put breakpoin on cast node and debug, when break gonna be triggered hover over, object input pin and see what object is going to cast node

Thank you very much for the help! :smiley:

Thanks to this video:

I found what I’m looking for. (Around 42:25 of the video he explains how to do it)

What you need for something like this is called Blueprint Interfaces.

If you place the blueprint interface in you character (the event) you will then be able to acess it elsewhere, and by using variables of the type of you blueprints (My target point, for example) you create a input in the blueprint interface with the type of your target point so you can get it’s position.

If you don’t understand how to do this have a look at the video or ask me, it sure clarified what I have been looking for a long time :smiley:

You don’t need interface for that, all you need is cast to object that has that function, it’s a common misunderstanding in blueprint-only UE4 community. Role of interface is not to communicate with diffrent blueprint (as i said it not needed for communication) but to relate unrealated classes with common function, for example Pawn and GameMode has a common function, you can tie them with interface and treat it as a common type.

Thank you very much for the explanation! :smiley: