How to get an actor tag through a blueprint interface?

Hello,

I have a very simple BP system where my character can hold an item (which is a BP_Item actor).

As of now, the pick-up system just destroys the actor in the level, and sets a SM in my character blueprint, as the SM from my BP_Item.

What I want to do now, is for certain actions to be performed, only if my character is holding the correct item, which I would like to check with tags (for no other reason than the fact that it seems simple to me).

(To illustrate this in context, I would like for a fuel tank to fill up, if my character is holding a fuel canister. My idea for this would be that when I interact with the fuel tank, a check is done to see if the held item I have has the proper tag)

As you can see in the attached screenshots, I have an exposed Name type variable “ItemTag”, which I define per BP instance in my level. I am trying to use an interface to communicate that variable.

In my FirstPersonCharacter BP, I am line tracing to see what I hit, and then either picking up an item or interacting with a “RepairStation” (fuel tank example I gave earlier)

In the above screenshot, I store the Name variable I should have gotten from BP_Item, and print it to see if I have it.
But as you might have guessed, it is not printing anything.

It seems the event isn’t being fired in the BP, if I try to print that Name variable where I know it will fire, it prints “None” which is the variable’s default.

So it’s about here where I am not sure how to proceed, and would appreciate some help.

Cheers

I would add a collision box in the Fuel_Tank_BP, that checks on overlap if actor has a tag, (is it a fuel canister?) than do it’s thing. And for the canister itself - in the Fuel_Tank_BP create node - Apply damage; for damaged actor - set the actor with the tag canister from the collision box; damage causer - self.

Than in the Canister_BP > Event Any Damage > destroy actor

I know it’s not exactly what you ask for, but this is my quick solution…

I’d suggest you optimize your interaction system first. As is you’re having to cast to each thing you interact with to some level. That’s adding a hard reference to your character class.

Here’s a tutorial I did a year ago. It’s a 4 part teaching series aimed at beginner and intermediate devs. It is Multiplayer (dedicated server), but can easily be converted to Listen or even Single player.


Advanced version heavily leans into BP Interfaces, so no hard references to anything and it utilizes Gameplay tags for Interaction type and item identifiers. Calls specialized functions to handle Client or Server handling.

Character class implementation

1 Like