Gameplay Ability System (GAS): Change active gameplay effect remaining duration

Hi there. I’m trying to change the cooldown time of one of the abilities when using other ability. Example: total cooldown duration of the ability is, for example, 12 seconds. After 2 seconds of waiting the remaining duration is 10 seconds and I use other ability that supposed to reduce it by 5 seconds, so I have 5 seconds remaining cooldown time

I found a dirty way to do this: get cooldown effect duration, save it, remove effect, apply new effect with new duration.

Problem with this method is that the effect is actually reapplied with a 100% duration time (not like it should be) so it shows in a user interface (cooldown percent sets to 0% even if it’s 50%, but the timing is right). In every moba/mmo game when you change your cooldown it looks like changed cooldown duration, not like reapplication.

I could store maximum duration in a variable or structure or else, but that’s dirty method too and it doesn’t care about cooldown speed attributes and effects, so not using it.

Is there a node somewhere to actually change active effect duration, not just reapply with new duration? Yeah it works now but looks ugly and totally not production ready. I don’t believe that such a well thought Gameplay Ability System doesn’t have native way to do such a common thing that appeared in nearly any game I played with cooldowns.

If there is no way to implement it in blueprints now, how can I add it in a cpp? Maybe a little hint for bp programmer?

Hi there.

It sounds like some sort of communication is required between each effect. Are they separate blueprints? If so consider a common interface between them that can detect and inform each other to adjust their current remaining duration values.

I.e. a simple message could be if you say cast a fire spell with 10s dur. and the new effect is a water spell that can counter or hinder, a simple message out to all the compatible effect blueprints like:

Water spell cast, if you are a fire spell and have x duration left, change x duration to x-5

A simple effect communication interface would be easily used and checked during your effects blueprint code with a simple check. obviously each effect has a variable holding the duration left before it expires and you just need to modify that value when it receives the message from another effect. keep the message simple and universal to use across effects.

Hope that was clear enough to understand the concept.

Happy coding!

Stewart

Did you find a solution in the end to your liking ? I have a similar issue

Hi, I met the same problem. Is there any good way to solve this?

In UAbilitySystemComponent there is a struct for all active gameplay effects (ActiveGameplayEffects). This structure has method void ModifyActiveEffectStartTime(FActiveGameplayEffectHandle Handle, float StartTimeDiff).

Unfortunately, this field is protected and you can only access it via const getter, but the method for changing effect duration need non-const struct ref (obviously).

So the only way I found for this is defining method in your own child of ASC like that :
void UMyAbilitySystemComponent::ChangeEffectDuration(FActiveGameplayEffectHandle Handle, float TimeDiff)
{
ActiveGameplayEffects.ModifyActiveEffectStartTime(Handle, TimeDiff);
}