# How do I deal damage ONLY when collision boxes have overlapped for a certain amount of time?

**URL:** <https://forums.unrealengine.com/t/how-do-i-deal-damage-only-when-collision-boxes-have-overlapped-for-a-certain-amount-of-time/376019>\
**Category:** Platform & Builds\
**Tags:** health, damage, overlap, detection, unreal-engine, Collision, question\
**Created:** [November 11, 2016, 6:07am UTC](https://forums.unrealengine.com/t/how-do-i-deal-damage-only-when-collision-boxes-have-overlapped-for-a-certain-amount-of-time/376019 "2016-11-11T06:07:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_68623ae7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_68623ae7](https://forums.unrealengine.com/u/anonymous_user_68623ae7)\
**Post date:** [November 11, 2016, 6:07am UTC](https://forums.unrealengine.com/t/how-do-i-deal-damage-only-when-collision-boxes-have-overlapped-for-a-certain-amount-of-time/376019/1 "2016-11-11T06:07:57Z")

</div>

I have collision damage working fine , but I want the damage to only be dealt when the players and enemies collision boxes over lap for 2 seconds. (If my player escapes the enemies collision box before two seconds he takes no damage is what i’m after) I have tried a delay and all that does is deal damage 2 seconds later regardless of weather the collision boxes are still overlapping or not.  
All help is appreciated.

---

<div class="post-metadata">

**Author:** ![Erytriel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Erytriel](https://forums.unrealengine.com/u/Erytriel)\
**Post date:** [November 11, 2016, 6:42am UTC](https://forums.unrealengine.com/t/how-do-i-deal-damage-only-when-collision-boxes-have-overlapped-for-a-certain-amount-of-time/376019/2 "2016-11-11T06:42:09Z")

</div>

good morning 🙂

 ![114525-answeringue.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/5/0/b50172a5ea449313b4e46f85f5e9d2954a6cb714.png)

 ![114526-answeringue2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/6/e/16eb9f8fda2be2c6ae4a073dd482f513e6ea81d9.jpeg)

this should solve ur problem.^^

u have the overlap event which goes into a triggerable delay (so it resets every time u begin overlap) and the key is to ask if it is overlapping after the 2 seconds again 🙂

i made a simple sphere collision here and get a filtered array of the playercharacter (so u dont get all those other actors overlapped) , this works on player side the same way. if you for example have a “Basic enemy” bp and all child Bp’s of that would be enemy , so u just have to filter the basic enemy instead of different classes.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_68623ae7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_68623ae7](https://forums.unrealengine.com/u/anonymous_user_68623ae7)\
**Post date:** [November 11, 2016, 12:39pm UTC](https://forums.unrealengine.com/t/how-do-i-deal-damage-only-when-collision-boxes-have-overlapped-for-a-certain-amount-of-time/376019/3 "2016-11-11T12:39:01Z")

</div>

Good morning! And a huge thank you! Retriggerable delay was exactly what I needed. Thank you very much 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_68623ae7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_68623ae7](https://forums.unrealengine.com/u/anonymous_user_68623ae7)\
**Post date:** [November 11, 2016, 12:41pm UTC](https://forums.unrealengine.com/t/how-do-i-deal-damage-only-when-collision-boxes-have-overlapped-for-a-certain-amount-of-time/376019/4 "2016-11-11T12:41:13Z")

</div>

Here’s the code now

 ![114552-retrigger+delay+collision.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/3/d/03d9b84b57f0da7d6ee4dc1340c2ffd242cb4482.png)

---

<div class="post-metadata">

**Author:** ![Erytriel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Erytriel](https://forums.unrealengine.com/u/Erytriel)\
**Post date:** [November 11, 2016, 9:16pm UTC](https://forums.unrealengine.com/t/how-do-i-deal-damage-only-when-collision-boxes-have-overlapped-for-a-certain-amount-of-time/376019/5 "2016-11-11T21:16:54Z")

</div>

it would be nice if you could mark it as a answer 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_68623ae7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_68623ae7](https://forums.unrealengine.com/u/anonymous_user_68623ae7)\
**Post date:** [November 11, 2016, 11:29pm UTC](https://forums.unrealengine.com/t/how-do-i-deal-damage-only-when-collision-boxes-have-overlapped-for-a-certain-amount-of-time/376019/6 "2016-11-11T23:29:39Z")

</div>

Marked it, First question on this so I didn’t really know how 🙂 thanks again
