ef2-ubertools-gdk/Documentation/content/scripting_tripwires.html
2003-08-18 00:00:00 +00:00

299 lines
18 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ÜberTools Game Development Kit</title>
<link rel="stylesheet" href="style.css">
<script type="text/javascript">
/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}
function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
if(el.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu") //DynamicDrive.com change
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<a name="top"></a>
<table width="702" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><img src="../images/header.jpg" width="702" height="101" border="0"></td>
</tr>
<tr>
<td width=158 valign="top"><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" class="menu">
<!-- Keep all menus within masterdiv-->
<div id="masterdiv">
<img src="../images/navigation.jpg" width="158" height="27"><br>
UberTools GDK
<div class="menutitle" onclick="SwitchMenu('sub0')">&raquo; Introduction &amp; Contents</div>
<span class="submenu" id="sub0">
&nbsp;&nbsp;&nbsp;&nbsp;<a href="../start.html">Introduction</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="../start.html#2">Utilities</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="../start.html#3">Source Files</a><br>
</span>
<br>Level Design<br>
<div class="menutitle" onclick="SwitchMenu('sub1')">&raquo; Setting Up UberRadiant</div>
<span class="submenu" id="sub1">
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_setup.html">That Scary Error Msg</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_setup.html#2">General Tab</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_setup.html#3">Display Tab</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_setup.html#4">User Interface Tab</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_setup.html#5">Keyboard Shortcuts Tab</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_setup.html#6">Colors Tab</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_setup.html#7">Game / Paths Tab</a><br>
</span>
<div class="menutitle" onclick="SwitchMenu('sub2')">&raquo; Building Your First Room</div>
<span class="submenu" id="sub2">
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_firstroom.html">Editor Interface Basics</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_firstroom.html#2">Choosing Your Textures</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_firstroom.html#3">Building The Room</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_firstroom.html#4">Adding a Light</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_firstroom.html#5">Adding a Player Start</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_firstroom.html#6">Compiling Your Level</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_firstroom.html#7">Viewing the Level</a><br>
</span>
<div class="menutitle" onclick="SwitchMenu('sub3')">&raquo; Constructing Terrain</div>
<span class="submenu" id="sub3">
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_terrain.html">Setting up the Tools</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_terrain.html#2">Creating Terrain</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_terrain.html#3">Modifying the Textures</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="radiant_terrain.html#4">Adding More Terrain</a><br>
</span>
<div class="menutitle" onclick="SwitchMenu('sub4')">&raquo; Additional Reference</div>
<span class="submenu" id="sub4">
&nbsp;&nbsp;&nbsp;&nbsp;<a href="ldesign_lighting.html">Lighting System</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="ldesign_terrain.html">Terrain Texture Blending</a><br>
</span>
<br>Scripting<br>
<div class="menutitle" onclick="SwitchMenu('sub5')">&raquo; Scripting Tutorials</div>
<span class="submenu" id="sub5">
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_syntax.html">Scripting Syntax</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_waves.html">Spawning Waves</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_flying.html">Creating Flying Creatures</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_tripwires.html">Setting Up Tripwires</a><br>
</span>
<div class="menutitle" onclick="SwitchMenu('sub6')">&raquo; Global Script Synopsis</div>
<span class="submenu" id="sub6">
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_globalscripts.html">Introduction</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_globalscripts_accelmove.html">global_accelerated</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_globalscripts_accelmove.html">Movement.scr</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_globalscripts_archetype.html">global_archetype.scr</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_globalscripts_array.html">global_array.scr</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_globalscripts_cinefx.html">global_cinematicFX.scr</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_globalscripts_common.html">global_common.scr</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_globalscripts_debug.html">global_debugUtils.scr</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_globalscripts_flyin.html">global_flyin.scr</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_globalscripts_math.html">global_math.scr</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_globalscripts_ploadout.html">global_playerLoadout.scr</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_globalscripts_soundpan.html">global_soundPan.scr</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_globalscripts_spawnwave.html">global_spawnWave.scr</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_globalscripts_transport.html">global_Transport.scr</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="scripting_globalscripts_tripwire.html">global_tripwire.scr</a><br>
</span>
<div class="menutitle" onclick="SwitchMenu('sub7')">&raquo; Classes Reference</div>
<span class="submenu" id="sub7">
&nbsp;&nbsp;&nbsp;&nbsp;<a href="allclasses_g.html">Game Module</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="allclasses_cl.html">Client Module</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="allclasses_cg.html">Client Game Module</a><br>
</span>
<br>Older Documentation<br>
<div class="menutitle" onclick="SwitchMenu('sub8')">&raquo; Heavy Metal FAKK2</div>
<span class="submenu" id="sub8">
&nbsp;&nbsp;&nbsp;&nbsp;<a href="fakk2_camera.html">Camera Documentation</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="fakk2_clientsidecmds.html">Client Side Commands</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="fakk2_gui.html">GUI Documentation</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="fakk2_ingameutils.html">In-Game Utilities</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="fakk2_max2skl.html">MAX2SKL Reference</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="fakk2_shadermanual.html">Shader Manual</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="fakk2_soundsystem.html">Sound System</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="fakk2_tiki.html">TIKI Model System</a><br>
</span>
<br>Other<br>
<div class="menutitle" onclick="SwitchMenu('sub9')">&raquo; Web Links &amp; Credits</div>
<span class="submenu" id="sub9">
&nbsp;&nbsp;&nbsp;&nbsp;<a href="other_links.html">Web Links</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="other_credits.html">Credits</a><br>
</span>
</div>
</td>
</tr>
</table></td>
<td width="13" background="../images/vert_line.jpg"><img src="../images/vert_line.jpg" width="13" height="1"></td>
<td valign="top" width="533"><p class="header"><br>
setting up tripwires</p>
<p>Dependencies:</p>
<blockquote>
<p class="menu"> #include &quot;maps/global_scripts/global_common.scr&quot;</p>
</blockquote>
<p>Actual script file:</p>
<blockquote>
<p class="menu"> #include &quot;maps/global_scripts/global_tripwire.scr&quot;</p>
</blockquote>
<p>This script was created to help automate the usage of laser tripwires.
The tripwire is basically a beam emitted from a source that moves around.
If the player touches the beam, then he'll take some damage, and possibly
trigger other events based upon what the level designer needs to happen.</p>
<p class="subheader">Implementing Tripwires</p>
<p> To implement a tripwire, they need to specifically consist of the following:</p>
<ol>
<li> <strong>Source object:</strong><br>
A script_object or script_model that represents where the tripwire is
emitting from. <br>
<br>
</li>
<li> <strong>Beam object:<br>
</strong> A script_object, script_model, or FX that represents the beam
emitting from the source.<br>
<br>
</li>
<li> <strong>Hurt object:</strong><br>
A trigger_hurt around the area where the beam object will be. This is
the part that the player can walk through. Set all the damage values
accordingly for how much damage you want it to do. If you would like
the tripwire to trigger some event when the player touches the trigger_hurt,
you can use the 'thread' keyvalue to have it execute a function in your
script. Keep in mind that it will execute that function every time the
player triggers the trigger_hurt, so you'll have to account for this
in the function you execute from the trigger_hurt.<br>
<br>
</li>
<li><strong> Origin object:<br>
</strong> A script_origin that all entities in the group are bound to.
The origin must target the first node in the path (see next item). The
origin must also be in the exact same place as the first node in the
path.<br>
<br>
</li>
<li><strong> Tripwire path possibility #1:</strong><br>
A path of info_notnull entities linked CTRL+K style (target to targetname).
If you do not loop the path (meaning have the last node in the path
target the first node in the path), then the tripwires will automagically
teleport back to the first node after they hit the last.<br>
<br>
</li>
<li><strong> Tripwire path possibility #2:<br>
</strong> A splinepath that is linked CTRL-K style (target to targetname).
If you do not loop the path (meaning have the last node in the path
target the first node in the path), then the tripwire will stop when
it reaches the end of the path</li>
</ol>
<p><br>
In order for all of the objects to be properly bound together, they all
have to be targetnamed properly. First, you need to think of a unique
targetname to give the source object. So for example, let's give it a
targetname of 'wire1'. The beam object then needs to have a targetname
that begins with the unique targetname from the source object, with an
'_beam' appended onto it. So in this example, the beam object would have
a targetname of 'wire1_beam'.</p>
<p>The origin object targetname needs to follow the same convention, but
with an '_origin' appended onto the end of it. So in this example, the
origin object would have a targetname of 'wire1_origin'. The hurt object
targetname needs to follow the save convention, but with a '_hurt' appended
onto the end of it. So in this example, the hurt object would have a targetname
of 'wire1_hurt'.</p>
<p>After giving all the objects the proper targetname, then you need to
lay out a path in the editor. If you want a simplisitc path where the
objects follow a straight line from one point to the next, setup a series
of info_notnull's and link them together using the CTRL+K method in radiant.
If you want a more complex path where the object curves and accelerates
around, then setup a series of info_splinepath's and link them together
using the CTRL+K method in radiant. After creating the path, use the CTRL+K
method to link the origin object to the first node of the path.</p>
<p>In script, somewhere before you actually have the tripwire start running,
you need to call the setup function on it.</p>
<blockquote>
<p class="menu">globalTripwire_Setup( basename, thespeed );</p>
</blockquote>
<p>The 'basename' parameter is the string value of the unique targetname
you gave the source object (without the dollar sign). So with our example
from earlier, this would be &quot;wire1&quot;. The 'thespeed' parameter
is how fast you want the object to travel along the path.</p>
<p class="subheader">Starting Tripwires</p>
<p> When you're ready to get it running along it's path, there are two ways
to do this depending upon whether you wish the tripwire to follow a path
of info_notnull's, or info_splinepaths.</p>
<p><strong>For info_notnull's:</strong></p>
<p> Run this function in your script:</p>
<blockquote>
<p class="menu">globalTripwire_Run( basename );</p>
</blockquote>
<p>The 'basename' parameter is the string value of the unique targetname
you gave the source object (without the dollar sign). So with our example
from earlier, this would be &quot;wire1&quot;. You will probably want
to run this function parallel to other functions (i.e. with the 'thread'
command), because this function does not return once it's executed.</p>
<p><strong>For info_splinepath's:</strong></p>
<p> Call the follow command directly on the origin object like this:</p>
<blockquote>
<p class="menu">$wire1_origin.followPath( $targetnameOfFirstSplineNode
);</p>
</blockquote>
<p class="subheader">Stopping Tripwires</p>
<p>When you want the tripwires to stop, there are 2 ways to do this depending
upon whether you had it following a paht of info_notnull's, or info_splinepath's.</p>
<p> <strong>For info_notnull's:</strong></p>
<p> Run this function in your script:</p>
<blockquote>
<p class="menu">globalTripwire_Halt( basename );</p>
</blockquote>
<p>The 'basename' parameter is the string value of the unique targetname
you gave the source object (without the dollar sign). So with our example
from earlier, this would be &quot;wire1&quot;.</p>
<p> <strong>For info_splinepath's:</strong></p>
<p> Call the follow command directly on the origin object like this:</p>
<blockquote>
<p class="menu">$wire1_origin.endPath();</p>
</blockquote>
<p>In both of these instances, you have to handle the beam and trigger_hurt
yourself. So you'll either have to remove them, or hide and make them
notsolid.</p>
<p>&nbsp;</p></td>
</tr>
<tr>
<td colspan="3"><img src="../images/footer.jpg" width="702" height="36" border="0" usemap="#Map"><br>
<img src="../images/hor_line.jpg" width="702" height="1"></td>
</tr>
<tr>
<td colspan="3" class="legal"><table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td class="legal"> Copyright &copy;2003 Ritual Entertainment, Inc. All rights reserved.<br>
Please do not email Ritual Entertainment with questions about the
UberTools Game Development Kit. It is provided as is and is not supported by Ritual Entertainment.</td>
<td><a href="http://www.ritual.com/tech/overview.html" target="_blank"><img src="../images/uber_logo.jpg" width="43" height="56" hspace="4" border="0"></a></td>
<td><a href="http://www.ritual.com" target="_blank"><img src="../images/ritual_logo.jpg" width="100" height="56" hspace="4" border="0"></a></td>
</tr>
</table>
<p align="center">&nbsp;</p></td>
</tr>
</table>
<map name="Map">
<area shape="rect" coords="601,10,693,28" href="#top">
</map>
</body>
</html>