Chain explosion, otherwise explode after 2 seconds?
Hi there :) 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
asked Nov 01 '15 at 10:13 PM in Blueprint Scripting
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 (y)
answered Nov 02 '15 at 09:56 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here