# AI won't resume patrolling after attacking player

**URL:** <https://forums.unrealengine.com/t/ai-wont-resume-patrolling-after-attacking-player/464161>\
**Category:** Community & Industry Discussion\
**Tags:** ai-navigation, attack, unreal-engine, question\
**Created:** [April 23, 2020, 8:50pm UTC](https://forums.unrealengine.com/t/ai-wont-resume-patrolling-after-attacking-player/464161 "2020-04-23T20:50:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamarar357](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tamarar357](https://forums.unrealengine.com/u/Tamarar357)\
**Post date:** [April 23, 2020, 8:50pm UTC](https://forums.unrealengine.com/t/ai-wont-resume-patrolling-after-attacking-player/464161/1 "2020-04-23T20:50:58Z")

</div>

So I am trying to get my AI to attack the player, once the character is dead, then patrol again and quit attacking. It seems like no matter what I do the AI keeps attacking, I’ve tried, isDead then start partrol again, isDead, isAttacking is set to false stuff like that but nothing works.

---

<div class="post-metadata">

**Author:** ![Tamarar357](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tamarar357](https://forums.unrealengine.com/u/Tamarar357)\
**Post date:** [April 24, 2020, 1:47pm UTC](https://forums.unrealengine.com/t/ai-wont-resume-patrolling-after-attacking-player/464161/2 "2020-04-24T13:47:39Z")

</div>

Here is some of my code attached

 ![300413-attack.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/4/3/c43a6ddfe5636eb813457b0b3aaebb85e1b376d9.jpeg)

.

 ![300412-aidamage.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/4/9/249c4896f649c973e1d214599be41fa20e5e27ec.jpeg)

---

<div class="post-metadata">

**Author:** ![Tamarar357](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tamarar357](https://forums.unrealengine.com/u/Tamarar357)\
**Post date:** [April 28, 2020, 1:11am UTC](https://forums.unrealengine.com/t/ai-wont-resume-patrolling-after-attacking-player/464161/3 "2020-04-28T01:11:28Z")

</div>

Fixed it! Had to have IsDead flag set for TPC, then on the AI\_Character I cast to TPC to check if the TPC is dead then quit attacking. Fixed issue.
