x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

Product Version: UE 4.8
Tags:
more ▼

asked Nov 01 '15 at 10:13 PM in Blueprint Scripting

avatar image

Kiwi2703
25 6 5 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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)

more ▼

answered Nov 02 '15 at 09:56 AM

avatar image

kubiknubik
336 17 3 17

avatar image Kiwi2703 Nov 02 '15 at 11:58 PM

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.alt text

bombblueprint.jpg (147.7 kB)
avatar image kubiknubik Nov 03 '15 at 09:59 AM

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

avatar image Kiwi2703 Nov 03 '15 at 11:26 AM

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

avatar image erinacea Nov 05 '15 at 08:53 AM

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.

avatar image Kiwi2703 Nov 05 '15 at 12:37 PM

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... alt text

bombblueprint2.jpg (400.9 kB)
avatar image Kiwi2703 Nov 03 '15 at 11:31 AM

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)..

avatar image Kiwi2703 Nov 13 '15 at 09:19 PM

Bump......

avatar image Kiwi2703 Nov 05 '15 at 12:50 AM

Sooo no other ideas? :(

avatar image kubiknubik Nov 05 '15 at 11:37 AM

Kiwi 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.

avatar image Kiwi2703 Nov 06 '15 at 11:39 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question