How to do combo input with multiple branches? X + X + X, is all fine, but I'm confused with X+ Y + X

Hi there! :slight_smile:

I am trying to figure out how to do a branch combo input . Currently I have a simple 3 combo animation montages playing when the player pressed the X input key 3 times in the right timing. I’m using integer variable to calculate the amount of X being press, so first X (integer variable = 1) - plays anim montage kick 1, and within that if second X (integer variable = 2 ) is being pressed, plays anim montage kick 2, so on and so forth.

The question I have is what if I’m trying to do X + X+ Y, or X + Y + X + Y instead, the integer count doesnt work anymore as that only counts the number of X presses and not branches of Y presses.

If you’re curious about my current blueprint set up, I followed the system presented by a tutorial here

basically its just a simple integer count. However, X + Y + Y or X+ Y all require more than a simple integer count… Do I have to multiple branches in each combos?

Thank you in advance!!

Hi,

It would be really helpful if you could upload a screenshot of your relevant Bluerpints. It is hard to tell what’s the issue without looking at your implementation.

Hi,

i did not follow the tutorial so i dont know how it is planned.
But this was done in one of the unreal live streams about state machines. I think it was the third one. Not sure if it is completed yet.

Regards

I would not use that, it’s not scalable
I made up the pic below.
It’s not the full code, but I can explain parts of it.
c456daf7c578dada1dccea04e680ac23a59a0ba1.jpeg

The “name array” is a name array that holds the names of montage sections.
I use an int “index” that has a length of the “name array”.
I increment the array after every button click and play the montage section that’s assigned to that element.
In the branch, I check if the index is greater than the length of array and if so loop back to zero.(not shown)

Why do this? So, all I have to do is add, subtract and re order the “name array” variable and it will work as expected.

Bug: the array does go over the length before looping back to zero, I have to work on that. :smiley:

Arrays are indexed from 0, so the first element is 0, second 1, etc. The last index of an array is equal to Length-1.

In this case, simply check every time that your Index is not greater than Length-1, and if it’s not, simply use Index in the ‘Get’ node (or you can keep the Clamp, but use Length-1).

Hey thanks for sharing your work flow! This is interesting method! it’s a little over my head so bear with me .

Assuming your branch is fired off when a button is being pressed, how would you detect if another button is pressed in the chain combo that will play another animation? what if there are a 3rd button that you need the player to press for the super ultimate smash move? like X + X + Y + Z. From what I’ve seen the index is always going to be at increment + 1

Thanks :slight_smile:

Hey thank you! I’ll post a screenshot when I get home from work :slight_smile:

Oh awesome, I’ll definitely try to find this if they have it :slight_smile:

That’s the part that I don’t have the screenshot for.
I use (skeletal) mesh (component)->anim montage is playing->branch=false: anim montage is playing checks whether a montage is already playing and I only run when it’s null.