# How can I use a collision box to both pause a timer and increase a progress bar when the progress bar is slowly decreasing everywhere else?

**URL:** <https://forums.unrealengine.com/t/how-can-i-use-a-collision-box-to-both-pause-a-timer-and-increase-a-progress-bar-when-the-progress-bar-is-slowly-decreasing-everywhere-else/478233>\
**Category:** World Creation\
**Tags:** unreal-engine, Physics, Collision, Blueprint, question, box-overlap, set-timer\
**Created:** [February 4, 2021, 9:36am UTC](https://forums.unrealengine.com/t/how-can-i-use-a-collision-box-to-both-pause-a-timer-and-increase-a-progress-bar-when-the-progress-bar-is-slowly-decreasing-everywhere-else/478233 "2021-02-04T09:36:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Briedo\_Womter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Briedo\_Womter](https://forums.unrealengine.com/u/Briedo_Womter)\
**Post date:** [February 4, 2021, 9:36am UTC](https://forums.unrealengine.com/t/how-can-i-use-a-collision-box-to-both-pause-a-timer-and-increase-a-progress-bar-when-the-progress-bar-is-slowly-decreasing-everywhere-else/478233/1 "2021-02-04T09:36:26Z")

</div>

**Description** -  
I am trying to create a health system where the player’s health will slowly decrease unless they are in specified areas that will increase their health. (I am using this as a hypothermia system, so if the player is away from a heater, they will get cold, when they are close, they will get warm.)

How would I be able to pause the health timer, and slowly increase the players health, when they enter this collision space?

**Problem** - I have a timer set up so that I will slowly be decreasing the player’s health at at _Event Begin Play_ and when I walk into a Trigger Box, I get a boost of health. The timer does not pause when the player overlaps with the collision and just gives them a boost of health.

**Health Timer Blueprints**

_Health Depletion_ -  
I have set up a few functions to work through the system so far, On event begin play I call the _Set Health Timer_ that holds the _Deplete Health_ function in _Health Timer Name_.

 ![328854-eventgraph.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/1/5/41548787666712f38b21a0d59d61ff0596b82a0a.png)

 ![328855-sethealthtimer.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/c/5/9c5bb5ad2b74a3adac6ba7f204b21413818fa0fd.png)

 ![328856-depletehealth.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/e/8/7e8ba65d3d1bd140a4aa0842a3016f28fc318469.png)

_Adding Health_ -  
Here I have a check to see if the timer is active and set to add health to the player if that’s the case. I have tried different methods of pausing it but I can’t seem to figure out what I would need to do. I then call the _Add Health_ function in the Level Blueprints from an _OnActorBeginOverlap_

 ![328857-addhealth.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/0/5/4052b007863cd21cd1e149617897c205a7a7dd3e.png)

 ![328858-ishealthtimeractive.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/b/8/1b8b6334ece4545beb1d5ddf581f44fb896ab745.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 4, 2021, 10:35am UTC](https://forums.unrealengine.com/t/how-can-i-use-a-collision-box-to-both-pause-a-timer-and-increase-a-progress-bar-when-the-progress-bar-is-slowly-decreasing-everywhere-else/478233/2 "2021-02-04T10:35:47Z")

</div>

Timers have handles, once promoted to a variable they can be accessed freely and support pausing:

 ![328848-timer.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/b/e/3be2601e825fa6e3ee15a26848d73ffd11d2764a.jpeg)

Perhaps that’s what you need.

---

<div class="post-metadata">

**Author:** ![Briedo\_Womter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Briedo\_Womter](https://forums.unrealengine.com/u/Briedo_Womter)\
**Post date:** [February 5, 2021, 4:47am UTC](https://forums.unrealengine.com/t/how-can-i-use-a-collision-box-to-both-pause-a-timer-and-increase-a-progress-bar-when-the-progress-bar-is-slowly-decreasing-everywhere-else/478233/3 "2021-02-05T04:47:43Z")

</div>

I think this will work, but I’m having some trouble with calling it. I was able to get the timer function to pause but I’m having some trouble setting it to happening only when I am inside the collision box. I have it set, so far, to that when I step in it heals the character but it doesn’t unpause when I leave the box.

Would I need to make a new function for it to hook up to _OnActorEndOverlap_? At the moment, I have it hooked up to the “Add Health” function that gets called on actor overlap in the level blueprints.

Would I be able to handle both the pause and unpause actions in the single function?

 ![328942-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/5/3/153e1013ccc5d98e7553bd25c71fa7297f663599.png)

 ![328943-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/d/6/6d61179cc12750546a08e6b7f640673a5df78be9.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_be08fe41](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_be08fe41](https://forums.unrealengine.com/u/anonymous_user_be08fe41)\
**Post date:** [February 6, 2021, 11:40am UTC](https://forums.unrealengine.com/t/how-can-i-use-a-collision-box-to-both-pause-a-timer-and-increase-a-progress-bar-when-the-progress-bar-is-slowly-decreasing-everywhere-else/478233/4 "2021-02-06T11:40:58Z")

</div>

Yes you should ‘SetTimer’ during ‘OnActorBeginOverlap’, and ‘ClearAndInvalidateTimer’ during ‘OnActorEndOverlap’.

After SetTimer, hook the return value and click “promote to variable”. Then use this variable when you ClearAndInvalidateTimer
