Announcement

Collapse
No announcement yet.

Blueprint Interaction - Removing an Object after another Object is destroyed

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

    Blueprint Interaction - Removing an Object after another Object is destroyed

    Hi guys!

    So I'm working on a 2DSideScroller-Game and I'm coming across a big problem.

    I have one item and one enemy.

    My goal:
    When one item is destroyed (through Collision) an enemy (Lighting, here Blitz_Blueprint) should be destroyed as well. But I somehow can't get access to that one Blitz-Object.
    Another thought for me was to use a counter (when item gets destroyed -> counter +1, and then the enemy blueprint would check in Event Tick, if the counter is 1 and then destroy itself.

    The problem with both cases is that there are always an error when I try to access variables from the other blueprint or try to do actions for the other blueprint. (Variables are public!)

    I'd be so happy if someone could help me with this.. I'm really frustrated and can't find any tutorials that'd help my case.

    #2
    Your object pin is not filled out. It doesn't know which object to destroy.

    If it is the only object of its type you can use the 'find all object of type' function and then for loop and destroy them all.

    Comment


      #3
      @KeGld1517
      Thank you for your reply!
      Yes, unfortunately I have no idea how to find this object. Unfortunately there are more than one of that Blueprint on the map..

      Comment


        #4
        Make an actor object reference variable in the item, and make it instance editable. Select the item in the level, lock the details panel by clicking the lock icon. Now find the enemy and add it to the variable slot.

        Also, you should not destroy "self" and execute other commands beforehand. Nothing will execute afterwards. If you want to do something after the actor has been destroyed, you should bind an event to OnDestroyed or execute the "Destroy Actor - Self" node last.

        Comment

        Working...
        X