How can you provide static data to gameplay effect executions?

Samathan
Tue, 11 Jul 2023 20:43:14 +0000
C++

I’m trying to create a gameplay ability system setup that uses executions to modify attributes. I want to be able to use the same gameplay effect to apply damage, regardless of whether the damage is coming from a weapon, an ability, etc. And damage values for weapons and abilities are stored in unique data assets.

The problem is that I need these data assets to perform the execution. For example, they include curves that determine weapons’ falloff damage and a boolean that determines if falloff damage should even be calculated. But I don’t know how to give each of these data assets to the execution.

The only ways I know how to give data to an execution are A. with a custom gameplay effect context, B. by capturing attributes, or C. by making transient aggregators.

I can’t use attributes or transient aggregators because they only take in single float values: their “magnitude.” So I can’t use them to pass around data assets.

I’ve tried using custom effect contexts, but they don’t allow enough flexibility. I’ve tried using them in gameplay abilities, but I have to manually modify each one inside the ability to give it the data I need. It’s also very difficult for abilities that apply more than one effect, since you then have to differentiate which data is for which execution.

All I want to do is have some kind of blueprint-exposed “Execution Data” data asset variable in the gameplay effect, which can then be accessed from the execution.

The only way I can think of doing this is by making my own gameplay effect class, adding the variable to it, and then trying to retrieve it from the execution by casting to my custom gameplay effect class from the execution parameters’ owning spec variable.

Is this the right way to handle this kind of problem, or is there something important that I’m missing?