Download

Can't get the "Component Has Tags" node to work properly

Hi all,

I’ll start with the elephants in the room: I did not misspell the tags, and I know that Actor Tags and Component Tags are different.

Now, the issue I have is that I can’t get the node “Component has tags” to identify/match the tag it has to. I’ve been struggling with it for days now. I need it for a basic A.I. function, where the A.I. needs to find a target, and confirm whether it is hostile or friendly. I’ve first set it up following a tutorial which covered how to find a target (and that part alone works). I’m trying to add a friend/foe part to it using tags, but whatever I do, it breaks the function.

I managed to get “Component Has Tags” to work when I used “Break Hit Result” and connected the “Hit Component” output through a “For Each Loop With Break” node into “Component Has Tags” but it wouldn’t work when I feed a Name variable into “Component Has Tags” that has the same tag, spelled right. So to sum it up, when I have the engine match the component tag with an exact match it fails, but when I have the engine get the component’s tag to later compare it with itself, it succeeds.

Please see screenshots attached. If you need any more details, let me know.

Thank you in advance.

I’ve finally fixed it; well, found a workaround anyway. Instead of messing with “Component Has Tags,” we can use Does Equal To (==). Get hit component’s tag, feed it into a “For Each Loop With Break,” then have “Does Equal To” compare the result with the desired name variable. Please see screenshot for illustration.

Sportbil, thanks for trying to help by the way. I’m sure your comment will help someone, somewhere.

If anyone reading this can tell why didn’t the original method work, please let me know. Thank you in advance.