Repeated Gameplay Ability does not end

I implemented GAS and for the attack-related abilities I also overlaid my own custom-made ‘MeleeCombo’ system (via a Component). What I do is, I execute (/activate) a melee attack ability, and then at the right time during the animation I can trigger a second. I have debugged this, and I notice that the first one NEVER ends! I would have thought, that when the second melee attack ability triggers, its PlayAnimationAndWait gameplay task would interrupt the first montage playing. Yet any pin I take out of the ‘OnInterrupted’ executable on the node does not fire. Do I need to do this on ‘BlendOut’ perhaps? Current implementation is such that I cannot use the onBlendOut pin. I would have thought Interrupted pin is what I need, because the second animation request (via the task) interrupts the first one.
Do I need to manually and explicitly end/cancel the first ability when I trigger the second? It would be instances of the same one (or different ones) but in general how do I keep track of which ones are instantiated earlier? Is there some way to kill all ‘active’ abilities?

Thanks.

Hello there :wave:

I would suggest you take a look at Gameplay Tags.
From what I understand you could either:

  1. Add a Tag for different stages of the ability and at the point where you want to cancel the first ability call “cancel abilities with tag” and use the tag you set for the first stage.
  2. Add a specific “cancellation” Tag for the first stage and add that to the ability system once you want to cancel it.

I think both options should automatically lead to the “OnInterrupted” being called from the animation.

If you want to dig in a little further here is a video showcasing an ability queue system used in mortal shell.

Hope this helps!

Greetings,
Markus
Bagpack Games

2 Likes

Thank you kind sir. I will try your idea and see if it works… I am already using tags obviously but hadn’t thought of this trick of adding tags dynamically during gameplay in order to identify abilities I want to end/cancel or otherwise manipulate in some way.

Ok, turns out you were on the right track, but the solution ended up being much simpler. I just added the Ability’s own tag to the CancelAbilitiesWithTags section as well, so any instanced ability would cancel out any instances of its type when executing, thus never having more than two running at the same time. Which is fine for my combo system, attacks follow one another, and melee attacks are not meant to be concurrent. I could refine the approach if I have other types of attacks with more lingering effects, but I will take this win for now.

Out of curiosity, how would I add an extra tag mid-way through an ability’s execution? Didn’t seem to find anything that could help me in the blueprint. I can only see one way: add the tag I need to the relevant tag container in native code (it’s a protected field - obvs not BlueprintRead-able) and somehow call a function that cancels abilities with that tag, which again seems to be a not very exposed internal function call. Anyway, seemed too complicated, whereas adding this tag in the normal settings seems to be easy and works (for now at least).

Thanks again for your input.

1 Like

Glad you figured it out!

For the “mid-way” the way we do it is work with the tags as “stages” (there is one for charging, targeting, release, etc.) and then use the WaitForGameplayTagRemove.
That way you can remove the tags from anywhere (e.g. Anim Notifys, Actor BPs) and the next stage will trigger without you having to worry as long as your logic in the Ability works.

If you look at the ancient demo project however, there seems to be another way with using explicit stages for the ability (haven’t gotten too much into detail with that one though).

Glad I could help and good luck with your project!

Greetings,
Markus
Bagpack Games

yes very interesting. I was also checking out those async tasks with gameplay tags. But need to get more familiar/comfortable. Still unsure as to how the “from anywhere” bit works: is there a RemoveTag node or do you do it in code? I think it only worked in Code but I could be mistaken. I think there are RemoveTag or AddTag nodes, but couldn’t figure out how to add a TagContainer that they require a sinput.

Aaaaanyway, yeah it works for me now but will probably investigate further to enrich my knowledge on the subject.

1 Like