BD Pro ECS: How to Handle Enableable Component Cleanup on Conditional Abort

Stroopwafel

New member
Im using BD Pro for NPC ai behaviour in a (near) full ECS project and I have a design question:

Lets say there is a behaviour tree with some sequences in a line. The last sequence triggers an animation state (in this case idle, but it doesnt really matter for the purpose of this question) and sets an Enableable component of the NPC to true. Then a system can query on that enableable component and performs the logic.

Now this works all fine, untill there is a conditional abort happening earlier in the line. Because at that point the enableable component is still true, even tho were in a different part of the tree.

My first solution was to add an action just after the conditional node to 'reset' all states, which would probably work, but to me it feels like 'dirty' code as you'd have to maintain this every time you add a new state somewhere else in the tree.

Is there maybe a "OnConditionalAbortHappened()" method in a composite that you can hook into perhaps?

How would you solve this or is there a better design to achieve the same?
 

Attachments

  • Untitled.png
    Untitled.png
    53.7 KB · Views: 2
For this you can use the On Interrupt callback, take a look at the bottom of this page:

 
Back
Top