Multiple bool comparisons in Abort Type Lower Priority

gumboots

Member
Hi there,

I use a number of bool comparisons at the beginning of sequences with their Abort Type set to Lower Priority. These values are constantly reevaluated, and if they change then that branch interrupts a lower branch, it works great! However I need to test multiple booleans in one branch ("Can I see a player?" OR "Am I running away from a player?"), and I can't seem to get it to work. It interrupts the current branch when the first value changes.

Basically if "Can I see a player?" is true, I say "Run away from the player." When this starts, the AI looks away from the player, and so the reevaluation of "Can I see a player?" fails. I want to add an "OR, Am I running away from a player?" I tried adding both of these to a Selector with a Lower Priority Abort Type, but as soon as the first tested value changes ("Can I see a player?"), the "Run away from the player" Action is interrupted, despite what the value of "Am I running away from the player?" is. Where I want to remain in the current task if EITHER of the tested values is true.

Is there a way to achieve this? Here's an image to help illustrate the issue:

5cVsrq6.png
 
Right now the only way this is possible is to create a single task that checks both bool values. Having this type of abort has been on my list for awhile and now that version 2 of our character controllers are starting to slow down I've been working on BD updates off and on. I'm not sure if I'll be able to get this in version 1.6 but I'll try :)
 
So, I made a task to handle this, using a custom class to hold the SharedBool and its compare value. However each SharedBool is always returning false. This is in a referenced Behavior Tree, perhaps the custom class is capturing the SharedBool before it receives the mapping from the parent tree?:

https://hastebin.com/sobunecici.cs

I can get around it by having two arrays, one for Variables and one for Values, and then iterate through them in a for loop, but it's much messier to manage. Can you think a way around the SharedBools always returning false?
 
When you set the SingleBoolComparison can you get the instance ID of the bool that you are setting and compare it to the instance ID of the bool that you are comparing within OnUpdate? My bet is that the two objects are different.
 
Hmm I can't seem to figure out how to get the instance ID when I set it, as if I change it to a property it can't be assigned in the editor.
 
Top