When designing a behaviour tree that controls an agent, is it possible to construct the tree so that the agent first attempts task A, then depending on whether task A succeeds it attempts either task B or task C? That is, if A succeeds, the agent attempts task B, otherwise it attempts task C? Kind of like the ternary conditional operator?
The following may at first glance seem to work:
* Selector | +---* Sequence | | | +---* A | | | +---* B | +---* C
Selector(Sequence(A, B), C). However, if A succeeds and B fails, the sequence will still fail and C will be attempted (which it shouldn't since A succeeded).
This tree does run B if A succeeds and C if A fails and never runs both B and C:
* Selector | +---* Sequence | | | +---* A | | | +---* B | +---* Sequence | +---* Inverter | | | +---* A | +---* C
Selector(Sequence(A, B), Sequence(Inverter(A), C)). This is assuming that A yields the same result both times (oterwise either none of B and C will be attempted, or both will be attempted). However, this has the issue that will be attempted A twice if either either A or B fails.
What I want to achieve could be pseudo-coded like
A ? B : C or like
B if A else C. Can this be achieved with a behaviour tree?