# Stun from a looping timeline enemy

**URL:** <https://forums.unrealengine.com/t/stun-from-a-looping-timeline-enemy/473175>\
**Category:** Getting Started & Setup\
**Tags:** coding, unreal-engine, UE4, question\
**Created:** [October 19, 2020, 6:33pm UTC](https://forums.unrealengine.com/t/stun-from-a-looping-timeline-enemy/473175 "2020-10-19T18:33:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Missnanners1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Missnanners1](https://forums.unrealengine.com/u/Missnanners1)\
**Post date:** [October 19, 2020, 6:33pm UTC](https://forums.unrealengine.com/t/stun-from-a-looping-timeline-enemy/473175/1 "2020-10-19T18:33:16Z")

</div>

I have a simple enemy that moves left to right in a looping motion with a timeline. When the enemy overlaps the second projectile it will only stun them compared to the first projectile type damaging health. How would I go about adding the delay of 5 seconds to where the enemy still moves smoothly side to side but will stop in place when hit by the players “spray attack” then after 5 secs start moving again. Code is almost there I just believe something simple is missing that i’m not seeing. I am 3 months into learning coding with unreal so any help would be appreciated.

 ![319291-image-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/4/d/b4da038cb9d3333d63d8cc1fadb6c0af694cc870.png)

 ![319292-image-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/f/4/3f4259c9d0d54fd8e1cd3a89bca289b7fcbe16d8.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 19, 2020, 8:09pm UTC](https://forums.unrealengine.com/t/stun-from-a-looping-timeline-enemy/473175/2 "2020-10-19T20:09:25Z")

</div>

You’re having a bit of a ‘yikes’ moment there with the timeline. You have to realise that everything on the update pin is called EVERY FRAME. So your loop ( which by the way, does nothing with the bool ), is re-starting the timeline every frame 🙂

When the enemy gets the attack just trigger the stop pin on the timeline, then after 5 seconds, trigger the play pin.

 ![319295-screenshot-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/b/71b0b2ad2199e011e63c3e813c2ea30c75c8127d.jpeg)

---

<div class="post-metadata">

**Author:** ![Missnanners1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Missnanners1](https://forums.unrealengine.com/u/Missnanners1)\
**Post date:** [October 19, 2020, 10:21pm UTC](https://forums.unrealengine.com/t/stun-from-a-looping-timeline-enemy/473175/3 "2020-10-19T22:21:55Z")

</div>

This does nothing for me sadly. The enemy is supposed to be constantly moving left and right looping and only delay with a stop when overlapped with a projectile at a Key press.

---

<div class="post-metadata">

**Author:** ![Missnanners1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Missnanners1](https://forums.unrealengine.com/u/Missnanners1)\
**Post date:** [October 19, 2020, 11:27pm UTC](https://forums.unrealengine.com/t/stun-from-a-looping-timeline-enemy/473175/4 "2020-10-19T23:27:26Z")

</div>

After following a friend I’ve managed to update my code to this but it is still not working just right. I know it’s close…

 ![319315-ooooof.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/2/e/d2e5013062424e13fdebebce86ba84450ae20b9f.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 20, 2020, 7:31am UTC](https://forums.unrealengine.com/t/stun-from-a-looping-timeline-enemy/473175/5 "2020-10-20T07:31:22Z")

</div>

Yes, correct, you need to incorporate this code with what you have ( minus the bool thing ). It wont do anything on it’s own of course…
