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 5'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.

Hi, I found a solution to this problem and thought I’d share. I also wanted Attribute * Mod * Mod and not Attribute * (Mod + Mod) and there are 2 ways you can go about it.

The first and most intrusive way is to make the engine change suggested here and change FAggregatorModChannel::EvaluateWithBase() so that the default behavior is what you want.

The second way is to use the evaluation channels that were released in 4.14, that for some reason aren’t discussed or documented anywhere. You just need to edit DefaultGame.ini and add the following:

[/Script/GameplayAbilities.AbilitySystemGlobals]
bAllowGameplayModEvaluationChannels=true
GameplayModEvaluationChannelAliases[0]="MyFirstChannel"
GameplayModEvaluationChannelAliases[1]="MySecondChannel"

By default, there are 10 channels available. After you add that, your details panel in the editor will show only the channels that you give names to in the ini file.

Then, you can select the appropriate channel and do something like: Attribute * (MyFirstChannelMod + MyFirstChannelMod) * MySecondChannelMod!

1 Like