# Enemy AI perception does not lose focus when the player is destroyed

**URL:** <https://forums.unrealengine.com/t/enemy-ai-perception-does-not-lose-focus-when-the-player-is-destroyed/464940>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [May 9, 2020, 11:39pm UTC](https://forums.unrealengine.com/t/enemy-ai-perception-does-not-lose-focus-when-the-player-is-destroyed/464940 "2020-05-09T23:39:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlienwareI7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlienwareI7](https://forums.unrealengine.com/u/AlienwareI7)\
**Post date:** [May 9, 2020, 11:39pm UTC](https://forums.unrealengine.com/t/enemy-ai-perception-does-not-lose-focus-when-the-player-is-destroyed/464940/1 "2020-05-09T23:39:49Z")

</div>

I have my game setup so the AI chases the player on sight (AI Perception). When they “Hit” the player, it causes damage until the player is literally destroyed (Destroy Actor). They do not reset and begin wandering around again. They just stand there where the player last was and spit out this error like there is no tomorrow:  
Blueprint Runtime Error: “Accessed None trying to read property CallFunc\_GetPlayerCharacter\_ReturnValue”. Blueprint: GetPlayerLocationTut Function: Execute Ubergraph Get Player Location Tut Graph: EventGraph Node: Set Blackboard Value as Vector  
The best I can tell, with the player destroyed, there is no valid vector update, so they stand there and look stupid. If is zip around a corner and out of sight, they revert to wandering around.

---

<div class="post-metadata">

**Author:** ![AlienwareI7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlienwareI7](https://forums.unrealengine.com/u/AlienwareI7)\
**Post date:** [May 9, 2020, 11:41pm UTC](https://forums.unrealengine.com/t/enemy-ai-perception-does-not-lose-focus-when-the-player-is-destroyed/464940/2 "2020-05-09T23:41:25Z")

</div>

![301554-stop-chasing.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/6/2/d626b4d2b7f065c1fac31c3530750e5c521d75c0.png)

---

<div class="post-metadata">

**Author:** ![Detach789](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Detach789](https://forums.unrealengine.com/u/Detach789)\
**Post date:** [May 10, 2020, 1:40pm UTC](https://forums.unrealengine.com/t/enemy-ai-perception-does-not-lose-focus-when-the-player-is-destroyed/464940/3 "2020-05-10T13:40:56Z")

</div>

Try hooking an Is Valid node up to the get player character node. Run the Is Valid node first, then proceed to the rest of the code if it is true.

You can also pull the wire off of the “false” part of the Is Valid and set where you want the AI to go if your character has been destroyed. (Maybe have the AI make a starting location variable at some point and simply return to that point upon the player character being destroyed?)

---

<div class="post-metadata">

**Author:** ![AlienwareI7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlienwareI7](https://forums.unrealengine.com/u/AlienwareI7)\
**Post date:** [May 10, 2020, 1:56pm UTC](https://forums.unrealengine.com/t/enemy-ai-perception-does-not-lose-focus-when-the-player-is-destroyed/464940/4 "2020-05-10T13:56:20Z")

</div>

I will give that a shot once I finish placing lights. Now that is a fun tie.

---

<div class="post-metadata">

**Author:** ![AlienwareI7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlienwareI7](https://forums.unrealengine.com/u/AlienwareI7)\
**Post date:** [May 10, 2020, 9:41pm UTC](https://forums.unrealengine.com/t/enemy-ai-perception-does-not-lose-focus-when-the-player-is-destroyed/464940/5 "2020-05-10T21:41:47Z")

</div>

That got rid of the errors!!! Thanks a million!!!
