Download

Problem with creating a combo attack with montage

I’m trying to create a combo system in which the character does a series of attack animations one after another , each triggered by pressing attack key at the right duration of time .
just for testing purposes i have made a 3 consecutive attacks and the duration of each attack is about 1.5 seconds . 1 second is the actuall attack animation and 0.5 second is the rest time in which the player should press the attack button again in order for the combo to continue and if not , combo will stop and character will return to idle animation .

So i have made my AnimMontage , and made sections for the each animation , added branch where i want to check if the player is going to press the attack key again .
my montage looks like this :

Here comes my question , now in the event graph , i want to check if attack key is pressed " anytime " within start of the branch point till the end of that section to perform the next attack , from my understanding , when playhead reaches branch point it triggers and event or perform a check etc .
How can i make it continually check if a key is pressed from where the playhead reaches branch point till the end of that section ?
in this pic, the areas i want to perform a continuous check is shown with red. thanks

Here’s how I do it:

I have an event from my attack input go to a “Get Montage Current Section”, and then to a “Switch on Name” fed by the current montage section.

I remove the default pin, and then add a pin for each montage section.

To do this, REMOVE the branch points in your Anim Montage and replace them with section names (e.g. Have Atk_One and Atk_One_Waiting as two sections, with the first feeding the second).

Then in your switch, ONLY have execution pins for Atk_One_Waiting, Atk_Two_Waiting, etc., and send them to the set/jump to for the next attack.

The end result is the melee input will get the current montage section, and if it’s at a “wait” point, go to the appropriate next section, and if not, do nothing.

The attached pic is a snippet of my combo system. Note that in mine, pressing attack during the attack will queue the next attack, BUT pressing attack after waiting long enough to reach the “wait” phase jumps to an alternate attack. Your system would do the same thing, except without queueing up the next attack when you press too early.

Thanks for the reply , it seems very efficient , i’ll give it a try soon .

While we are at it , let me address another issue :

Each time the character does an attack in the combo chain , the position resets . i mean , in the first attack the character takes an step forward , but when it starts to do the second attack in the combo chain , it goes back to where it started the the first animation and does the second one .
how can i fix this so the second attack starts at where first attack ends ? ( this relates to root motion i assume ?! )

Yes, it’s root motion. If you enable “root motion translation”, the engine will zero out all root movement in the animation and then apply that movement to the player capsule instead. This has the effect of making anims not restart since the new anim is triggered from wherever the last one left you (it also keeps your attacks from shoving you outside your collision capsule).

I just gave " RhythmScript "'s setup a go , and with some trial and error , it now works wonderful . thanks

But the root motion problem still remains the same . i activated the " Enable Root Motion Translation " check box for my combo Montage , but it still remains the same. it resets position when the animation playing in the montage changes . btw in my characterBlueprint , Capsule Component is the root , and my character mesh is a child of it , just like “3rd person blueprint” content example .

Any other thing that i should do other than enabling root motion check box to fix this ?

Then you aren’t ACTUALLY animating your root bone.

Just a shot in the dark, are you making your anims in Blender?

Blender adds an “armature” bone at the bottom of the bone hierarchy on export, which means the “root” bone (bone at zero in the hierarchy) isn’t the root bone as you see it in Blender.

You can fix this by
(a) moving all your root’s locrot keyframes OFF the root bone and onto the armature object (in object mode, NOT pose mode)
and
(b) selecting all those object keyframes and in the animation editor view, selecting them all in the curve editor and pressing S, Y (to scale them along the value axis while keeping them locked on the time axis), and then typing the scale number of the skeleton (i.e. If you’re scaling your stuff by 12 on export, select all the object root keyframes and press S, Y, 12). This is because the root motion isn’t scaled along with the object.

Note that in Blender this will basically break your anim (everything will be an exploded mess), so don’t save it that way, but the exported FBX will be fixed on import.

If you aren’t using Blender I can’t help you, I’m sure for every software there’s half a dozen ways to accidentally animate a non-root bone and think it’s a root.

I’m using maya for most of my work , but atleast now i’ve got an idea on what is causing this . Thanks for the help man , appreciated .