# Help with Implementing Custom AI Behavior in Unreal Engine

**URL:** <https://forums.unrealengine.com/t/help-with-implementing-custom-ai-behavior-in-unreal-engine/2153813>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [November 27, 2024, 5:43am UTC](https://forums.unrealengine.com/t/help-with-implementing-custom-ai-behavior-in-unreal-engine/2153813 "2024-11-27T05:43:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yagosib240](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@yagosib240](https://forums.unrealengine.com/u/yagosib240)\
**Post date:** [November 27, 2024, 5:43am UTC](https://forums.unrealengine.com/t/help-with-implementing-custom-ai-behavior-in-unreal-engine/2153813/1 "2024-11-27T05:43:02Z")

</div>

Hi everyone…

I am working on a project where I’m trying to create custom AI behavior for NPCs in Unreal Engine, but I am running into some challenges. My goal is to have the AI dynamically change its behavior based on specific player actions, like switching between aggressive and defensive modes depending on the player’s proximity and health level.

I have been using Behavior Trees and Blackboard, but I’m not sure how to structure the transitions effectively. Should I use decorators for this, or is there a better way to handle state changes? Also, I’m curious if anyone has tips for optimizing performance when running multiple AI with complex behaviors in a single level.

I also check this: [https://forums.unrealengine.com/t/community-tutorial-how-to-create-a-boss-fight-in-unreal-engine-5-behavior-trees-ai-beginner-tutorial](https://forums.unrealengine.com/t/community-tutorial-how-to-create-a-boss-fight-in-unreal-engine-5-behavior-trees-ai-beginner-tutorial/1805003)[mendix](https://www.igmguru.com/digital-marketing-programming/mendix-training)

But I have not found any solution. Could anyone guide me about this? Any advice, examples, or resources would be really appreciated!

Thanks in advance! 😊
