# Trigger explosion?

**URL:** <https://forums.unrealengine.com/t/trigger-explosion/1776698>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [March 28, 2024, 10:23pm UTC](https://forums.unrealengine.com/t/trigger-explosion/1776698 "2024-03-28T22:23:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![cushion1337](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cushion1337](https://forums.unrealengine.com/u/cushion1337)\
**Post date:** [March 28, 2024, 10:23pm UTC](https://forums.unrealengine.com/t/trigger-explosion/1776698/1 "2024-03-28T22:23:49Z")

</div>

Hi all,  
Im currently working on a D-day project. On the beach I need some artillery explosion happening “randomly”. How should I proces with this? Will it be a normal triggerbox with sounds, ect. Or are there any thing way better for this? Any Youtube tuts or docu for anything better? 🍨

Thanks!

---

<div class="post-metadata">

**Author:** ![SupremeLeader006](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/supremeleader006/32/912867_2.png) [@SupremeLeader006](https://forums.unrealengine.com/u/SupremeLeader006)\
**Post date:** [March 28, 2024, 10:41pm UTC](https://forums.unrealengine.com/t/trigger-explosion/1776698/2 "2024-03-28T22:41:17Z")

</div>

I’m sure there are many ways to achieve that. But the first thing that comes to my mind is to create a looping setup with random bool to determine if an explosion should happen at the loop beginning and if yes, continues to spawn your explosion elements on designated or totally random locations.

Don’t know, maybe there is an easier way.

Maybe you can be more specific about your scene. Is it an ambience type of thing or more about gameplay? Because there is surely something more efficient than my first idea.

---

<div class="post-metadata">

**Author:** ![Bruno.Martelli](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bruno.martelli/32/594427_2.png) [@Bruno.Martelli](https://forums.unrealengine.com/u/Bruno.Martelli)\
**Post date:** [March 28, 2024, 11:04pm UTC](https://forums.unrealengine.com/t/trigger-explosion/1776698/3 "2024-03-28T23:04:52Z")

</div>

Something like this? A blueprint Actor in the level that randomly fires off the ‘BoomBoom’ event that can spawn particle explosions and sounds … you can put a bunch in the level. The spawning can be set to give random locations…

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/a/e5aee0b472f5fe47f2739984420c9f024f9d335b.png)

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [March 28, 2024, 11:36pm UTC](https://forums.unrealengine.com/t/trigger-explosion/1776698/4 "2024-03-28T23:36:48Z")

</div>

IMO a single actor could be enough:  
 ![DDay](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/f/4/1f4118ff5b0dc1293ee874be313b9ad316f3937f.gif)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/7/5/9756730ff499dbaced4d9e5f9b888f54bd06d995.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/4/d/b4d79620010aa40fbd611a815c47183d049e7c58.png)

---

<div class="post-metadata">

**Author:** ![cushion1337](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cushion1337](https://forums.unrealengine.com/u/cushion1337)\
**Post date:** [March 29, 2024, 1:27am UTC](https://forums.unrealengine.com/t/trigger-explosion/1776698/5 "2024-03-29T01:27:37Z")

</div>

Hi, Yea sorry. Its for gameplay!

---

<div class="post-metadata">

**Author:** ![cushion1337](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cushion1337](https://forums.unrealengine.com/u/cushion1337)\
**Post date:** [March 29, 2024, 1:30am UTC](https://forums.unrealengine.com/t/trigger-explosion/1776698/6 "2024-03-29T01:30:18Z")

</div>

Hella nice! How “demanding” would it for gameplay? And could it be attach to any triggers, so its only happens while the character are In the “zone”?

Thanks!

---

<div class="post-metadata">

**Author:** ![SupremeLeader006](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/supremeleader006/32/912867_2.png) [@SupremeLeader006](https://forums.unrealengine.com/u/SupremeLeader006)\
**Post date:** [March 29, 2024, 2:57am UTC](https://forums.unrealengine.com/t/trigger-explosion/1776698/7 "2024-03-29T02:57:54Z")

</div>

I was going to draw some ugly demonstration but this looks like the way it should be.

> [@cushion1337](#):
>
> How “demanding” would it for gameplay?

as long as you don’t set the frequency to wild numbers, I wouldn’t say that the performance will take a damage from spawning a few simple vfx elements.

> [@cushion1337](#):
>
> And could it be attach to any triggers, so its only happens while the character are In the “zone”?

you can use “Set Actor Tick Enabled” node to turn down the ticking when the character leaves the scene

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [March 29, 2024, 3:06am UTC](https://forums.unrealengine.com/t/trigger-explosion/1776698/8 "2024-03-29T03:06:06Z")

</div>

> [@cushion1337](#):
>
> How “demanding” would it for gameplay?

- IMO It should be a lot less than spawning actors per explosion. VFX can be pooled and a trace of some sort is still needed assuming terrain won’t be flat.
- The tick should cost very close if not the same as using timers since it’s doing what a timer does `((float -= delta) <= 0.0)` except that this loop is done in blueprint, not c++. Either way 1 or a few won’t hurt much. If anything just set the tick interval to 1/30 or more.
- A vector3 can be exposed to change the bound in the constructor per instance, though the idea is to use a single actor and just set the bound to cover the playable area.

There’s not much more to it than that.

> [@cushion1337](#):
>
> And could it be attach to any triggers, so its only happens while the character are In the “zone”?

The box collision used can enable tick when the player begins overlap and turn tick off on end overlap. Just make sure to test that the box detects the player overlap if the spawn is inside.

![DDay2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/7/d/a7d7e92f62d77c817de1c65868168c4e95f29de9.gif)

Ofc it can also be adapted to “turn on” by any type of event.

---

<div class="post-metadata">

**Author:** ![cushion1337](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cushion1337](https://forums.unrealengine.com/u/cushion1337)\
**Post date:** [March 29, 2024, 5:28pm UTC](https://forums.unrealengine.com/t/trigger-explosion/1776698/9 "2024-03-29T17:28:41Z")

</div>

Hi,

Sir, you are a god Among men. Thanks so much! Apperently, my coding skills arent at This level xD  
Are there anyway This code can be uploaded to the blueprint upload, so I can do a C/P?  
So basically This code, will be all I need In the coding ascept?  
Sorry for all my questions!
