I’m trying to make a decorator that uses and OR Boolean function, so that if either of the blackboard keys are set True, then it will fire through the Sequence Node.
Working on an AI with:
Sight detection meter: will search target location while the meter is filling, chases player when it’s full.
IsAlert is set true while meter is full or filling.
Distract by Noise: will go to target location and search for one run through of sequence
IsInvestigating is set true until Sequence completes.
I’m struggling with making a functional decorator node that will do the best of both worlds, but if I have to just make another branch off the tree, then that seems like the easier, more messy, route.
Hi @jbs2013, I know this answer comes much too late, but I’ll post it anyway in case anyone else finds it useful. Please note, this will only be useful if your project is a C++ project.
My approach was to create a base class for all my decorator nodes that wrapped the CalculateRawConditionValue method in a publicly accessible function. Then I created a custom Conditional OR Decorator which would allow the user to specify an array of decorators inheriting from my custom base class (wrapped in a struct to allow for evaluation inversion and setting custom properties). The OR decorator then loops though the provided decorators and runs the publicly accessible function which internally calls the CalculateRawConditionValue method and returns the result. As soon an any decorator returns true, we return true in the OR decorator. If we get to the end without returning true, we return false.
This is a fairly generalized rundown of the approach. If anyone is interested in more details, feel free to reach out.