AnimNotifyState: Execute every X seconds while state is active

I’m still trying to learn UE, so I might have some misconceptions :slight_smile:
What I’m currently trying to do seemed quite simple to me - I want to execute a function (applying damage) every X seconds from inside an AnimNotifyState. So I could just mark a part of my animation during which damage is applied continuously.

So far I failed miserably… Here’s what I tried (and what went wrong):

1.) I tried to use SetTimerByFunctionName in RecievedNotify_Begin and clear it later in RecievedNotify_End - This failed without any error, my function just wasn’t executed and I don’t know why.
2.) Since the call by functionName seemed a bit fishy to me from the start, I tried SetTimerByEvent - this failed because I couldn’t figure out how to define an custom event inside an AnimNotifyState-Blueprint. I figure that just isn’t possible?
3.) So I decided to try the low road and calculate it myself in RecievedNotify_Tick, storing the Delta-Time and calling the function once enough time was accumulated - this failed because local variables are not taken over to the next call of tick and it isn’t allowed to set other variables so I couldn’t keep track of how much time passed since the last function-call.

And now I’m out of ideas. So could anybody please help me with some tipps how to set this up correctly without running into another roadblock?

1 Like

Hi GedInixan,

You can add Notifies for “begin damage” and “end damage”, then from the AnimationBluePrint Event Graph in the “Event Blueprint Update Animation” you could add the damage multiplied by “Delta Time X” from that event.

1 Like

Thank you for your suggestion. I don’t really like it and would’ve preferred to do it completely inside AnimNotifyState because it somehow seems cleaner to me, but if it can’t be done I’ll have to delegate it to the AnimBluePrint or even the CharacterBluePrint. I’ll figure something out :slight_smile:

1 Like