How do I make an AI ignore an object if there is already an AI on that object?

How do I tell my AI to move to another object of the same class if there is already an AI inside the collision BOX of the target class?

In this example that I’m showing, I’ve already created a boolean that checks if there is an AI in the object in question through a box collision and if any AI enters the Box it changes the boolean to true, but in the AI I don’t know how to put this to happen some AI inside the collision box, the other AI looks for another object of the same class.

I don’t know if it’s clear what I want to do but currently it’s like this: and I want them to go to a tree each:

Is it all your blueprints related to AI Behavior?
It should be easy to achieve what you want with basic AI things like Tasks, Decorators and Services.
AI behaves like on the video because you use node AI MoveTo only at the BeginPlay. On EventTick you only check your bool value but after that you do nothing. As I said it would be better to do it with proper AI Behavior Tree.
As a quick fix I suggest adding bool check to “PegarMadeira” Event after GetActorOfClass. If it is taken → Try again
If not → AI MoveTo
But I don’t think it is the best solution. Nice idea would be to store free trees in some kind of array (e.g. at GameInstance BP) and don’t use GetActorOfClass Node.