mohaa-spearhead-sdk/tutorials/exploder_tutorial.html
2003-02-06 00:00:00 +00:00

128 lines
No EOL
7.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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… 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>
Lets start with the most basic reason youll want to use exploders… to cause destruction. When blowing something up in MOH, youre not technically breaking something apart (like if you attached a stick of dynamite to a wall). What youre actually doing is swapping out geometry while covering it up with explosion effects. <br>
<br>
There are three main “tags” youll need to use in making something blow up: <i>exploder, explodersmashed, & exploderchunk. </i>
</P>
<ul>
<li><b><font color=red>Exploder</font></b> This is the <font color=red>targetname</font> you give to your geometry in the “before” state. Its used on geometry given the <font color=blue>classname</font> of <font color=blue>func_fencepost</font> (even if its not a fence).
<li><b><font color=red>Explodersmashed</font></b> This is the <font color=red>targetname</font> given to your geometry in the “after” state. Its 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> 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. Its also used on geometry given the <font color=blue>classname</font> of <font color=blue>script_object</font>.
</ul>
<p>
Okay… enough with the prologue. Lets get to the smashy-smashy. Start with something simple… like a door.
<br>
1. Build the door in both the “before” and “after” 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 wont 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… it wont work otherwise). Select all the chunks and give them a <font color=red>$targetname</font> of <font color=red>exploderchunk</font>.
<br>
<br>
4. Youll need to give the exploderchunks a trajectory reference. To do this, you use script_origins. Youll 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 dont 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… 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 “before” 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 youll be able to aim at in the engine. Then place a <font color=blue>trigger_multiple</font> around the brush. Click the “PROJECTILES” 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>
Heres where the scripting fun happens. Im going to assume you have a general scripting knowledge here, so Im only going to tell you the specific lines youll need to add to make the exploder work. First, after the level waittill prespawn, youll 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… 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 youre 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?
<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>