how to handle multi-attack animations with cooldown in behavior tree

i have 3 attack animations, each planed to have different cooldown time, when all attack is in cooldown, the ai will go to defend mode, like strafing around player, hiding things.

i can create 3 sequence before defend, thus, the ai will attack with any available attack branch. this has no problem.

but i want the ai start attack immediately when any cooldown is done. that means any attack branch must abort the defend branch whenever it is ready.

but all attack branches can not abort each other, all attacks much be executed without any interrupt.

i just could not design a branch tree to handle this situation, anyone could help?

I tried your BT layout

Your current flow executes in this order:

Attack1 => is triggered (cooldown starts)
Attack2 => is triggered (cooldown starts)
Attack3 => is triggered (cooldown starts)
Defend => is triggered repeatedly until any of the attack cooldowns are ready again

I made a simple version of Ensure attack state that always returns true for “Perform Condition Check AI”, I only omitted the “set focus” & “clear focus” part as it didn’t seem needed for the flow.

Are your nodes positioned correctly? They might not set the lower priority correctly.
If you select the middle attack is the one to the right and defend set to blue or is attack to the left also encompassed in the cancel? Try making them on the same level (height)

yeah, i know they are working in this order. but what i need is whenever any attack is ready, it will interrupt the defend state immediately. since cooldown only has lower priority, so any ready attack will interrupt any executing attack and defend, only the last attack is in the right logic, but it will be interrupted by the first and the second sooner or later.

to be clearly, i need any attack state interrupt defend state only, do not bother any other attack state.

but the bt now, they will interrupt the lower priority attack sooner or latter, the logic is doomed for this situation to be happened.