How do I stop a timer and capture the elapsed time?

I’m currently using the following to track time within the game, and intend to display the elapsed time once the game ends (player is out of ammo), so that it may be displayed on the Game End Widget.

However, I can’t figure out how to stop the timer and capture it at the moment the ammo reaches zero, so even on the end widget the time is still counting on rather than being a static number.

Would appreciate any help with this matter, thanks! :slight_smile:

Using Set Timer count node in False of Branch will stop timer when ammo becomes 0.

Did you try using the node called ‘Set Timer’? I think it has an option of elapsed time.

You mean like this? This doesn’t seem to work though. Timer still went on as usual.

No. The “Event Tick” output node into Branch. And “+” add node output to SET node in false. Delete SET node before Branch.

No, in this case you are doing a manual timer, Unreal has a node that will create a timer for you and when that timer is elapsed it will call a function of your choosing. That timer than can be stopped, and maybe you can even get its elapsed time out-of-the-box

https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/UseTimers/Blueprints/index.html

Ah I see. Got it, works now!

Thanks so much!

Please accept this as answer for future references. Thanks.