State transition

This concludes what is necessary for our transition out of state 1. Next, we will do what is required for state 2, and this will allow us to detect the changes necessary to exit this state back to state 0 once we no longer see the enemy. Perform the following steps:

  1. Going back to the switch node on State, which we created earlier (in Step 55) and creating a new connection from 2, let's create GetAiController.
  2. Next, we need to check whether our Enemy Actor variable is valid. We will do this by dropping out the Enemy Actor variable, pulling from the pin, and then creating the IsValid node.
  3. If the variable is valid, we want to move our AIController toward our enemy. We can do this by pulling from Return Value on GetAiController 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.