Gameplay Tags Interface

Hey Hey!

I’m trying to use EQS gameplay tag conditions versus some actors in my scene.

The actors in the scene have a variable of the type “Gameplay Tag Container” and contain various tags imported from a data table in the project settings.

My EQS check doesn’t pick up these tags.

I have noticed that IGameplayTags Interface needs to be added to the class defaults when querying using C++ but I cannot find that interface option when editing my class defaults of a blueprint actor or character etc.

The tag system would infinitely help modulate my AI and query system where units need to query based on the tags of TypeAttack or TypeDefensem, rather than hierarchical queries containing search for actors of each child class MeleeDefender, RangedDefender, Griffon Defender… although that seems where im heading if i can’t get this game play tag interface to work.

Please help!

Haven’t used this before but I had a quick look at the source code:

Seems like you can’t add it in Blueprints. Your best bet is to make a base class which all your AI inherits from in C++ and make sure that class implements the interface.

Otherwise you could make an actor component instead of a base class if you need a more flexible system but I’m not sure if that would screw up any of the EQS stuff.

Ultimately seems like you’re going to need to use C++ to fix this.

Thanks for the reply!

I think jumping into c++ to make a single child of character and then reparenting my current classes to that will be quick enough to get this system back on track.

Cheers again i’ll let you know if that works!

Hey again, I’ve just tried to create a C++ class which implements the interface but I get a bunch of errors, would you have a minute to look?

fa8218514d71457cd875b1ffe825090de50e5542.jpeg

I found this post:

https://answers.unrealengine.com/questions/373749/how-do-i-declare-gameplay-tag-or-how-do-i-eqs-test.html

They say it’s as simple as “implementing the interface” but im unaware how to do this in c++.

Most places seems to say you just add it after the class declaration, but i just get errors

4d8ecd1442d06d30ddb75b8672c64d055b990042.jpeg

This is what I would like to work in essence.

Different AI may have different EQS ranges and rules around picking the furthest enemy or closest etc. But generally the tags is where time is saved, rather than repeatedly creating something likes this for every enemy i’d ever add to the game:

^ Imagine this with different classes in each query as part of a single query, which at present is called somewhat often to keep enemies on track, but with the above implementation / workaround, wouldn’t performance just tank?

Go into the GameplayTagAssetInterface.h file, you can see where it’s located here UGameplayTagAssetInterface | Unreal Engine 5.2 Documentation or by searching the solution explorer.

You need to “implement” all the functions in that file by copy and pasting them them into your character’s header file. Then let visual studio add them to your source file by hovering the function and pressing (ctrl+,).

If it takes too long you might want to manually do it. Hopefully that should fix it.

I gave the C++ inheritance a shot but had no luck with EQS, i’m now able to call blueprints with the functions in the new character class but I was really looking to just make the EQS Gameplay Tags work!

I used this shooter tutorial to give me more info for anyone with the same goal: Using GameplayTags | Shooter Tutorial

For now, im a day or two behind my targets, so I’m just going to try creating new contexts, and see how I get on.

I may post more info.

SOLVED

Okay so, this is solved thanks to the helpful comments.

In order to get eqs tests working with gameplay tags:

  1. Create a new C++ Character class.

  2. Open the new Class and add Gameplaytags inclusion, a return / override for the setting of tags, and also a new variable to edit within blueprints:

7566aef7924c874945769622c5c4f962feb34efe.jpeg

  1. Open the ProjectName.Build.cs file and add “GameplayTags” to the modules:

EQS Fixed 2.JPG

Now in engine you will see this gameplay tags variable (which was added in C++, and when used with eqs, works!)

You can edit this on construction or begin play, (setting in construction allows EQS test pawn to work for debugging queries)

EQS Fixed 5.JPG

All you need is the local variable of a TagContainer in order for this to work - like so:

EQS Fixed 6.JPG

Then you do the regular checking based on tags - Using Gameplay Tags to Label and Organize Your Content in UE4 - Unreal Engine

This is going to help a lot with the game i’m working on and I really appreciate the help, now my minions can focus certain types and not others, next step is scoring with prioritisation / order of tags in individual ownedtags arrays… this could potentially be a custom EQS test that I develop in C++ over the coming weeks.

I’ll let you know how that goes :slight_smile:

Best R

Wait… is it still an issue? Is Add gameplay tag not working in blueprints?!
I have similar problem I have a gameplay tag container and it has a length of 0 no matter how many tags with what authority and how I add :confused:

This was helpful for getting behavior tree decorators working with gameplay tags. I’m not sure why Rennjan has you declare both a gameplay tag container AND a gameplay tag. When I did my behavior tree stuff, it only recognizes the container version. Do I need the singular GameplayTag for anything or was Rennjan just using that to test with or compare old tags???