I’m not sure if I understood you correctly, but I managed to make it work. Thanks!
BTTask_QueenBee_Loop_Attack:
Behaviour tree:
BTTask_MoveAndWait:
I made the following changes:
- 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.
After that this is the result
Thank you again for the suggestion!
I hope this will help someone in the future.