Download

Gameplay Ability System - modifiers

Hi! Can GAS to multiply the duration effect mods and not adding each other? When I apply few same effects with multiplication modifiers the formula looks like this:

AttributeValue * (Mod + Mod + Mod + Mod + …)

I need something like:

AttributeValue * Mod * Mod * Mod * Mod * …

The instant effect do it correct, but not with duration. I tried any parrameters, I was revising the GAS source code and tried to find maybe delegates ot some virtual functions for solutions, but not find any options how to multiply mods. Сan this be solved somehow?

Have you looked at UGameplayEffectExecutionCalculation you can reference it in the CustomCalculationClass and it can take multiple attributes that you can do whatever you like with there’s a good write up here and and excellent implementation example in the source code.

4.5.12 Gameplay Effect Execution Calculation](GitHub - tranek/GASDocumentation: My understanding of Unreal Engine 4's GameplayAbilitySystem plugin with a simple multiplayer sample project.)

Thanks for the answer. But UGameplayEffectExecutionCalculation not called for effects with durations no period, because there is check in source code:


// Should only ever execute effects that are instant application or periodic application
// Effects with no period and that aren't instant application should never be executed
check( (Spec.GetDuration() == UGameplayEffect::INSTANT_APPLICATION || Spec.GetPeriod() != UGameplayEffect::NO_PERIOD) );

What if you apply multiple mods using a scalable float as a multiplier?

Is not a same, because when some of this effects removed - I will get wrong calculation of my attribute.

If you have a single effect with multiple mods that multiply the same attribute, it should yield the same result. Maybe I’m not understanding what you are saying.

If your attribute starts at 10, and you multiply it by 2 three times, you get 80, no matter whether it’s

10 * 2 * 2 * 2 (your way)

or

((10 * 2) * 2) * 2 (my way).

Oh… Sorry, you write multiple mods in first message. I misunderstood. No, I want one effect with only one modifier, because I want apply this effect multiple times consistently.