{"id":435,"date":"2021-10-07T10:09:21","date_gmt":"2021-10-07T10:09:21","guid":{"rendered":"https:\/\/globalgoodplay.com\/?p=435"},"modified":"2022-11-03T13:33:30","modified_gmt":"2022-11-03T13:33:30","slug":"enemy-ai-with-c-and-blueprints-in-unreal-engine","status":"publish","type":"post","link":"https:\/\/globalgoodplay.com\/?p=435","title":{"rendered":"Enemy AI With C++ And Blueprints In Unreal Engine"},"content":{"rendered":"<div class=\"elementor elementor-15896\" data-elementor-type=\"wp-post\" data-elementor-id=\"15896\">\n<section class=\"elementor-section elementor-top-section elementor-element elementor-element-1ff556e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"1ff556e\" data-element_type=\"section\">\n<div class=\"elementor-container elementor-column-gap-default\">\n<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-58fdbf4\" data-id=\"58fdbf4\" data-element_type=\"column\">\n<div class=\"elementor-widget-wrap elementor-element-populated\">\n<div class=\"elementor-element elementor-element-b17e610 elementor-widget elementor-widget-text-editor\" data-id=\"b17e610\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>Depending on the type of enemies you have in your game, you will create different AI behavior. And there are multiple ways how to create enemy AI in Unreal Engine, from the basic enemies that move between two points all the way to creating complex AI behavior using Behavior Trees and Blackboards.<\/p>\n<p>In this post we are going to learn about AI in Unreal Engine by creating basic, intermediate and advanced enemy AI behavior using C++ and blueprints.<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-45a7dbc elementor-widget elementor-widget-heading\" data-id=\"45a7dbc\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n<div class=\"elementor-widget-container\">\n<h3 class=\"elementor-heading-title elementor-size-default\">Download Assets And Complete Project For This Tutorial<\/h3>\n<h3 class=\"elementor-heading-title elementor-size-default\">Unreal Engine Enemy AI C++ And Blueprints Tutorial<\/h3>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-29e077b6 single-post-download elementor-widget elementor-widget-wc-elements\" data-id=\"29e077b6\" data-element_type=\"widget\" data-widget_type=\"wc-elements.default\">\n<div class=\"elementor-widget-container\">\n<div class=\"woocommerce\">\n<div class=\"single-product\" data-product-page-preselected-id=\"0\">\n<div id=\"product-17301\" class=\"product type-product post-17301 status-publish first instock product_cat-uncategorized downloadable virtual product-type-simple\">\n<div class=\"summary entry-summary\">\n<p class=\"price\">\n<style>\n    .single-product div.product .summary form.cart { display: none!important; }<br \/>\n  <\/style>\n<\/p>\n<p class=\"price\"><span style=\"color: initial; font-size: revert; font-weight: revert;\">To follow along with this tutorial, please download the starter project by clicking on the green Download assets button above.<\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-7495f86 elementor-widget elementor-widget-text-editor\" data-id=\"7495f86\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div data-id=\"169995e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div data-id=\"af1de0b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div data-id=\"169995e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div data-id=\"af1de0b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<p>In the downloaded folder you will find the finished project, and the starter project which I prepared for you to follow this tutorial.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-092f583 elementor-widget elementor-widget-heading\" data-id=\"092f583\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n<div class=\"elementor-widget-container\">\n<h3 class=\"elementor-heading-title elementor-size-default\">Important Information Before We Start<\/h3>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-05850e6 elementor-widget elementor-widget-text-editor\" data-id=\"05850e6\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>One of the labels for this tutorial is beginner, however this is not a tutorial for complete beginners.<\/p>\n<p>I expect you to know how to create basic games in Unreal, but you are a beginner when it comes to AI programming in Unreal. So it is mandatory that you know how to code in C++ and blueprints, and know how to use Unreal and its interface.<\/p>\n<p>Another thing to note is that I am using Unreal Engine 4.27 for this tutorial, but the techniques that I am going to teach you can be applied to any Unreal Engine version.<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-29bc2ed elementor-widget elementor-widget-heading\" data-id=\"29bc2ed\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n<div class=\"elementor-widget-container\">\n<h3 class=\"elementor-heading-title elementor-size-default\">Enemy AI Patrol<\/h3>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-9b8acfc elementor-widget elementor-widget-text-editor\" data-id=\"9b8acfc\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>First we are going to create a basic patrol behavior for the enemy where the enemy is going to roam in the level.<\/p>\n<p>Open the Enemy_AI_Starter_Project that you downloaded. Open the EnemyAI_Map located in Content -&gt; Maps folder. In the map you will notice the enemy and the player actor are already prepared.<\/p>\n<p>Open the BP_Enemy blueprint located in Content -&gt; Blueprints folder. In the Event Graph tab, Right Click and search for custom event:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-3db2032 elementor-widget elementor-widget-image\" data-id=\"3db2032\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 1\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/5b85e236629ae3e9641fda8877b24973317257378e42c66fcad3729864ac8b67.jpeg\" alt=\"Img 1\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-1955a22 elementor-widget elementor-widget-text-editor\" data-id=\"1955a22\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div>Name the new custom event Random Patrol:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-bb77198 elementor-widget elementor-widget-image\" data-id=\"bb77198\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 2\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/163ab15bbc9f4fd0c5437d816e3a6a36c9079f3589c7830a6b35cef94f70a989.jpeg\" alt=\"Img 2\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-f9ef0df elementor-widget elementor-widget-text-editor\" data-id=\"f9ef0df\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>To make the enemy patrol in the level, we are going to use AI MoveTo function, and we are going to provide it a random destination within the navigationable bounds volume:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-15a4129 elementor-widget elementor-widget-image\" data-id=\"15a4129\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 3\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/5a12fb4ad9c8e34014b6c1e28a22412c129866699c86f472b51d93bf2b4358a7.jpeg\" alt=\"Img 3\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-75a278f elementor-widget elementor-widget-text-editor\" data-id=\"75a278f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>You can copy the nodes from here:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-5b0d855 elementor-widget elementor-widget-html\" data-id=\"5b0d855\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n<div class=\"elementor-widget-container\"><iframe src=\"https:\/\/blueprintue.com\/render\/ns0de4np\/\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-e0958c8 elementor-widget elementor-widget-text-editor\" data-id=\"e0958c8\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>For AI MoveTo parameters we provided self, which is a reference to the enemy blueprint, and for the destination we used the GetRandomReachablePointInRadius which is a function that will give us a reachable point in the radius we provide from the origin.<\/p>\n<p>This function will calculate all the collisions that are in the way of the AI and that way the enemy will cleverly avoid any obstacles in his path.<\/p>\n<p>For the origin parameter of the GetRandomReachablePointInRadius function we provided the location of the enemy, because we are going to patrol from the enemy\u2019s location.<\/p>\n<p>For the radius I\u2019ve set 1500 as the value, which means it will try to get a reachable point from the enemy\u2019s location in the 1500 value radius. Of course, we can change the radius value to a higher or a lower number anytime we want to make the enemy patrol further in the level.<\/p>\n<p>When the AI MoveTo function finishes, we are going to delay for 1 second using the Delay function, and then call the Random Patrol node we create so that the enemy will randomly patrol the level again.<\/p>\n<p>Before we proceed to test this out, from the BeingPlay call the Random Patrol node we created:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-0283081 elementor-widget elementor-widget-image\" data-id=\"0283081\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 4\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/a0cd4cbacb3c61f97dbfc07247d417e8c70a2704b36aeb51206835751362c812.jpeg\" alt=\"Img 4\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-ccac78e elementor-widget elementor-widget-text-editor\" data-id=\"ccac78e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div>Compile and save the changes we made in the BP_Enemy blueprint. In order to make this work, we need to add the NavMeshBoundsVolume in the level. From the Place Actors tab, search for the NavMeshBoundsVolume:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-190f9c3 elementor-widget elementor-widget-image\" data-id=\"190f9c3\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 5\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/9450b1e2e9a9e9fc31143d37785e7a42454de6f73d66b031044c17061591f836.jpeg\" alt=\"Img 5\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-e60e034 elementor-widget elementor-widget-text-editor\" data-id=\"e60e034\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>Drag the NavMeshBoundsVolume in the level and set the following values for its Location and Scale:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-fa0df87 elementor-widget elementor-widget-image\" data-id=\"fa0df87\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 6\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/94c05df38ea265688f2233ad3a5b434964e67e63c2c98c920448411e1bcec62e.jpeg\" alt=\"Img 6\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-3518cd4 elementor-widget elementor-widget-text-editor\" data-id=\"3518cd4\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>This will make the NavMeshBoundsVolume cover the whole level and this will be the navigationable area where the enemy can move with the help of AI MoveTo function:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-a1e42be elementor-widget elementor-widget-image\" data-id=\"a1e42be\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 7\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/f0215fba957bb330100a59b056c8f74d41ecb115de8eb7e31c85da2a9152fb62.jpeg\" alt=\"Img 7\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-d36014b elementor-widget elementor-widget-text-editor\" data-id=\"d36014b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>Let us now run the game and test it out:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-a7b531d elementor-aspect-ratio-169 elementor-widget elementor-widget-video\" data-id=\"a7b531d\" data-element_type=\"widget\" data-settings=\"{\" data-widget_type=\"video.default\">\n<div class=\"elementor-widget-container\">\n<div class=\"elementor-wrapper elementor-fit-aspect-ratio elementor-open-inline\">\n<div class=\"elementor-video\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-38f6c42 elementor-widget elementor-widget-text-editor\" data-id=\"38f6c42\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>We can also remove the delay that happens after AI MoveTo function finishes which will make the enemy patrol the level without stopping.<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-0691f0d elementor-widget elementor-widget-heading\" data-id=\"0691f0d\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n<div class=\"elementor-widget-container\">\n<h3 class=\"elementor-heading-title elementor-size-default\">Detecting The Player\u2019s Presence And Moving Towards Him<\/h3>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-6e84ab3 elementor-widget elementor-widget-text-editor\" data-id=\"6e84ab3\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>We can use the same function to make the enemy run towards the player. But first, we need a way to detect the player\u2019s presence near the enemy. For that we are going to attach a Sphere Collision component to the enemy.<\/p>\n<p>In the blueprint editor for the BP_Enemy, in the Components tab click on Add Component and filter for sphere collision:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-c55f000 elementor-widget elementor-widget-image\" data-id=\"c55f000\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 8\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/969a9366880dba2e3f5f1a7f0ce30b2500306db645eb5caaf9a574d7c7b9a5fd.jpeg\" alt=\"Img 8\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-c97acb7 elementor-widget elementor-widget-text-editor\" data-id=\"c97acb7\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div>Rename the component to Player Collision Detection and in the Details tab set the Sphere Radius to 800:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-0f7c3b1 elementor-widget elementor-widget-image\" data-id=\"0f7c3b1\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 9\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/f5f59e72515aa48f53345824ee1a1882e0912b34f60f1461d9503ba1151eb3ab.jpeg\" alt=\"Img 9\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-b87a6be elementor-widget elementor-widget-text-editor\" data-id=\"b87a6be\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>In the My Blueprint tab, under variables create a new boolean variable and name it Player Detected. Then create another variable and for the variable type, click on the variable icon:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-7e85a2c elementor-widget elementor-widget-image\" data-id=\"7e85a2c\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 10\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/207aa462d878ba085f2a6e052980dd6d6b624a5df645c8eb1fedd88aa58c7439.jpeg\" alt=\"Img 10\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-555ece4 elementor-widget elementor-widget-text-editor\" data-id=\"555ece4\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>In the search bar filter for third person and select the Object Reference for the Third Person Character:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-7d5a08f elementor-widget elementor-widget-image\" data-id=\"7d5a08f\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 11\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/0881aa42ce46448e1a90b4f24f5c22a70abd0a32dae0ad9789ea76af6c9539a7.jpeg\" alt=\"Img 11\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-db97e98 elementor-widget elementor-widget-text-editor\" data-id=\"db97e98\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div>In this variable we will store a reference to the player actor since we need his location in order to make the enemy move towards him.<\/div>\n<div><\/div>\n<div>For that, we need to select the Player Collision Detection component in the Components tab, and in the Details tab scroll all the way to the bottom and under Events, click on the green + button for On Component Begin Overlap and On Component End Overlap:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-030a015 elementor-widget elementor-widget-image\" data-id=\"030a015\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 12\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/8c7fa7905285571ddeec8a9d0574a95afb8a6a81b08b2bea258766371b2cc187.jpeg\" alt=\"Img 12\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-fb3ff91 elementor-widget elementor-widget-text-editor\" data-id=\"fb3ff91\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>With these two functions we are going to detect when the Player Collision Detection sphere collides with the player actor so that we can chase him, and when the player actor exists the collision so that we can stop chasing him.<\/p>\n<p>But before we do that, we are going to create a custom event and name it Move To Player, which is going to make the enemy move towards the player actor:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-cb32c8f elementor-widget elementor-widget-image\" data-id=\"cb32c8f\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 13\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/20ca2e537cddfa7d342e830d941676780165fdb77ddebc71b3da18ed9b706faa.jpeg\" alt=\"Img 13\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-3886971 elementor-widget elementor-widget-text-editor\" data-id=\"3886971\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>You can copy the nodes from here:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-7d3c99b elementor-widget elementor-widget-html\" data-id=\"7d3c99b\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n<div class=\"elementor-widget-container\"><iframe src=\"https:\/\/blueprintue.com\/render\/0hf8ehnl\/\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-4632e83 elementor-widget elementor-widget-text-editor\" data-id=\"4632e83\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>As you can see, we are using the Player REF variable, which is a reference to the player actor in the game, to get the location of the player and make the enemy move towards him.<\/p>\n<p>The Acceptance Radius parameter for the AI MoveTo function is how far from the target will the AI stop moving, in this case we set the value to 150 units.<\/p>\n<p>To get a reference to the player actor, we need to detect collision in On Component Begin Overlap that we created:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-19f3971 elementor-widget elementor-widget-image\" data-id=\"19f3971\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 14\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/7cfbb1ac75da62ed175d86ff2b09ccb6e337d48be5368a7c3a1ca90ca036a64b.jpeg\" alt=\"Img 14\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-cfd1bee elementor-widget elementor-widget-text-editor\" data-id=\"cfd1bee\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>In OnComponentBeginOverlap we first perform a cast to test if the player actor has collided with the sphere, if that is true, we will get a reference to the player actor and we set the Player Detected bool value to true. We will use this variable to control the enemy AI logic.<\/p>\n<p>And then, we make the enemy go towards the player using the Move To Player custom event node we created.<\/p>\n<p>In OnComponentEndOverlap, when the player actor collides with the sphere, we are going to set the Player Detected value to false, and make the enemy patrol randomly again:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-63dff3d elementor-widget elementor-widget-image\" data-id=\"63dff3d\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 15\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/1a1e17fd0279b887b424153f53667b4a9400135773554ee31b8f81fb7b9a6031.jpeg\" alt=\"Img 15\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-713c3d3 elementor-widget elementor-widget-text-editor\" data-id=\"713c3d3\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div>You can copy the nodes from here:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-a7a4454 elementor-widget elementor-widget-html\" data-id=\"a7a4454\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n<div class=\"elementor-widget-container\"><iframe src=\"https:\/\/blueprintue.com\/render\/cnkab13z\/\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-a93eac8 elementor-widget elementor-widget-text-editor\" data-id=\"a93eac8\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>Compile and save the changes and now let\u2019s run the game and test it out:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-76658ce elementor-aspect-ratio-169 elementor-widget elementor-widget-video\" data-id=\"76658ce\" data-element_type=\"widget\" data-settings=\"{\" data-widget_type=\"video.default\">\n<div class=\"elementor-widget-container\">\n<div class=\"elementor-wrapper elementor-fit-aspect-ratio elementor-open-inline\">\n<div class=\"elementor-video\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-4a4180d elementor-widget elementor-widget-text-editor\" data-id=\"4a4180d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>While the enemy is detecting the player\u2019s presence and going towards his location, we have one big issue, and that is the enemy is not following the player when he moves around, instead it goes towards the first location where the player was when we detected the collision with the player.<\/p>\n<p>We can fix this issue by calling the Move To Player in the Tick event, but this will make a problem when we want to attack the player. Instead there is a better solution to this problem that we are going to implement now.<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-ac028b6 elementor-widget elementor-widget-heading\" data-id=\"ac028b6\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n<div class=\"elementor-widget-container\">\n<h3 class=\"elementor-heading-title elementor-size-default\">A Smarter Way To Make The Enemy AI Chase The Player<\/h3>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-4c6bb39 elementor-widget elementor-widget-text-editor\" data-id=\"4c6bb39\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>Since the AI MoveTo function will move the AI to the first position we pass to it, we need a way to test if the target position has changed so that the AI will move towards the changed position.<\/p>\n<p>For that, I am going to create a new custom event, name it Seek player and add the following nodes to it:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-58d764f elementor-widget elementor-widget-image\" data-id=\"58d764f\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 16\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/c42ca5c347fc3ef32779eee69f9556e4d0f7617b4fcf963789836b0915c58053.jpeg\" alt=\"Img 16\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-fcc8450 elementor-widget elementor-widget-text-editor\" data-id=\"fcc8450\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div>You can copy the nodes from here:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-efd746d elementor-widget elementor-widget-html\" data-id=\"efd746d\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n<div class=\"elementor-widget-container\"><iframe src=\"https:\/\/blueprintue.com\/render\/0cznxyl2\/\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-6cf4293 elementor-widget elementor-widget-text-editor\" data-id=\"6cf4293\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div>Seek Player will call the Move To Player which makes the AI move towards the player target, but it will also use the Set Timer By Function Name to call the Seek Player after every 0.25 seconds.<\/div>\n<div><\/div>\n<div>We specified that in the Function Name parameter where we passed the Seek Player, and for the Time parameter we set 0.25. Also, the Looping parameter is set to true, which means the Set Timer By Function Name will be called over and over after every 0.25 seconds.<\/div>\n<div><\/div>\n<div>Before we proceed, we are going to create another custom node that will make the AI stop seeking the player:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-0d019be elementor-widget elementor-widget-image\" data-id=\"0d019be\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 17\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/c3ae88c709cad20d87ad573589fcc53eeb3e7c7a4f1740ad838e19b604d571f4.jpeg\" alt=\"Img 17\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-0c32731 elementor-widget elementor-widget-text-editor\" data-id=\"0c32731\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>You can copy the nodes from here:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-48a193e elementor-widget elementor-widget-html\" data-id=\"48a193e\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n<div class=\"elementor-widget-container\"><iframe src=\"https:\/\/blueprintue.com\/render\/mcaoh5hl\/\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-fb18d2c elementor-widget elementor-widget-text-editor\" data-id=\"fb18d2c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>The Clear Timer By Function name will stop the timer from calling the function with the specified name, in our case Seek Player which we provided in the Function Name parameter.<\/p>\n<p>We need to do this because we specified that the Set Timer By Function Name should loop, which means it will run all the time until we stop it by using Clear Timer By Function Name.<\/p>\n<p>Now, we need to edit the Move To Player function:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-866d8df elementor-widget elementor-widget-image\" data-id=\"866d8df\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 18\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/4294970313bda69efcccce5933376bbe08b275dfd472fe3f4ec77787a2d3866c.jpeg\" alt=\"Img 18\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-db6f0c3 elementor-widget elementor-widget-text-editor\" data-id=\"db6f0c3\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div>You can copy the nodes from here:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-190cb1e elementor-widget elementor-widget-html\" data-id=\"190cb1e\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n<div class=\"elementor-widget-container\"><iframe src=\"https:\/\/blueprintue.com\/render\/9t08ykru\/\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-4464fa2 elementor-widget elementor-widget-text-editor\" data-id=\"4464fa2\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div>Now, when the enemy reaches the player, it will test if the player is still within its bounds by checking if the Player Detected value is true, if that is the case it will continue chasing the player by calling Seek Player.<\/div>\n<div><\/div>\n<div>We also need to change the On Component Begin and End Overlap for the enemy:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-f271612 elementor-widget elementor-widget-image\" data-id=\"f271612\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 19\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/9034ee816f0d0f31254dd14ebd5238a25f39cee428848dfc664846a5afb4696e.jpeg\" alt=\"Img 19\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-c761d11 elementor-widget elementor-widget-text-editor\" data-id=\"c761d11\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>You can copy the nodes from here:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-e0c24c0 elementor-widget elementor-widget-html\" data-id=\"e0c24c0\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n<div class=\"elementor-widget-container\"><iframe src=\"https:\/\/blueprintue.com\/render\/te-tbq_0\/\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-4f1e121 elementor-widget elementor-widget-text-editor\" data-id=\"4f1e121\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>Compile and save the new changes to the BP_Enemy blueprint and let\u2019s run the game to test it out:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-30f96d9 elementor-aspect-ratio-169 elementor-widget elementor-widget-video\" data-id=\"30f96d9\" data-element_type=\"widget\" data-settings=\"{\" data-widget_type=\"video.default\">\n<div class=\"elementor-widget-container\">\n<div class=\"elementor-wrapper elementor-fit-aspect-ratio elementor-open-inline\">\n<div class=\"elementor-video\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-fb0ec93 elementor-widget elementor-widget-text-editor\" data-id=\"fb0ec93\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>As you can see now, even when the player changes his location the enemy is constantly chasing him.<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-fafc31f elementor-widget elementor-widget-heading\" data-id=\"fafc31f\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n<div class=\"elementor-widget-container\">\n<h3 class=\"elementor-heading-title elementor-size-default\">Enemy AI Attack<\/h3>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-19a4912 elementor-widget elementor-widget-text-editor\" data-id=\"19a4912\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div>Now that we have the chase logic in place, we can create the attack functionality of the enemy.<\/div>\n<div><\/div>\n<div>First we are going to create a new boolean variable and name it Can Attack Player, we are going to use this variable to control the attack logic of the enemy.<\/div>\n<div><\/div>\n<div>Next, in order to detect if the player is in the attack range of the enemy, we are going to create a new Sphere Collision component. Name the new Sphere Collision to Player Attack Collision Detection and in the Details tab set the Sphere Radius to 200:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-ba18ddc elementor-widget elementor-widget-image\" data-id=\"ba18ddc\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 20\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/d7aab5199c2255383efa419d0403074bc2c587101b0180802520a50e3ce70453.jpeg\" alt=\"Img 20\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-a98726e elementor-widget elementor-widget-text-editor\" data-id=\"a98726e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div>For the Event Graph, we need the On Component Begin and End Overlap for the Player Attack Collision Detection:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-3f79a19 elementor-widget elementor-widget-image\" data-id=\"3f79a19\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 21\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/b23fafdd123df5aafcdc99475f55dfbe6cd1927ff93fdfdd98bd6abd00689584.jpeg\" alt=\"Img 21\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-295c468 elementor-widget elementor-widget-text-editor\" data-id=\"295c468\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>The idea is when we detect player collision with the Player Attack Collision Detection component, we will set the Can Attack Player value to true, and when the player exists that collision we will set the value to false:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-ce35728 elementor-widget elementor-widget-image\" data-id=\"ce35728\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 22\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/680c132e1149341cb54aac79e5d2ac3b90c3c2183817e681800f853fb1a81187.jpeg\" alt=\"Img 22\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-cee81af elementor-widget elementor-widget-text-editor\" data-id=\"cee81af\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div>You can copy the nodes from here:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-4d7ba08 elementor-widget elementor-widget-html\" data-id=\"4d7ba08\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n<div class=\"elementor-widget-container\"><iframe src=\"https:\/\/blueprintue.com\/render\/jx7d1ea3\/\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-9b6c869 elementor-widget elementor-widget-text-editor\" data-id=\"9b6c869\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>We also need to make changes in the Move To Player node so that the enemy attacks the player when it gets close to him. First we are going to create a new condition when the AI MoveTo finishes:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-53d740b elementor-widget elementor-widget-image\" data-id=\"53d740b\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 23\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/8f86c41ceaa9124a371aa734765d93227abd3a5ab201d3e44d61bd7b18db1c8a.jpeg\" alt=\"Img 23\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-8f7f11a elementor-widget elementor-widget-text-editor\" data-id=\"8f7f11a\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>When the enemy gets to the player\u2019s location we are going to check if the enemy can attack the player, if that is true we will call Stop Seeking Player because now we need to attack him, if the enemy can\u2019t attack the player, then we will call Seek Player again.<\/p>\n<p>To attack the player, we are going to use the montage animation I\u2019ve prepared which is the enemy\u2019s attack animation:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-35d47e6 elementor-widget elementor-widget-image\" data-id=\"35d47e6\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 24\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/5623d59573fe83d89a53b19c7d2a326038b53b470b67f4f5005d915b718e4e89.jpeg\" alt=\"Img 24\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-4b5b0b1 elementor-widget elementor-widget-text-editor\" data-id=\"4b5b0b1\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>You can copy the nodes from here:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-b097448 elementor-widget elementor-widget-html\" data-id=\"b097448\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n<div class=\"elementor-widget-container\"><iframe src=\"https:\/\/blueprintue.com\/render\/jbq4pz4n\/\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-fd1552a elementor-widget elementor-widget-text-editor\" data-id=\"fd1552a\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>The Play Montage function takes a few parameters that we need to provide. The first one is the Mesh which represents the Skeletal Mesh Component on which the animation will be played.<\/p>\n<p>For that, I provided the Mesh component from the BP_Enemy:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-39d72a5 elementor-widget elementor-widget-image\" data-id=\"39d72a5\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 25\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/1a15629801c348164e1fd9ea33ec03ff09519d6fc93732b111de43702df61b3c.jpeg\" alt=\"Img 25\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-f817577 elementor-widget elementor-widget-text-editor\" data-id=\"f817577\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>For the Montage To Player click on the drop down list and select the Mutant_Attack_Montage:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-53b7530 elementor-widget elementor-widget-image\" data-id=\"53b7530\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 26\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/5802abd6401b97b487f1dff1b6c03582d6193a1f2786565d1dd2cfaea58ee279.jpeg\" alt=\"Img 26\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-cd39b4f elementor-widget elementor-widget-text-editor\" data-id=\"cd39b4f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>When the montage finishes playing, we test if Player Detected is true, if that is the case we will make the enemy move towards the player by calling Seek Player and that will repeat this same process over again.<\/p>\n<p>Compile and save the changes and let\u2019s run the game to test it out:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-4958fd2 elementor-aspect-ratio-169 elementor-widget elementor-widget-video\" data-id=\"4958fd2\" data-element_type=\"widget\" data-settings=\"{\" data-widget_type=\"video.default\">\n<div class=\"elementor-widget-container\">\n<div class=\"elementor-wrapper elementor-fit-aspect-ratio elementor-open-inline\">\n<div class=\"elementor-video\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-a9adbd7 elementor-widget elementor-widget-heading\" data-id=\"a9adbd7\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n<div class=\"elementor-widget-container\">\n<h3 class=\"elementor-heading-title elementor-size-default\">Attaching Collision Components To Sockets<\/h3>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-3afe61e elementor-widget elementor-widget-text-editor\" data-id=\"3afe61e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>Now that we are attacking the player, let us also deal damage. To do this, we need to edit the skeleton of the mutant model. In the Content -&gt; Enemy_Model folder open Mutant_Skeleton in the editor:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-55721b8 elementor-widget elementor-widget-image\" data-id=\"55721b8\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 27\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/959379eb2c7e609c0412074269e4d359825dd933c285de0f7ac7f2d3e1cdf086.jpeg\" alt=\"Img 27\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-3bbbfed elementor-widget elementor-widget-text-editor\" data-id=\"3bbbfed\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>In the options tab on the left side, locate the RightHand in the skeleton hierarchy and Right Click -&gt;Add Socket:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-a60a428 elementor-widget elementor-widget-image\" data-id=\"a60a428\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 28\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/8ebbc3750fd6f74404563144d36b3f6edde926150102a53c81aec6c437bef040.jpeg\" alt=\"Img 28\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-c1a3bca elementor-widget elementor-widget-text-editor\" data-id=\"c1a3bca\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div>This will create a socket on the right arm of the mutant model:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-5552f77 elementor-widget elementor-widget-image\" data-id=\"5552f77\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 29\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/f56cb8ab4f74637fc3d01301fbccd4da47dd2572c178752f26f50044f3e856ba.jpeg\" alt=\"Img 29\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-0c81f7a elementor-widget elementor-widget-text-editor\" data-id=\"0c81f7a\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div>Now we can open the BP_Enemy in the editor, and in the Components tab, select the Mesh component and from the Add Component button filter for Box Collision:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-aae2bcb elementor-widget elementor-widget-image\" data-id=\"aae2bcb\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 30\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/af60c890cd684d743bd6ea3415b19cefc0a4151ce0b003dd696f28ba01e94409.jpeg\" alt=\"Img 30\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-589b519 elementor-widget elementor-widget-text-editor\" data-id=\"589b519\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>Rename the Box to Damage Collision, and in the Details tab under the Sockets settings for the Parent Socket field click on the little loop icon and search for the RightHandSocket which is the name of the socket we created in the Mutant_Skeleton a few moments ago:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-e71cdfc elementor-widget elementor-widget-image\" data-id=\"e71cdfc\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 31\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/25b3086677344e36a7104eeeb11b1dd209a982681e8ecca1044acc2fc715b034.jpeg\" alt=\"Img 31\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-5f58c01 elementor-widget elementor-widget-text-editor\" data-id=\"5f58c01\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div>This will make the Damage Collision component a child of that socket, and we know that socket is connected to the right hand of the mutant model:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-2a60a7f elementor-widget elementor-widget-image\" data-id=\"2a60a7f\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 32\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/ca66a1919f4c9e8f5f3da28b17bf5c266f983fa61b513fe74756f08f851c0be0.jpeg\" alt=\"Img 32\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-2d9bcdc elementor-widget elementor-widget-text-editor\" data-id=\"2d9bcdc\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>This means that the Damage Collision will move along with the right hand of the mutant model. We do need to reposition and resize the Damage Collision component, so set the following values for the location:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-a39255e elementor-widget elementor-widget-image\" data-id=\"a39255e\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 33\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/2fafaa657c529e8514dce8e3602aa860f8f5d6bdfadd764e10e8be162b77bc66.jpeg\" alt=\"Img 33\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-3756b31 elementor-widget elementor-widget-text-editor\" data-id=\"3756b31\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>And the following values for the Box Extent axis under the Shape settings:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-2323a04 elementor-widget elementor-widget-image\" data-id=\"2323a04\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 34\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/ba1f13c5e1b0fcb29d3bb7fb8eb1d4ddd7f448fbc8a10535609a953522d80985.jpeg\" alt=\"Img 34\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-108621b elementor-widget elementor-widget-text-editor\" data-id=\"108621b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>Now the Damage Collision component looks like this:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-6c0c0d9 elementor-widget elementor-widget-image\" data-id=\"6c0c0d9\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 35\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/22a999d730556cf52f89c5e69743e63175d7ba757c0e482bf2277f6db986352e.jpeg\" alt=\"Img 35\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-28b9098 elementor-widget elementor-widget-heading\" data-id=\"28b9098\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n<div class=\"elementor-widget-container\">\n<h3 class=\"elementor-heading-title elementor-size-default\">Animation Notification Events<\/h3>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-0c3c5ea elementor-widget elementor-widget-text-editor\" data-id=\"0c3c5ea\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>The reason why we went through all of this Box collision and socket set up is because we are going to use the attack montage animation to trigger the damage functionality.<\/p>\n<p>If we open the Mutant_Attack_Montage which is located in Content -&gt;Enemy Model folder, and preview the animation we will see that the mutant is attacking with its right hand:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-5156d9c elementor-aspect-ratio-169 elementor-widget elementor-widget-video\" data-id=\"5156d9c\" data-element_type=\"widget\" data-settings=\"{\" data-widget_type=\"video.default\">\n<div class=\"elementor-widget-container\">\n<div class=\"elementor-wrapper elementor-fit-aspect-ratio elementor-open-inline\">\n<div class=\"elementor-video\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-605126c elementor-widget elementor-widget-text-editor\" data-id=\"605126c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>Since we attached the Damage Collision component to the right hand socket, when the attack animation is played and the mutant moves his right hand, the Damage Collision component will move along with it and we can use that to detect the collision with the player actor and deal damage.<\/p>\n<p>To do that we need to add animation notifiers that will notify us when the animation is at a certain frame.<\/p>\n<p>We can do that by dragging the animation preview slider at the desired frame in the animation timeline:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-9692783 elementor-widget elementor-widget-image\" data-id=\"9692783\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 36\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/a15342ac78fccb54a7834f9e9a31293430ec647bf9b7bc6e5c8c24021db3ec48.jpeg\" alt=\"Img 36\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-d17a778 elementor-widget elementor-widget-text-editor\" data-id=\"d17a778\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>Or we can set the exact frame we want on the right side of the Filter search bar in the animation timeline:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-74cf013 elementor-widget elementor-widget-image\" data-id=\"74cf013\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 37\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/f977f2976cffe42fc9025767dcdb5227c170385fe5b4096daf15f6235976294f.jpeg\" alt=\"Img 37\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-b7461ef elementor-widget elementor-widget-text-editor\" data-id=\"b7461ef\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>When we are done with that, on the Notifies timeline, Right Click -&gt; Add Notify -&gt; New Notify and name the new notify Attack Started:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-6487ff4 elementor-aspect-ratio-169 elementor-widget elementor-widget-video\" data-id=\"6487ff4\" data-element_type=\"widget\" data-settings=\"{\" data-widget_type=\"video.default\">\n<div class=\"elementor-widget-container\">\n<div class=\"elementor-wrapper elementor-fit-aspect-ratio elementor-open-inline\">\n<div class=\"elementor-video\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-3e35934 elementor-widget elementor-widget-text-editor\" data-id=\"3e35934\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>We created a new animation notify, or notification, on frame 11, which means when we play the attack animation and when the animation reaches frame 11, the Attack Started notify will be called, and we will be notified in the code when that happens.<\/p>\n<p>We also need to create another notification that will inform us that the animation has ended. Go on frame 30, and create a new notify and name it Attack Ended.<\/p>\n<p>After you finish, you will see two animation notifications in the attack animation timeline:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-3a26b07 elementor-widget elementor-widget-image\" data-id=\"3a26b07\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 38\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/1984e76b0369920bbf6b2e54aacd00599038ca2b5cf6b16201675f5a827494cc.jpeg\" alt=\"Img 38\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-bba9d96 elementor-widget elementor-widget-text-editor\" data-id=\"bba9d96\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>Before we access the notification events in the blueprint editor, we need to go inside the BP_Enemy editor, and under variables create a new boolean variable and name it Can Deal Damage:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-5d86de4 elementor-widget elementor-widget-image\" data-id=\"5d86de4\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 39\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/6b5aee7a3437869461db14b83bd891d2b80890566c933d093253abf59f61bea6.jpeg\" alt=\"Img 39\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-e15dd84 elementor-widget elementor-widget-text-editor\" data-id=\"e15dd84\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>Now open the BP_Enemy_Animation blueprint located in Content -&gt; Enemy_Model folder. In the Event Graph tab, Right Click and search for attack started:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-30aba49 elementor-widget elementor-widget-image\" data-id=\"30aba49\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 40\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/58a87a3d75f600a0ef254d999890de4f34912a5561b889fdcbcc4eec7849b65e.jpeg\" alt=\"Img 40\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-36f5f42 elementor-widget elementor-widget-text-editor\" data-id=\"36f5f42\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>In the same way search for the attack ended anim notify node. We already have a reference to the BP_Enemy in the BP_Enemy_Animation blueprint, so we can use that variable to access the Can Deal Damage bool to change its value when the attack has started and when the attack ends:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-c5273b7 elementor-widget elementor-widget-image\" data-id=\"c5273b7\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 41\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/b75caaa5dcd65beabe9aa0f711f8783dd6a95d58caab865ee0f0962612fe165a.jpeg\" alt=\"Img 41\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-a2c2651 elementor-widget elementor-widget-text-editor\" data-id=\"a2c2651\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>You can copy the nodes from here:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-aae8b55 elementor-widget elementor-widget-html\" data-id=\"aae8b55\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n<div class=\"elementor-widget-container\"><iframe src=\"https:\/\/blueprintue.com\/render\/5e4oe6av\/\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-870d9ef elementor-widget elementor-widget-text-editor\" data-id=\"870d9ef\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>Going back to BP_Enemy blueprint, select the Damage Collision component and in the Details tab under Events, click on the green + button for the On Component Begin Overlap:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-db60b50 elementor-widget elementor-widget-image\" data-id=\"db60b50\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 42\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/fafa28d38b2c352f767a7b6f5bbd8ddf35781b2843401bc6a0cace948959ea29.jpeg\" alt=\"Img 42\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-9e0a426 elementor-widget elementor-widget-text-editor\" data-id=\"9e0a426\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>In the Event Graph tab, for the On Component Begin Overlap of the Damage Collision component, add the following nodes:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-1b6f9fd elementor-widget elementor-widget-image\" data-id=\"1b6f9fd\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n<div class=\"elementor-widget-container\"><img decoding=\"async\" title=\"Img 43\" src=\"https:\/\/glossingdress.com\/lib\/img\/all\/551\/a18c90d400cc3c4e1dad2d8bfa2e926cdd42c92e330cf14f2edf18a03916e08c\/77a647094d48c5b9402e929cb2cde40769242b4879c64bfd27ce93028dd06998.jpeg\" alt=\"Img 43\" \/><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-6233b56 elementor-widget elementor-widget-text-editor\" data-id=\"6233b56\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>You can copy the nodes from here:<\/p>\n<\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-c146a00 elementor-widget elementor-widget-html\" data-id=\"c146a00\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n<div class=\"elementor-widget-container\"><iframe src=\"https:\/\/blueprintue.com\/render\/ebkk9aru\/\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<\/div>\n<div class=\"elementor-element elementor-element-5d3e357 elementor-widget elementor-widget-text-editor\" data-id=\"5d3e357\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<p>When the Damage Collision component detects the collision with the player actor, we are going to check if we can deal damage to the player, if that is true, we will deal damage, or in our case print something to the console hehehe<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/section>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Depending on the type of enemies you have in your game, you will create different AI behavior. And there are multiple ways how to create enemy AI in Unreal Engine, from the basic enemies that move between two points all the way to creating complex AI behavior using Behavior Trees and Blackboards. In this post<\/p>\n","protected":false},"author":1,"featured_media":580,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-435","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/globalgoodplay.com\/index.php?rest_route=\/wp\/v2\/posts\/435"}],"collection":[{"href":"https:\/\/globalgoodplay.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/globalgoodplay.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/globalgoodplay.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/globalgoodplay.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=435"}],"version-history":[{"count":2,"href":"https:\/\/globalgoodplay.com\/index.php?rest_route=\/wp\/v2\/posts\/435\/revisions"}],"predecessor-version":[{"id":581,"href":"https:\/\/globalgoodplay.com\/index.php?rest_route=\/wp\/v2\/posts\/435\/revisions\/581"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/globalgoodplay.com\/index.php?rest_route=\/wp\/v2\/media\/580"}],"wp:attachment":[{"href":"https:\/\/globalgoodplay.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/globalgoodplay.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/globalgoodplay.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}