Adding the Enemy AI
Let's go back to Unreal Engine and focus on Content Browser. We now need an opponent. To add this, follow these steps:
- Right-click and select Blueprint.
- At the lower end of the window, let's drop all the classes and search for AIController.
- Select AIController under Controller and hit Select in the lower-right corner.
- We will name this AIController
Enemy
. - Open
Enemy
AIController and go to the EventGraph section.
First, we must find Hero and then store it in a local variable to be used at any time. To do so, follow these steps:
- Right-click in an empty area within EventGraph and search for Event Begin Play.
- Pull from the exec pin and search for Get All Actors Of Class.
- Set the Actor Class pin to Hero.
- Pull from the Out Actors array and ...
Get Unreal Engine 4 AI Programming Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.