Condition doesn't work!

Hello, i have problem with condition node, i am still beginner with blueprints.

As you see in the picture below, i built a logic with nodes, my goal was to spawn a box on the same place it was destroyed. I’m trying to use condition node " is being destroyed" but it never works.

So what happens is that i start game, i hit that box, its disappears but the new one never spawns.

The box called “Target”

Also on top you see i got another nodes so whenever i hit that box with a gun projectile it is destroyed.

It’s because your box is already destroyed, so the Spawn function can not be executed, because the actor exists no more, and it can not do anything anymore.

Edit: to do what you want, you can either use Events to trigger the functions in the Level blueprint, but that’s a bit cumbersome since you have to Bind to the events of every newly spawned box; or I’d suggest a workaround: create an empty actor that will have the spawn function in it. Before your box is destroyed, you “send a message” to that actor to spawn a new box, along with the location where it should be spawned after a delay.

it is destroyed because i shoot it you mean?

I made in level blueprints to spawn that box, so at the start of the game it spawns automatically once.

I be thankful if you show me example how to build nodes properly.

On second thought, another actor will be a bit tricky too, because if you destroy a few boxes within those 3 seconds they will interfere with each other and you’ll have to make your custom delays based on the world time and so on and so forth, so there’s another idea for you:

If you want to create the same box at the same location, you might not destroy it at all. Just make it invisible and with no collision, and after a delay turn the visibility and collision back on.

Alright i will try that, thank you so much! =)

I see that you have made 2 individual system:a system uses to destroy component after an overlapped event, and another one uses to spawn a new box after the old one has been destroyed.

So i was wondering why you don’t combine those two system into a single one? To explain it further, all you need is create a “Spawn actor from class” node right after the "Destroy Component"node?And then choose your box in the "Spawn actor from class"node in order to make a new box appear right after the disapearance of the one you have destroyed.

A bonus guide; if you can, always made event happen in a single system. Don’t divide it into multiple system, as sometimes logic paradox can happens

By the way, is this the the Level BP or the Box BP in the screenshot?

Anyway, at some point you’ll want to have more than one box in the level, and with the setup you have now you’ll have to manually add Hit events for each of them, but that’s just too much unnecessary work. I can show you the system I came up with some time ago that can use one function for all the boxes at once. In 6-7 hours maybe, when I get home.

Thank you that worked!!

i built nodes this way, tho one problem appears, the condition node always executes " false " even tho box appear!

This is Box BP

And yes i be thankful if you can show me how you build nodes your way =)

Because that’s the new box, it has just been spawned, and you destroyed the previous box. Even if you create the same box in the same place, it’s still a totally new actor for the game.

By the way, if you want to check a bool variable using Print String, you can connect the bool directly to Print String, with no Branch in between.

Okay, so create a new actor blueprint, name it Respawner. It doesn’t contain any mesh, so it’s invisible in the level. Create two arrays in it, float and vector — name them Times and Locations respectively — and a float variable called Delay. Here’s the Respawner blueprint:

Box Destroyed is a custom event you create yourself — right click anywhere in the graph and type “custom event”, you’ll find it right there. In its details add one input by clicking a small +. Name it Location.

265469-respawner.png

Everything else in this BP should be quite clear.

Going to the Box BP. On Begin Play find your Respawner (don’t forget to place it into the level!) and promote it to a variable. Everything else should be clear to you.

It’s a bit better because it doesn’t use a delay node that can be called only once at a time and won’t work for multiple boxes at the same time, and you can create any number of boxes and it will work for all. Note that if you have a large number of boxes it may adversely impact your performance, because using ForEach with tick is not always a good idea. By the way, you can set the Respawner Tick Interval to something like 0.1, I think that will be more than enough.

Don’t hesitate to ask further questions if you need.

Thank you for taking your time to explain so much! :slight_smile:
This looks complicated for me since am new to " array " variables but i’m learning step by step.

Few questions i have, how did you got that node which is connected to “For each loop node” and "Nearly equal (float) i tried to search but there is only “Make array” node which connects all of them but it seems doesn’t work the same way.

And below " Get array" for some reason it doesn’t connect to “set node” i cant find any other node that would connect those nodes together.

265568-cant-get-this-two-nodes.png

First is just a math operation. If you drag a pin off the Array Element or the Delay and type ‘+’ you’ll find it. Or type “float +” and there will be options for you.

Second, it doesn’t connect probably because the variable types are different. If you drag a pin off the Get and click “Promote to a variable”, you’ll get the variable of the required type. If you create a variable manually in the list in the left part of the window, you have to select the required type yourself. After you created any blueprint actor, its name will be available as a variable type, but you have to type in at least a few characters of its name to find it, because finding it in the list of types otherwise may sometimes be difficult.