Download

How do I stop an event / Timer on Key Release?

Hi,

I have a BeginonEventPlay which calls a looping event “DOF magic” with a timer.

But I want to configure this in such a way that a Keypress will trigger it and KeyRelease will stop it. ( It’s a Post Process Effect )
I tried using a branch node but I am not sure how to stop the event or the timer.

UEQ.JPG

The SetTimer node returns a TimerHandle. You can use your handle to communicate with that given Timer. Your other option is the ClearTimerByFunctionName node.
75631e4951640c46ac4df07e4aacbdb066094b17.jpeg

You just call SetTimer on the key Pressed event, and call ClearTimer on the Released event.

Hi Kontur
Thanks a lot,
This method worked, but partially.

The timer stopped. But the my DOF_Magic was still executing after my key release.
I had my debug marker running when I hit the key press and it stopped when I released the key. But the DOF magic will still running. How can I stop this function entirely and restart the timer loop on key press?

034f0172c0be54367c4e6620269b4b7cd393656f.jpeg

Hi Kontur
I have used this method to override my Focus Distance on Key release. So it’s working as I want it now.
But I would like to know how to stop a function from executing entirely as well.

Thanks

UE4_Q2.JPG

The way I do it.


But the problem I have is… timers always start with a delay. I need shooting to happen immediately.

So fire the function immediately, and then start the timer.

How to add and delete timer in Unreal Tournament 4 properly?