mohaa-spearhead-sdk/tutorials/exploder_tutorial.html

128 lines
7.3 KiB
HTML
Raw Normal View History

2003-02-06 00:00:00 +00:00
<html>
<head>
<title>MOHAA - SDK</title>
</head>
<body>
<Font size=+3><u><b>Exploder Tutorial</b></u></Font>&nbsp;(aka Make Things Go Boom!)
<br>
<p>
Exploders can be used in Medal of Honor in many different ways. The first is pretty obvious<75> 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.
<br>
Let<EFBFBD>s start with the most basic reason you<6F>ll want to use exploders<72> to cause destruction. When blowing something up in MOH, you<6F>re not technically breaking something apart (like if you attached a stick of dynamite to a wall). What you<6F>re actually doing is swapping out geometry while covering it up with explosion effects. <br>
<br>
There are three main <20>tags<67> you<6F>ll need to use in making something blow up: <i>exploder, explodersmashed, & exploderchunk. </i>
</P>
<ul>
<li><b><font color=red>Exploder</font></b> <20> This is the <font color=red>targetname</font> you give to your geometry in the <20>before<72> state. It<49>s used on geometry given the <font color=blue>classname</font> of <font color=blue>func_fencepost</font> (even if it<69>s not a fence).
<li><b><font color=red>Explodersmashed</font></b> <20> This is the <font color=red>targetname</font> given to your geometry in the <20>after<65> state. It<49>s used on geometry given the <font color=blue>classname</font> of <font color=blue>script_object</font>.
<li><b><font color=red>Exploderchunk</font></b> <20> This is the <font color=red>targetname</font> given to the geometry you want to fly through the air as part of the explosion effect. It<49>s also used on geometry given the <font color=blue>classname</font> of <font color=blue>script_object</font>.
</ul>
<p>
Okay<EFBFBD> enough with the prologue. Let<65>s get to the smashy-smashy. Start with something simple<6C> like a door.
<br>
1. Build the door in both the <20>before<72> and <20>after<65> states:
</p>
<p align = center>
<b><font size = -1>
</font></b>
<img src="exploder_tutorial/1-1.jpg">
</P>
<p>
2. Select the pre-explosion door and give it a <font color=blue>classname</font> of <font color=blue>func_fencepost</font> and a <font color=red>$targetname</font> of <font color=red>exploder</font>. <i>(Ignore the func_exploder tag, you won<6F>t use it even though it seems like you should.)</i> Select the post-explosion door and give it a <font color=blue>classname</font> of <font color=blue>script_object</font> and a <font color=red>$targetname</font> of <font color=red>explodersmashed</font>.
<br>
<br>
3. Next, make all of the pieces you want to fly as part of the explosion effect. Select these <i><b>individually</b></i> and give them each a <font color=blue>classname</font> of <font color=blue>script_object</font> (you have to make each piece a script_object individually<6C> it won<6F>t work otherwise). Select all the chunks and give them a <font color=red>$targetname</font> of <font color=red>exploderchunk</font>.
<br>
<br>
4. You<6F>ll need to give the exploderchunks a trajectory reference. To do this, you use script_origins. You<6F>ll need a script_origin with an individual targetname for each exploderchunk. Follow these steps:
</p>
<ul>
<li>Right-click on the grid and drop in a script_origin.
<li>Select the chunk you want to target this origin.
<li>Select the script_origin.
<li>Hit Ctrl and K on the keyboard to connect the pieces.
<li>Adjust the trajectory to an angle you want the chunk to fly by moving around the script_origin. Generally speaking, it looks better to have the smallest pieces travel the farthest.
<Li>I generally hide the pieces after their connected so I don<6F>t end up connecting chunks to the same origin.
<li>Rinse, repeat until all the chunks have script_origins connected to them.
</ul>
<p align = center>
<b><font size = -1>
</font></b>
<img src="exploder_tutorial/1-2.jpg">
</P>
<p>
5. Finally<6C> 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 <font color=green>key</font> of <font color=green>#set</font> and a <font color=green>value</font> of <font color=green>1</font> (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 <20>before<72> state.
<br>
<br>
If you want an effect to play, you can add an <i>animate_fx</i> by right-clicking and dropping one at the site of the explosion. I placed an <i>animate_fx_explosion-wallexploder</i> at the center of the door. Give it the same <font color=green>key</font> of <font color=green>#set</font> and a <font color=green>value</font> of <font color=green>1</font> as you did on all the other parts of the exploder. It will also need a <font color=red>$targetname</font> of <font color=red>exploderfire</font>.
<br>
<br>
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<6F>ll be able to aim at in the engine. Then place a <font color=blue>trigger_multiple</font> around the brush. Click the <20>PROJECTILES<45> flag and give the trigger a <font color=green>key</font> of <font color=green>setthread</font> and a <font color=green>value</font> of whatever you want (I used <font color=green>boom</font>).
<br>
<br>
Here<EFBFBD>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<6F>ll need to add to make the exploder work. First, after the level waittill prespawn, you<6F>ll need to add this line in the list of global scripts you execute:
</p>
<pre>
<i><font color=blue>
exec global/exploder.scr
</font>
</i>
</pre>
<p>
Next<EFBFBD> add the following lines in the main body of your script (after the <i>level waittill spawn</i>):
</p>
<pre>
<i><font color=blue>
//----------------------------------------------------------
//Destroy the door
//----------------------------------------------------------
boom:
thread global/exploder.scr::explode 1
end
</font>
</i>
</pre>
<br>
<p>
The top three lines are just a convention we use so that the portion of script you<6F>re looking for is easy to find. <20>Boom<6F> refers to the setthread you gave the trigger. The <20>1<EFBFBD> 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?
<br>
<br>
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.
<br>
<br>
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.
<br>
<br>
Have fun!
</p>
</body>
<p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</p>
<pre>
<i><font color=blue>
</font>
</i>
</pre>