How To Create A Explosive Barrel?

Unreal Engine 4.13

Hello everyone,

I trying to learn how to create a explosive barrel using Blueprint from watching this video: UE4 - Blueprint Explosive Barrel #1 - Basic Setup - YouTube

However, I am having trouble on making it get damage by the projectiles from the gun. The damage of the projectiles works with AIs, but not the barrel explosive itself.

Can anyone please show me a guide to this?


Hey TX

This is standalone Single Player mode.

The main issue I have is that my bullets do not cause damage to the mesh of the barrel and does not lose health from it.

The bullet works on NPCs, but not with props.

Any particular part of the tutorial you’re having a problem with?

Is this standalone, or multi-player?

If multiplayer, you’ll want to ensure that the barrel is spawn and destroyed on the server. Otherwise, if the player explodes on Client A’s machine because they shot it, and player B was near it… Player B won’t be hurt, nor will he even know the barrell had exploded.

If it’s the later (multiplayer), there could be various means of solving this. For example the health of the player should be a replicated variable… That way, when the Server version of the player gets hurt, that is replicated down to the playing client. Otherwise, when the barrel explodes, you could do a multicast event to relay the barrel damage/explosion to all clients. Without more details on how the project/players are designed, it’s hard to give a silver bullet answer.

ok, so some simple stuff to get out of the way (you may have already done these)…

On the Barrel static mesh, it does have the option “can take damage” checked, yes?

On the Barrel’s Blueprint Graph, you do have the “AnyDamage” event setup correct? If so, can you provide a Screen Shot of the logic after that event?

It should go Event AnyDamage->[your choice logic]->ApplyRadialDamageWithFalloff node

“Can Take Damage” checked

Here are the screenshots:

I’m sorry, I thought you were trying to get the barrel to damage other actors in the vicinity… I see, your barrel itself isn’t being destroyed.

That is likely going to be a collision issue.
Make sure the barrel’s collision channel is set to block the same channel your projectiles are set to operate on.

I’m assuming your projectiles are actual objects in world, yes, not just line traces? Either way, check the collision properties for the barrel and the projectiles.

Also, make sure your barrel’s mesh has a collision primitive. Open the mesh in the Static Mesh Editor and click on the “Collisions” tile at the top. You should see the collision boundary be displayed around your barrel now. If you don’t, you’re mesh wasn’t imported with a collision channel.

You could fix that in the software used to create the mesh, but your shape is rather simple, so you could just add a collision primitive right there in the Mesh Editor.

On the details, change the collision option to be “use simple as complex”.

Okay, well I had tried out your method but I received no success.

I was using the Unreal Engine 4 props but I still added collision and yet it still did not work.

I set the block all to projectile and barrel but they still do not work. The barrel does not received any damage even the projectiles are hitting it.

Also note that I am using Line Trace by the way.

If you weapons are using only line traces, not actual objects that collide, then you will need to add logic to the line trace about the object it hit and dealing damage to it.

Are you doing the line trace in c++ or Blueprints?
Could show us the logic for that line trace and how it handles blocks?

I’d guess that your line trace logic is determining if it hit a pawn, but doesn’t process dealing any damage to Actors.

Sorry for the very late reply, was still working on my video game project.

Here is the Line Trace Function.