No one? I also attempted to swap the background task logic with the main task logic and create a task for the loop instead. However, it seems that the loop inside the task executes the completed and just one loop once for some reason.
It is expected that the task executes only once because there isn’t actually anything that triggers it continuously. Instead of plugging your code after the Event Receive Execute AI node, you can call a custom event after that, and make that event execute the rest of your code. Keep the conditions to call that event in the Event Receive Execute AI node and if they are met, call that again. Or you can just call that again once it’s done with no extra conditions if you want (while making sure you’re not calling it while it’s still running) but plug in a Finish Execute node at the end of the execution chain that the custom event triggers. That would trigger your task continuously if the other side of your parallel node doesn’t get triggered.
In the BTTask_QueenBee_Loop_Attack (as you suggested), I added a Set Timer By Event node to execute the custom event as many times as needed.
In the Behavior Tree, as background tasks, I added a Selector, one for the melee attack and the other for wandering.
Since every time the queen bee used the melee attack and the flow moved back to the wandering task, the service BTService_RandomLocation was triggered, causing a new position to be returned before the last one was completed (changing the position every time a melee attack was executed), so I added the BTTask_MoveAndWait task inside the reset sequence.
Lastly, because the reset sequence is a child of the melee phase, when the player was moving within range, the melee was no longer triggered until the wandering task was finished. To fix this, I added the same decorator from the parent, set “Inverse Condition,” and set Observer Aborts to Self.