Dynamic Breakable Brushes

Dynamic Breakable Brushes with and without Physics, with and without FX and sounds.

THIS TUTORIAL ASSUMES ADVANCED EXPERIENCE WITH BLACK OPS 3 RADIANT BLACK.

This tutorial was a group effort between Wakka and myself. It took about 5 days of stuffing around with scripting, tickboxes, and a lot of trial and error.

Wakka actually figured out how to get stuff to blow up. Something I would never have figured out (Thanks mate 😀 )

I hope you enjoy the end result of our work.

I have included the wall included in my tutorial as a downloadable prefab so you can stuff around with it, get your scripting right before you attempt your own.

You can download it >>> HERE <<<

Wakka has a couple of great videos showing how Dynamic Brushes work in game.

 

 

 

Ok, now that you know what we’re doing…lets get started 🙂

CREATE THE BRUSH

Create the brush and using a fine grid (or no grid), slice the brush where you want it to break, and keep the pieces (instead of pressing enter to delete\trim …press shift + enter to keep the pieces)12

CLIPPING

 

While they are still selected, press CONTROL + C

Press ESC

Press CONTROL + V

Open Texture Browser and make the texture “clip”3

Press H to hide it

Unfortunately, this part is time consuming..and there is no shortcut.

The reason you can not select all the pieces at the same time, is it will GROUP all the brushes together as a single brush, and will not break where you have cut it.

This is true for any Entity-script (from the Entity browser)

TRIGGER

Hilight one piece at a time of the wall and Press CONTROL + C

Press ESC

Press CONTROL + V

Open Entity Browser (N) and locate Trigger > Damage and double click it.

Repeat for all the other pieces.

 

Hilight all the TRIGGER pieces (now that it’s safe to) and press N to open Entity Info.

Targetname:           dmtrig

Add KVP:

Property / Key:

script_exploder      30

Using 2D mode, stretch the triggers so that they are slightly wider than the wall. (around 8 units)

The height is not important.

You can play with what triggers the breaking of the clip here. Can you shoot it with a gun, explosion..what damage does it need before it breaks. For this example, I don’t care how it breaks.

Accumulate is the damage it needs before it breaks. I don’t want the clip to still be there after I’ve shot the block, so I’m going to leave it on 1.

Once you have decided what is \ isn’t going to trigger the clip disappearing, press H to hide the Triggers.

Now hide all the Clips and triggers as we want to work on the wall.

N.B. I’ve done it this way on purpose. If you copy\paste a dynamic brush, the clip and trigger STAY as a dynamic brush..and this… is bad.

THE BREAKABLE WALL

Select a single piece of the brush you just cut, Go to Entity Browser, and select Dyn > BrushModel.4Repeat this for the remaining pieces. All the pieces will be highlighted a different color once they are a dyn_brushmodel.

Select all the pieces of the BrushModel (it’s safe to do so now) and press N to open Entity Info.

Targetname:           destructable

Add KVP

Property / Key:

script_exploder      30

The value “30” can be any number, just make sure when you do this to the next part of the tutorial, they are the same number, this is so they are connected in some way5Select all the pieces you want real-world type physics to apply to (gravity, movement, wind), and click the tickbox next to AUTO_ACTIVATE.

What this does is when one brush comes in contact with another, it will automatically activate the physics on the next brush. There are other options there you can play around with, but I can tell you that START_IN_PHYSICS does automatically activate physics before spawn, and it will ignore any collision meshes or clips you have in place, and pass all the way through it.

For the purpose of this tutorial, the only other options I will modify that is relevant is MASS and FRICTION.

Friction I will make 1.

Mass is measured in POUNDS. If you need to figure that out in Kilograms, then

1 POUND is 0.453592 Kilograms. – 10 Pound is 4.5kg ..and so on..

This is the weight of the pieces.

So in a wall, perhaps so the entire wall doesn’t fall over, you would make the bottom pieces heavier than the top pieces.

I am making all the pieces with an equal weight of around 40lb..so around 18kg.

FX

Here you can also add FX for an explosion.

In the destroyEfx field, I put /destruct/fx_vdest_car_exp.efx (A car explosion..)

I have left the sound out for this tutorial as the explosion has it’s own sound.

Special note:6These dynamic brushes are colliding. This will NOT compile. You must trim each piece so they do not intersect.

Scripting:

Add the lines in red:

mp_yourmapname.gsc

#using scripts\shared\exploder_shared;

#using scripts\mp\mp_michaelbayboom;

function main()

{

mp_michaelbayboom::main();

load::main();

 

mp_yourmapname_fx.gsc (ONLY NEEDED IF YOU ARE USING FX)

#using scripts\codescripts\struct;

#insert scripts\shared\shared.gsh;

#precache( “fx”, “destruct/fx_vdest_car_exp” );

function main()

{

level._effect[“fx_vdest_car_exp”] = “destruct/fx_vdest_car_exp”;

}

 

The above is using a car explosion. Wakka and I wanted to go all Michael bay on the wall blocks..hence the name of the script.

mp_yourmapname.zone:

scriptparsetree,scripts/mp/mp_michaelbayboom.gsc

//breakable wall (ONLY NEEDED IF YOU ARE USING FX)

fx,destruct/fx_vdest_car_exp.efx

//

 

Create a new file in your \Call of Duty Black Ops III\usermaps\mp_example\scripts\mp folder.

mp_michaelbayboom.gsc:

function main()

{

thread breakstuff();

}

function breakstuff()

{

damagetrigg = getent (“dmtrig”,”targetname”);

wallgood = getent (“wallgood”,”targetname”);

wallgood show();

damagetrigg waittill (“trigger”);

wallgood delete();

RadiusDamage( level.player.origin, 500, 10, 0, self );}

//RadiusDamage( level.player.origin, Radius, max damage, min damage, attacker );

That’s it.

Compile and test.