Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    #2
    Just to double-check; did you set the content of the name variable (the one called "1" in the screenshot) to be the same as your tag?
    (just wondering cause having the variable itself named the same thing as the tag you're looking for is a bit unusual)


    Comment


      #3
      It is, actually. Thanks for the suggestion anyway.

      Comment


        #4
        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.

        Comment


          #5
          Originally posted by Dan Carmine View Post
          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.
          -For readers with similar issues: Not sure why this method doesn't seem to work. However I managed to get "Get Components by Tag" to work from an actor reference instead, using the exact same tag information.

          Comment

          Working...
          X