Behavior Trees: Run cleanup/resetting tasks even on abort?

For example, i want to make a branch that gets executed when an enemy hears a combat sound. What should happen is that he starts running, then uses MoveTo to go the the sound’s location and then stops running.

So basically (pseudocode): Sequence(SetRunning(true), MoveTo(SoundLocation), SetRunning(false));

Problem is, how can i make sure that he also stops running when the branch gets aborted during the MoveTo?

I could implement my own version of MoveTo and use the On Receive Abort event. Is that how one would generally do it?

Another solution i thought of what this: use a Simple Parallel branch, run the MoveTo as the main task and make a Running task that starts running on Receive Execute and stops on Receive Abort, but never stops unless aborted.

For testing i made this:

It seems to work. What do you think of that solution?

Anyone know a better way? :slight_smile:

edit: okay, making it a service and using Activation and Deactivation seems better. Would that be the way to go?