Announcement

Collapse
No announcement yet.

Attach component to actor using elements from array

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

    Attach component to actor using elements from array

    I have four enemies and four swords in my level (although that will change, so I can't just hardcode it), I want to attach each sword to an enemy. When the level starts, I have a blueprint that finds how many swords and how many enemies are in the level (get all actors of class). I then have a for each loop that uses the value of "get all actors of class" (which is four in this case), and each time casts the element to my enemy blueprint. It then attaches the enemy blueprint (actor) element to an element from the sword array (component), but when I run the game, they are not attached. I know how to normally attach an actor and component, and I have done all the sockets etc, so I don't know what the problem is. Sorry if that was explained terribly (the picture below may help), any help would greatly be appreciated!

    Click image for larger version

Name:	Screenshot (2).png
Views:	1
Size:	345.1 KB
ID:	1154934

    #2
    That bottom loop isn't even being Executed.

    Also even if it was, the way you have is set up now looks like it wouldn't even go off until the top one was done.


    Also for the bottom array, instead of using a loop i would used a "Get" node. For the index input, use the Array Index. Then drag that out to the target.

    Comment


      #3
      This worked! Thank you very much!!!

      Comment


        #4
        Happy to help!

        Comment

        Working...
        X