Set boolean to true and back to false for Animation Blueprint

In my character AI i have a function “GoToLocation” and it’s called every tick in player controller using Gate (to allow steering with pressed, not released mouse button) In this function i want to set boolean “playerStartedRunning” to true, because players’ Animation Blueprint needs to read this and play “runningStart” animation when it’s true. But it needs to be true only once, to play this animation once. I’ve thought about setting it true → Delay 0.01s → set to false. But Delay node is not availabe in functions :frowning:

Previously, to “send a message” only once to anim blueprint, i’ve used Event Dispatchers and assign them in Animation Blueprint, but using Event Dispatchers with Animation Blueprint broke my whole project (good that i’ve made a backups) So i need to do it in different way.

Shortcut: Every time player starts to run, i want to set “startedRunning” to true and then immediately to false, because animation blueprint needs to play animation only once, at beginning of running. How to do it? Maybe is there some better solution?

I don’t know if it answer your question. but are you doin it using behaviour tree? If that the case maybe you can just set a blackboard variable with a task node before you play that move to location task . n read it in your code.

No, when i started, Behaviour Tree was so bugged that i’ve decided to do AI logic in class blueprint. Well, i’ll check if i can remake it to use behaviour tree and if it will help.

Hm, you could use a Animation Notifier on your StartRunning animation that sets the bool to false.

Or you rethink this whole setup. You can simply make a blend space to blend between the start animation and the walk/run animation. Normaly you won’t even have a “StartRunning” animation. You will just blend between idle/walk/run with a blendspace.

But if you really want to use it this way, then you can try using something like “DoOnce” function before you start your AnimationMontage and reset it as soon as the player stands still. So it can call the montage only once.

This Animation Notifier idea is good, i think it will do the job! :slight_smile: Thanks!

btw. In my case “startRunning” animation is required to have unique startup for player, blending is not enough :slight_smile: The same way i have “braking” animation that is played when player is close to his goal.

Was looking for the same thing! :slight_smile: Notify start and end to change bool to stop movement / aim. Great and easy way to fix this!