I am working on a behavior for my AI. I want it to patrol an area for some time, automatically turning around if it collides with another character. This is the current tree I have:
The tree works as expected, except for one problem.
The action “Set Facing to $new_direction” only runs once.
I expected that if the conditional “If Collided With Character” is true, the following action will always be executed. However, the action is never re-executed if it already ran (successfully or unsuccessfully). If I end the task with EndAction(null), it will not change the status of the action and thus allow it to be re-executed. This is not what I expected and seems incorrect.
What am I misunderstanding about this BT graph? Is there a better way to structure this?
Please use EndAction(true) or EndAction(false) ( or simply EndAction() ) in your custom action tasks code. An action task has to finish in either Success or Failure so that it gets reset and is able to run again. Does it work if you do?