How to have a door close automatically over time?

So I have a here a basic blueprint that opens and closes a door upon pressing what I defined as the, “Interact” key. Everything flows correctly, however, I would like the door to close automatically after a period of time. I was able to do it with a delay that is connected back to the first branch node of the code, my issue is though that instead of closing the door automatically after two seconds once, it loops back through the code and continues to open and close every two seconds. How would I just have this close after two seconds and then stop the code?

Your branch node is acting like a flip-flop, and the delay node is constantly refiring it.
Instead of the delayed wire running to the branch, skip the branch and run to the set bool node.

At this point your original issue is solved but I added some extra for health.


The delay shouldn’t hang from the Update wire. Since the update write acts like a tick. Change that to the Finished wire which only fires once and at the end of the timeline.

The Finished wire with fire whenever the play\reverse\etc lines are called, so…
You can use the “Direction” output wire from the timeline to branch if the direction is forward. Drag out the direction wire and search for “==” to get a comparison node to plug into a branch then change the comparison nodes value to “forward”. So that the finished wire runs Finished → branch → delay → setBool


Also consider replacing the delay node with a setTimerByEvent node, which can do the same thing with the added benefit that you can reset it when you interact with the door, by calling clearTimer from the nodes blue output. I mention this because the delay timer may actually close the door in your face if you continually interact with the door.

3 Likes

Hey thank you so much, sorry for the late response! That did the trick.