Exploders can be used in Medal of Honor in many different ways. The first is pretty obvious… to cause geometry to blow up. Other uses include making a brush appear to have a new texture (without changing the shape of the brush) or moving entities around in the environment. Making exploders requires building knowledge in Radiant and a little bit of scripting knowledge on the side.
Let’s start with the most basic reason you’ll want to use exploders… to cause destruction. When blowing something up in MOH, you’re not technically breaking something apart (like if you attached a stick of dynamite to a wall). What you’re actually doing is swapping out geometry while covering it up with explosion effects.
There are three main “tags” you’ll need to use in making something blow up: exploder, explodersmashed, & exploderchunk.
Okay… enough with the prologue. Let’s get to the smashy-smashy. Start with something simple… like a door.
1. Build the door in both the “before” and “after” states:
2. Select the pre-explosion door and give it a classname of func_fencepost and a $targetname of exploder. (Ignore the func_exploder tag, you won’t use it even though it seems like you should.) Select the post-explosion door and give it a classname of script_object and a $targetname of explodersmashed.
3. Next, make all of the pieces you want to fly as part of the explosion effect. Select these individually and give them each a classname of script_object (you have to make each piece a script_object individually… it won’t work otherwise). Select all the chunks and give them a $targetname of exploderchunk.
4. You’ll need to give the exploderchunks a trajectory reference. To do this, you use script_origins. You’ll need a script_origin with an individual targetname for each exploderchunk. Follow these steps:
5. Finally… if all the pieces are part of the same explosion (as is the case in this example), select everything, bring up the entity window by hitting N on the keyboard, and give them a key of #set and a value of 1 (or any arbitrary number you choose). Move the exploded door and the chunks so that they occupy the same space as the door in the “before” state.
If you want an effect to play, you can add an animate_fx by right-clicking and dropping one at the site of the explosion. I placed an animate_fx_explosion-wallexploder at the center of the door. Give it the same key of #set and a value of 1 as you did on all the other parts of the exploder. It will also need a $targetname of exploderfire.
So now I suppose you want to see the thing actually go boom. The simplest way to achieve this it to cause an explosion via a projectile (rockets, grenades, etc.). Place a brush that you’ll be able to aim at in the engine. Then place a trigger_multiple around the brush. Click the “PROJECTILES” flag and give the trigger a key of setthread and a value of whatever you want (I used boom).
Here’s where the scripting fun happens. I’m going to assume you have a general scripting knowledge here, so I’m only going to tell you the specific lines you’ll need to add to make the exploder work. First, after the level waittill prespawn, you’ll need to add this line in the list of global scripts you execute:
exec global/exploder.scr
Next… add the following lines in the main body of your script (after the level waittill spawn):
//---------------------------------------------------------- //Destroy the door //---------------------------------------------------------- boom: thread global/exploder.scr::explode 1 end
The top three lines are just a convention we use so that the portion of script you’re looking for is easy to find. “Boom” refers to the setthread you gave the trigger. The “1” in the fifth line refers to the #set you gave to all the parts of your exploder. If all your geometry has a key of #set and a value of 2, then the line should read thread global/exploder.scr::explode 2. Got it?
Now, if everything is set up correctly, you should be able to compile the map, go into it in the engine and cause some destruction. If you have cheats enabled, you can just give yourself a bazooka and fire away, or you could do what I did and drop a bazooka into the level.
If you need any reference material, you can view the exploder_tutorial map included with this doc. The first room features the door I just created and the second room features a more elaborate explosion as an example of some of the things that can be done with exploders.
Have fun!