Announcement

Collapse
No announcement yet.

Setting up a BP to fire when "X" amount of things have been destroyed?

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

    Setting up a BP to fire when "X" amount of things have been destroyed?

    So I have a small issue here. Should be a simple fix. It's got me a little stumped though.

    I have destructible mesh that I'm trying to destroy. U can see that when radial damage effects it, it loses health, and when it gets to 0 it calls to my hud and updates my score. There's also an outline render as well. However, here's where I'm stumped.

    I have 3 destructible mesh blueprints, each with their own destructible meshes to get destroyed. They are 3 separate blueprints. I want to be able to destroy these objects and ONLY WHEN ALL OF THEM are destroyed, I want to spawn more.

    Imagine you're playing, and the only way to advance is to destroy all of the objects in order to spawn more. I attempted this, but I'm not 100% sure how to finish it, and I'm not even sure if it's the right way to do it.

    So my question is this. . . How can I set this blueprint up so that when all 3 of my objects have (0 <=) health, it spawns another object?

    Here's my current setup.
    When the game starts, the first object spawns. This is spawning my first object BP.
    Click image for larger version

Name:	L7lmeva.png
Views:	1
Size:	161.8 KB
ID:	1159465

    This is the blueprint of Destructible Mesh #1. As you can see, when you destroy the first object, it spawns 3 more. This all works fine. It spawns BP #2,#3, & #4.
    Click image for larger version

Name:	Sa4wfSU.png
Views:	1
Size:	296.9 KB
ID:	1159464

    How can I make it so that when BP#2,3,& 4 are all dead or at zero health, I can fire another bp? I tried doing this on my 4th
    Click image for larger version

Name:	mbDT7i4.png
Views:	1
Size:	238.5 KB
ID:	1159462
    Attached Files

    #2
    I am very novice yet, but I guess I can help you.

    Your problem is that you don't have anything that "link" the "death count" (or whatever).


    I see two possible solutions: reading variables from others BPs (IMO isn't the more comfortable solution that is what you tryed to do) OR use a Game Instance blueprint. You can have 1 Game Instance in your game (I guess). Create it and select it in your Game Project Settings (I spend like 1 hour trying fix this point).

    What is the good thing for Game Instance? That it keep "alive" and accesible from every map in game, and don't lose their actual values.

    So you could do one, create a variable called "killeds" and when a blueprint is destroyed you increase that in one.

    In your levelmap (Or where you prefer have it) you can have a tick event that is keeping checking that variable and when it is =3 then "print string -> it worked!" :P.

    Comment


      #3
      Make a float or int variable in the bp that is spawning stuff. Now in your destructible bp before destroying actor you cast to the spawner bp, get the variable you created and add 1 to that.

      So now compare your variable to 3 everytime there is added one. If your variable is equal to 3, spawn more destructibles and reset variable to 0 or do whatever you like.

      Comment

      Working...
      X