How to make an action perform only after an animation has run?

by Boneco Sinforoso   Last Updated September 18, 2019 01:13 AM

I have an actor who has some animations. Animations perform based on some actor states (animation blueprint of actor):

enter image description here

Conditions at the Event Tick (similar to while loop):

enter image description here

The actor changes perfectly from animation to animation. What I'd like to do is for it to damage an enemy as soon as the attack animation is over.

I tried some codes...

In this one, for example:

enter image description here

This variable (minionAtk) modifies the state of the actor. See the image below in the event (which is only called when the minionAtk is true) that I can successfully change the state of the actor (to the attacking state):

enter image description here

Animation Blueprint:

enter image description here

Transition:

enter image description here

But since the change from true to false is done instantly, the attack animation is not even shown.

To solve this, I put a delay and a condition so that the event could not be called again while the execution of cycle (attack animation => end attack animation) ended:

enter image description here

So when the actor is in the attacking state, the attack animation usually performs. After 5 seconds the animation stops.

It turns out that in this time interval the animation does not play only once.

I imagine there is a way to do the time calculation that the animation lasts, and based on that set the delay time.

But better than that, I wondered if there was no way to know when the animation was finished and from that, change the variable to false and perform the damage action.

Thinking about it I researched and found this:

https://answers.unrealengine.com/questions/329698/animation-damage.html

But I came across this error:

This blueprint (self) is not a BTTask_BlueprintBase, therefore ' Target ' must have a connection.

Error link:

https://answers.unrealengine.com/questions/549437/error-this-blueprint-self-is-not-a-therefore-self.html

I also saw something about sphere traces, attached to an actor socket. But in my case I don't want to apply the damage just in case of contact of the actor's arm (armed or unarmed) to the target, it would be something as seen in MOBA style games.

It would be like a basic attack from Garen/Yasuo/Darius.



Related Questions


Updated April 13, 2016 08:05 AM

Updated November 30, 2018 21:13 PM

Updated June 10, 2019 18:13 PM

Updated October 19, 2017 06:13 AM

Updated February 21, 2017 10:13 AM