How to open door by holding down 'E'?

First off, I am a complete beginner (started a few days ago) and I just wanted to post this out there if anyone else is looking for a door or example of how you can hold down a keyboard button to do something instead of just pressing a keyboard button. Also, if someone already posted an example or if I’m not posting this in the right place, I’m sorry.
The door opens and closes normally (for the most part) when I press ‘E’, but I want it to open slightly ( value = 50 ) when I hold down ‘E’ for a few seconds (I put down 1 second).

Last thing, this doesn’t work every single time you hold down ‘E’, you’ll see what I mean when you test it out…it’s just a head start and I would appreciate some advice on how to make it better / fix it, thanks!

I don’t really understand, is this a question how to fix your bugs?

Yes, I apologize for being unclear, I just was unsure of how to best explain it.


I’m not sure that it’s optimal, but it works.

Press “E” - the door will open 90 degrees. You can close the door only when you Press “E”.

Hold down “E” - the door opens at 50 degrees. You can close the door only when you Hold down “E”.

You’re trying distinguish between a quick press and a hold.

Try using the code seen here:

Also, I would avoid using copies of Event Tick.
If you really need Event Tick to do a bunch of things, stick a Sequence after the original event tick send the sequence nodes to whatever you want executed.

I’m trying to test out your code but I don’t know how to add the “Open 90 Event” node all the way on the top right, same as with the Open 50. I also don’t know how to create the “Open_90 Collision Event” and same with the Open_50 Collision Event, that’s all the way on the bottom left.
I tried to make a custom event but that didn’t work and I tried to search for Open but the target was “Menu Anchor” and not the DoorBP. Thank you for making the code less clunky than mine was :slight_smile:

Okay cool, I’ll check that out in more detail but it looks pretty complicated at first glance :stuck_out_tongue: (for me at least.)

Oh okay that seems safer, I’ll now never copy Event Tick, thank you I didn’t know it was bad to copy it.

Open 90 Event is a custom event.
Right click in a blank part of your graph.
Type “custom” in the search bar and Add Custom Event should pop up at or near the top of search results.

Rename your custom event Open 90.
Copy and paste your custom event. Rename the copy Open 50.

I didn’t realize that you weren’t supposed to copy Event Tick when I first started out so don’t worry. It’s a common early mistake.

I think svv3dudn provided a really nice code sample. Hopefully that works for you.