How could I make a decorator that runs its child task every specified number of frames?

knipsch

New member
I'm pretty new to using Behavior Designer and I'm sure there are ways to get this functionality without making a decorator that does it, but it just seems like it would be such a useful and efficient decorator, and I like making myself tools that speed up development. I tried making a decorator that runs every specified number of frames, but because it only runs OnChildExecuted and not OnUpdate, I can't figure out how to execute the child repeatedly and selectively based on the frame count since last execution. Does a node for this exist somewhere already? If not, is there a way I can get this working?
 
This sounds similar to the Cooldown task, but different. Cooldown works based on a time but it'd be trivial to switch that to frames (though you'd have to account for framerate so I recommend using seconds instead).

With that said, I'm not sure if Cooldown is exactly the same as what you are going for. What task should run if the tree is outside of the interval? At least one leaf task must always be running, and since a decorator can only have a single child how do you plan on accounting for this? This almost sounds like it could be a composite type of task.
 
Thank you for your fast reply! Yes, I think you're right; since once leaf task must always be running, it would make sense to use a composite with an idle task or comparable for the frames when the first task isn't running. I'll try that; thanks again!

I'm really loving Behavior Designer, by the way. It's so powerful, but has been fairly easy to learn, which is great.
 
Top