Why wont this blackboard based condition ever move on?

Okay so I have a behavior tree that moves to player then should attack based on what name variable I set from my enemy specific blueprint. The problem is the melee condition is the only one that ever works. Even though I have the enemy bp set the variable enemy type to range it still never runs any condition & gets stuck trying to run the first blackboard based condition. what am I doing wrong here/ pls help!


Should I just make separate AI controllers and behavior trees for each type of enemy? Is there any way to avoid that?

Selector is what you’re looking for here, not a Sequence. Sequences go through each node until they fail, Selectors go through each node until they succeed.

3 Likes

Hey @KiloLime, @eblade is correct!

You need a Selector so you can choose 1 thing from the four options. Keep in mind it will always move left to right, and with a selector when one succeeds it will go down from there, not proceeding right.

As an aside: you may need to change your “MoveTo” on the [Range] enemy as well, it’s set to move to “SelfActor” :slight_smile:

Here’s some documentation if we’re not quite making sense:

2 Likes

that’s just to make it stop after it runs the first part of moving to the player until it sees them. Is there a better way to make AI stop movement? That just seemed like a simple fix lol. Thanks for the help

@KiloLime Yeah! You can probably remove it. Unless an AI can be both [Melee] and [Ranged]. Because if the AI is [Ranged] it won’t do anything in the [Melee] path at all. Unless you have a moveTo above the pictured behaviors.

But one thing you can do is set the MoveTo acceptable radius to a larger number (50 means stop 5 meters from the goal) and another thing is you can put a decorator on the node checking for blackboard variable → “PlayerActorOrWhatever”, and if set->Abort. That way IF playerActorOrWhatever is SET through seeing the player, it’ll abort and it can’t be run again until it is UN-SET.