Conditional abort without failing current branch?

bbjones

Member
I know what logic I want to have happen, just having some trouble getting it implemented in BD.

Goal:
  • Colony Sim-like worker behaviour (eg. harvest mushrooms)
  • Start goes to workplace (transform)
  • Then repeat "do work" branch
    1. Find next resource target (transform)
    2. Goto next target
    3. Gather resource

During step 1 above, a conditional abort can be triggered if there is no "next resource" to be found, then worker returns to job location.
During step 3 above, worker's inventory may become full which triggers the same return to job location to unload inventory.

One problem I have is when the conditional abort happens, it fails the current repeater "do work" branch which I can't figure out how to resume.

The Utility Selector almost seems like a better fit, where I can then control which branch should be executing (do work, or unload inventory, or idle), but I have no use for the changing priority curve or limited wait time.

Right now I'm just restarting the entire BT with reset variables to force the "do work" back into an active state.

Maybe I should be looking at events? Or write a custom Utility selector implementation?

Thanks

1633477455209.png
 
When you want to have more control over when an interrupt happens I recommend using the interrupt/perform interruption tasks. This will allow you to have complete control over the timing of the abort. I believe that it is the RTS sample project that has an example of these tasks.
 
Got it working mostly good enough for now, thanks!

I wasn't having any trouble controlling when to trigger the conditional aborts/interrupts, I had issues trying to resume what was interrupted.

I didn't see anything in the RTS example about interrupts, and I did look into them but they didn't seem to solve my problem.

The main issue seems to be how I was using the sequence and repeater. I went back to look at the UCC integration demo (the big one with the AI agent patrolling etc) and went with that style, where it's more about a large repeating sequence of priorities overriding each other from left to right.

This is my tree now which is mainly doing what I need although I have lots to refine and clean up etc.
1633537723628.png
 
Top