Gameplay execution Calculation

Hey everyone.

I am using the Gameplay Ability System with blueprints, got some plugins that expose a lot of the C++ as functions etc.

But im struggling trying to get Gameplay Execution Calculations to work with what I want. Perhaps I am using it wrong.

Currently I have a crit roll done outside of the GEC, but I want to move it inside, however my damage number rely on the damage magnitude and a boolean for if it crits.

But I can’t seem to figure out how to do this with GEC, if it’s even possible. What is the correct way to do this? Any functions I should expose.

You can use setsetbycallermagnitude (in c++ or BP) and getsetbycallermagnitude to pass float vars around and use them however you want in the GEC. convert your bool to a float to pass it.

float CritDamage = Spec.GetSetByCallerMagnitude(FGameplayTag::RequestGameplayTag(FName("Data.CritDamage")), false, 0.0f);

Would this be something I would make in C++ as a function to expose into Blueprints?

I dont think you can do GameplayEffectCalculation as blueprints? unless something has changed recently.

Are you wanting to use a normal gameplay effect all in BP? If so in your GameplayAbility event, you can use BP nodes MakeOutgoingGameplayEffectSpec-> AssignTagSetByCallerMagnitude-> ApplyGameplayEffectSpecToOwner, passing it your gameplay tag (ie “MyGameData.CritDamageMultiplier”) and the float. You can chain several of these AssignTagset calls to pass a bunch of floats as needed. In your GE, you use a Modifier op like multiply for the attribute you want to modify, set Modifier Magnitude>Calc type>Set by Caller. Under Data Tag, select your tag for the data you passed. This will multiply your attribute value by the float you passed.

The advantage of using a blueprint GE is the local prediction, you dont get that with the GEC. GECs are meant to allow any type of processing but have no prediction.

There are also ModifierMagnitudeCalculations, that are predicted. These are a class you can write in c++ to modify a single value that allow complex calculations: