I’ve made my AI character to jump and right after the jump phase the stones rain down from the ceiling. However, when my AI character jumps the jump task executes twice in a row, same with spawnstones task.
So when the character has jumped, but is not on ground, the conditional loop runs until the condition is true and the stones fall down, so the loop will start over again. I am still not aware why the jump and summonstones tasks run two times in a row. (I know the last node should fail in order to be correctly set up, but at the moment it's the last node of that branch, so (I think?) it doesn't matter.
As UBehaviorTreeComponent’s function StartTree checks whether tree isn’t already running, it starts the tree
void UBehaviorTreeComponent::StartTree(UBehaviorTree& Asset, EBTExecutionMode::Type ExecuteMode /*= EBTExecutionMode::Looped*/)
{
// clear instance stack, start should always run new tree from root
UBehaviorTree* CurrentRoot = GetRootTree();
if (CurrentRoot == &Asset && TreeHasBeenStarted())
{
UE_VLOG(GetOwner(), LogBehaviorTree, Log, TEXT("Skipping behavior start request - it's already running"));
return;
}
// irrelevant at the moment
As AAIController's function RunBehaviorTree doesn't check that, behavior tree will run behavior tree once more, which makes me question which of these functions should I use to initalize the behaviortree.