Chain explosion, otherwise explode after 2 seconds?

Hi there :slight_smile: I’m trying to create a scenario where you can place a number of bombs. Each bomb has its own 2-second timer, after which it explodes and destroys things around it. However, the explosion radius is quite big, and if it hits another already placed bomb (which was placed a little later), this hit bomb ignores its own timer and explodes immidiately after being hit by another explosion. This should work as a chain reaction, meaning if you place 10 bombs next to each other in the span of 2 seconds, they all explode at the same time, because the second one is hit by the first one, the third one by the second one and so on. Right now I have a bomb blueprint with a BeginPlay Event and BombExplode event after 2-second delay. The BombExplode event does its thing (destroys things) and also checks for another bombs in its radius, for which it immidiately activates the BombExplode event (without the delay). However, this doesn’t work, as the blueprint thinks its an infinite loop (BombExplode activates itself over and over). So, my question is, how would you go about this? Many thanks in advance!! Cheers

It’s simple.To your bomb actor add bool variable “isExplode” default false and function “Explosion”. In “Explosion” first check “isExplode” if it’s true do nothing and if it’s false just set to true, make this bombs explosion, then call neighbors explode method. This “isExplode” variable prevents your infinity loop. Good luck

Thanks for tip, but there’s still the same problem. You see, I need the blueprint script to run for each instance of the bomb blueprint separately - I need an exploding bomb to trigger the explode event for the bombs around it (that are from the same blueprint). However, I can only trigger it for “self” at the end of the exploding sequence, not for other instances of the bomb blueprint, hence the infinite loop. I attached a screenshot of what I would need to connect to the event input, but I can’t.

it’s incorrect because, First you must make explosion and then you must destroy your an actor.

I can’t, because when I put Explosion before the DestroyActor, it loops from the start again and never gets to the DestroyActor…

As I wrote, the problem is that the Explosion event triggers for itself, but I need to trigger it for the other instances of the Bomb blueprint (for the ones hit by an exploding bomb)…

Sooo no other ideas? :frowning:

Why would it loop from the start again? You need to call DestroyActor for this Blueprint in response to the ForEachLoop Completed output. You can set your IsExplode boolean before the ForEachLoop though.

And like kubiknubik wrote, you need to check the IsExplode boolean in the Explosion function and only execute the actual explosion code if it’s still false at the time.

your mistake is that you are destroying actor first. You must explode first and then destroy actor . It’s architectural mistake. I can write optimized script but i cant understand your wishes , because I said my version in upper comment and you disagreed.

I tried that but it just doesn’t work, because the explosion event cannot be assigned to the ForEachLoop objects output. It just says “self” and cannot be changed, therefore the whole event gets triggered in loop for the same blueprint and it crashes when one explosion hits another bomb. Screenshot attached. Please tell me if I’m doing something wrong because I really don’t know how to solve this right now…

Look at what I posted as a response to , I have it that way now and it still doesn’t work.