Modifier Magnitude Calculation
Requirements
Blueprint parent class needs to be UGameplayModMagnitudeCalculation
.
Override the functions CalculateBaseMagnitude
, the equivalent of the CalculateBaseMagnitude_Implementation
when done in C++.
Make sure to edit the Relevant Attributes to Capture
in Class Defaults, with all the Attributes your calculation will need.
Calculation
Start implementing your calculation.
The built-in UGameplayModMagnitudeCalculation
from the Engine already has a lot of BP exposed helpers. The Blueprint Attributes plugin doesn't need to add more (I'd just have to ensure calculation on BP defined Attributes are still working).
This includes:
- GetCapturedAttributeMagnitude()
- For this to work correctly, the Attribute needs to be added to the Relevant Attributes to Capture array.
- GetSetByCallerMagnitudeByName()
- GetSourceAggregatedTags()
- GetSourceActorTags()
- GetSourceSpecTags()
- GetTargetAggregatedTags()
- GetTargetActorTags()
- GetTargetSpecTags()
Warning for engine prior to 5.3
For engine prior to 5.3, you'll need to rely on a workaround for the issue of const methods. This is fixed in 5.3 and not required anymore.
By wiring in a pure const method that returns a reference to self for any BP exposed methods of MMC (like GetCapturedAttributeMagnitude)
Very important Make sure you name the return parameter something else than Self
or self
.
OK on the left, NOK on the right.
Example
SourceTags
, TargetTags
, CapturedWeight
, CapturedFatigue
, FatigueState
, Result
are all local variables.