Download

Make AI receive key input if within radius

So far I have a relatively simple AI controller blueprint that runs a behavior tree. With my current setup, when F is pressed, it sets a bool to True which allows the AI to follow the player within a certain radius. However, the problem is that when F is pressed within the radius of one AI, other instances of that AI in my world immediately start following when I enter their radius. How do I make it so that each AI only responds to the F key press when I am within that particular instance’s set radius? I want to have to press F each time a different AI instance is going to follow me, rather than only pressing F once to activate all of them. Here is a pic of my current AI controller blueprint:

I am not an expert on AI but I would recommend you to change they way it works. Make the F Button event in your character blueprint, and use “Get all actors of class” to get all AI pawns. Then find the closest pawn and make it follow you.