First I KNOW how to make a door open and close when you press it with lets say F.
But can someone help me, I want to have a timer for like 5 seconds that I have to hold F until the door open.
If I let go the timer will restart and when I want to press F again it will count from 5 seconds…
And when the timer is done the door opens.
And I can close it like normal but I dont need the timer to open it again.
Think of it as a lock on a door and you need to pick it.
Also when I pick those 5 seconds, I want a 5 second timer to show on screen.
When you first arrive at the door (i.e. as a default variable valur), have a bool “Unlocked = False”.
When you press F, hit a branch node. If Unlocked = False, call a Timer or Timeline that runs for 5 seconds and then sets Unlocked to True. If F Released is triggered, it should ALSO hit a branch… And for it, If Unlocked = False, it should stop and then reset the timer/timeline.
From the True statements of these two branch nodes, fire off your normal door opening/closing behavior that uses the F Key Input.
You can use a “set timer” node that ticks every second on a gate. The gate is opened when you press F (in this case). Within that gate do a integer increase for each second (set integer (Var): Var + 1), after this set do a branch that checks to see if the var is >=5. Once this is true, run your door opening script. If you release F, reset the integer Var to 0 and close the gate.