Download

AI Follow on Command Question

I’m having a bit on an issue with my AI blueprint. In order to get them to follow the player controller is quite easy when using the following simple blueprint:

AOlWS7D.png

My question is, how could I change this blueprint to make it so that the AI would only walk towards me when holding down an action key such as “E”? I tried to connect “E” Pressed blueprint to the Simple Move node, but it did not have any effect.

Thanks.

Use gate between tick and move to actor. Pressed E will open it and released E will close.

Gates are a good start but you’ll need to replace them if your AI has lots of different states that are mutually exclusive (Idle, Following Player, Move to Attack, Attack, etc) then it’s a good idea to create a custom Enum called State that lists all state types.

In Blueprints you can then switch between these and after the Event Tick check the current state and do what the required behaviour from there.

It’s also good to have a radius check between the AI and the Player so that if the AI is within a certain radius it will not keep attempting to follow the player.