Find Matching Target Tag from different category than Source Tags

CureDespair
Thu, 17 Nov 2022 21:37:11 +0000
C++

I have SourceTags and TargetTags in a UGameplayEffectExecutionCalculation Execute_Implementation function.

Like so:

const FGameplayTagContainer* SourceTags = Spec.CapturedSourceTags.GetAggregatedTags();
	const FGameplayTagContainer* TargetTags = Spec.CapturedTargetTags.GetAggregatedTags();

I need to determine if a value in the calculation will be: 1 if normal, 2 if target is weak against source DamageType, or 0.5 if target is protected against source DamageType.

How would I?

Get “DamageType” Tags from Source tags.

Check the “Weakness” Tags in Target tags for the matching end “DamageType” tag to determine if weak against DamageType.

Check the “Protection” Tags in Target tags for the matching end “DamageType” tag to determine if strong against DamageType

For example:
Source has DamageType.Axe in it’s Tags and Target has Weakness.Axe in it’s Tags so the value would be 2. If the Target had Protection.Axe then the value would be 0.5. If no tags in target then the value would be 1. If there were both Protection and Weakness then it would be an error but I guess I would swallow it and the value would still be 1.

Is there a function already that would do what I want or how would I write it? It seems simple if I was familiar with Unreal C++ with GameplayTags and GameplayTag Containers I don’t program with C++ much and use Blueprints most of the time.

3 posts - 1 participant