Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applying a Gameplay Effect Spec with Source/Target Tags Requirements in C++ inside Gameplay Ability Class #56

Closed
lucoiso opened this issue Jun 28, 2021 · 3 comments

Comments

@lucoiso
Copy link

lucoiso commented Jun 28, 2021

I'm trying to cast a gameplay effect on a character with a gameplay effect spec to use the tag requirements and manage the modifiers that will be used. But I'm confused because my test character has all the requirement tags, but the effect doesn't apply and i'm going crazy trying to figure out where i'm failing.

void UGASGameplayAbility::ApplyEffectToSelf()
{
     for (const auto& _Effect : AbilityEffects)
     {
         GetCurrentAbilitySpec()->SetByCallerTagMagnitudes.Add(_Effect.Key, AbilityActiveTime);
         auto _SpecHandle = MakeOutgoingGameplayEffectSpec(GetCurrentAbilitySpecHandle(), GetCurrentActorInfo(), GetCurrentActivationInfo(), _Effect.Value.Get());
 
         if (_SpecHandle.IsValid())
         {
             ApplyAbilityTagsToGameplayEffectSpec(*_SpecHandle.Data.Get(), GetCurrentAbilitySpec());
             ApplyGameplayEffectSpecToOwner(GetCurrentAbilitySpecHandle(), GetCurrentActorInfo(), GetCurrentActivationInfo(), _SpecHandle);
         }
     }
 }

ue5pebug

@ameaninglessname
Copy link
Contributor

Why not just step into ApplyGameplayEffectSpecToOwner and look what happened?

@lucoiso
Copy link
Author

lucoiso commented Jun 29, 2021

Why not just step into ApplyGameplayEffectSpecToOwner and look what happened?

I did this but didn't figure out what it could be, the effect acts as if it was applied normally, but modifiers that have requirements are blocked as if they don't have the necessary tags.

I tried other ways to apply what I want, but I was unsuccessful. The tags are being applied correctly to Gameplay Spec, I checked using GetActorTags() and GetSpecTags(), but the effect is not applied. When removing requirement tags from modifiers in the Gameplay Effect, the effect is applied normally.

The same happens when changing the application and tags from Source to Target.

I'm taking ideas on how I can better visualize what might be happening or examples of how to apply the effect with requirements. :S

@lucoiso lucoiso closed this as completed Jun 30, 2021
@lucoiso
Copy link
Author

lucoiso commented Jun 30, 2021

As the problem has more to do with the plugin and not the GAS-Documentation, I closed the thread and transferred my question to the AnswerHub and Unreal Forum. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants