Gameplay Tag Query in Blueprints

So I’ve read through the C++ files given to us by Epic after enabling GAS, and I’m trying to use them for inventory and UI in an RPG. The first two pictures are of the function that works for me, the third picture is the one that doesn’t work, but I want it to work and don’t understand how Query works. I hope this all makes sense I’m sorry in advance if it doesn’t.

My first picture is my current function. I get all actors that implement an interface that I made specifically for that actor class. The actor is a custom actor with no info in it other than I gave it an AbilitySystemComponent in C++ and 2 variables (Name, Asset Gameplay Tag) inside Blueprints. The NPC provides a list of available inventory items in the form of struct containing 1 Gameplay Tag and a float for random weight selection. That is ran through my own Blueprint Function Library function I wrote that just sorts it into an array of randomly selected tags. Back inside the NPC those tags are checked against the actor owned tags called by the GameplayTagAssetInterface and checked against any of the randomly passed in tags, if it matches any of the tags passed in, it offers the item for sale in a widget.

Second picture is Blueprint Function Library function

Third picture is the function I want to use. I don’t understand after reading so much how this Query works. I try to GetAllActorsOfClassTagQuery and make the tag query with the same tags, yet the actors it returns is 0.

How can I pull the object ref of this class using a Gameplay Tag Query?

@Rev0verDrive This is my post. If you need more info lemme know. I think your explanation however solved the issue. I want to try with just the header files you gave me and see if I can get it.

Also if the Query returns true only if all results are found then this method I’ve posted above will never return results, as it returns a bunch of random tags. I will have to rethink my Query.

For clarity you have an NPC that has inventory that you want to sort through so that it’s grouped an associated with the proper actor reference. This so the player can buy from the NPC?

If so, I’d personally have the inventory presorted on the NPC. Then on “interaction” I’d cast to the NPC class and directly reference the inventory.

Then I’d loop the inventory for UI display.

So in the NPC itself I have a variable type Array of structs I declared that carry 1 gameplay tag and a float value of random chance to sell to player when the widget is constructed on interact. Does this make sense?


NPC2