Hey, if there are any GAS experts (or just knowledgeable on the topic) I could use some help or advice in my quest to create combo attacks (eventually for multiple weapon types as well). So in my project I have A class named “InventoryAbility” - which as the name suggests, is abilities granted to the character by equipped inventory items. In our weapon item class we have all the various necessities, like static or skeletal mesh, effects, sounds and an array for our Combo Attacks.
I’m just not certain whether I’m going about this correctly… This is what my thought’s were intially:
Intended functionality of combo attacks:
- Ability Activation: When the player presses the attack button, the ActivateAbility function is called. This function starts the combo by setting CurrentCombo to 0 and calling PlayNextMontage.
- Playing Montages: The PlayNextMontage function plays the next animation in the combo. It does this by getting the CurrentCombo index of the ComboAttacks array, which contains the animation montages for the combo. It then plays this montage on the character’s animation instance.
- Combo Timing: After playing a montage, PlayNextMontage starts a timer with a duration of MaxComboTime. If the player presses the attack button again before this timer expires, ActivateAbility is called again, which increments CurrentCombo and calls PlayNextMontage to play the next montage in the combo. If the timer expires before the player presses the attack button again, the ResetCombo function is called, which resets CurrentCombo to 0, effectively resetting the combo.
- Ending the Combo: The combo ends in one of two ways. If the player completes the combo by pressing the attack button enough times to play all the montages in ComboAttacks, PlayNextMontage calls EndAbility to end the ability. If the player fails to press the attack button before the MaxComboTime timer expires, the ResetCombo function is called, which also ends the ability.
- Ability Ending: The EndAbility function is responsible for cleaning up when the ability ends. It cancels the combo timer and calls the superclass’s EndAbility function.
This is the basic flow of the combo system as I understand it. The player initiates the combo by pressing the attack button, then continues the combo by pressing the attack button again within a certain time limit. The combo ends either when the player completes the combo or fails to continue it in time.
The thing is, with all my debugging it seems that there can only be one instance of the ability at a time, and trying to “trigger” each attack montage will never work using this method, so how is this typically done?
If anyone can help, DM me and I can give you the URL to my GIT repo for additional context.