How to set a validation (in blueprint) after press the "E" key , for example, inside or outside an elevator?

There’s not a direct way to know / test if you’re inside or outside of a specific volume… however, you can trigger events as you cross into or out them. (Seems odd - I know). Anyways, these are called Overlap events. Couple different ways to skin this cat, but I’d start by adding a boolean variable on your character named something like “IsNearElevator” - dont forget to click the eye icon next to it to make it public (so other things can check its value). Compile.

Looks like you are working in the Level blueprint, so you could drop a box trigger the size of your elevator shaft right on the map. (You could also add a box component to the elevator actor itself). With the trigger selected, right click and add an On Begin Overlap event and an On End Overlap event. These can be used to set the value of IsNearElevator to either true or false. Then in the code you have above, get the player character node, pull a pin off and get the value of IsNearElevator and feed into those branches you have setup already so the elevators play when that boolean is true.

If you’re going to have multiple elevators, you may also want to store a variable for the last elevator your guy got in so you’ll know which elevator to Play on.

OK - here’s a simplified version with the variable IsNearElevator stored right in the Level blueprint instead of in the character to keep things simple. Drop a simple Box Trigger on the map (4th item in the Basic actors list) and resize that to fit where the elevator is sitting. Use the two overlap events I mentioned above to fire when the player is either walking into or walking out of the elevator.

To make these, first make sure the trigger box is selected on the map - then right click - and look under the Add Events for Trigger Box 1, open the Collision dropdown, and choose Add On Actor Begin Overlap to start coding the top section in my picture. (Look near yellow arrow if you cant find this).

Test to make sure that the actor that overlapped the trigger is actually the player. And yes… in 4.6, just right-click and type “Get Player Character” and this will get you a node to reference to your player character. See if that == the “other actor” in a branch before setting the value of the boolean to true. Do the same thing for an End Overlap event which sets the boolean back to false.

Now you can feed that bool into your branches when you hit the floor buttons. And your elevators will only change floors when the player is inside them.

http://s11.postimg.org/uqltbcrvn/elevator.jpg

How to set a validation (in blueprint) after press the “E” key , for example, inside or outside an elevator ?

I need this because i created one basic system elevator. This works very simple: The player enter the elevator area, and press “1” or “2” , to choose your floor. (A pleasent female voice answer what floor…lol)

Until there, just fine. But, when i press “1” ou “2” in OUTSIDE of elevator, the elevator works too, and its BAD.

Question: How to set a validation (in blueprint) after press the “E” (or 1,2) key , for example, inside or outside an elevator , to avoid the elevator up “alone” , with no one inside ?

Any sugestions are welcome!

See in the attachment blueprint my progress so far…

Again, any help are welcome. Any try.

Here my WIP on youtube of Elevator System so far…

Elevator System

Tks for the reply

But, i´m not sucess in your sugestion…something´s go wrong and nothing happen…do you perhaps give an example in blueprint? And what you mean with " get player character node" ? That not exists in my version of UE4 (4.6), and that player i´m using is a Mixammo character Blueprint selected in my game mode Blueprint…

Tks for the reply.

But, for some reason, the connection to EQUAL (enum) is not possible…I tried too many differente combinations. See the printscreen with error log:

Tks for the reply.

But, for some reason, the connection to EQUAL (enum) is not possible…I tried too many differente combinations. See the printscreen with error log:

OMG, i have forget to put other actor to enum (equal), now it´s WORKS ! TKS very much 1l2Hawk , for your time and dedication! Tks alot !

Now i try to fix “the other side” of elevator (1st floor to Ground Floor) but i figure out is the same way, only just reversing things… :slight_smile:

Again, Thanks alot and Merry Xmas !