>> Games >> Star Trek Elite Force II
| Summary |
System Requirements |
Genre: First Person Shooter
Platforms: PC, Mac
PC Publisher: Activision
Mac Publisher: Aspyr Media
Engine: Quake III, with Ritual's ÜBER Tools
ESRB Rating: Teen
Released: June 24, 2003 |
· DirectX 9.0 compatible 32MB video card
· Pentium III 600 or Athlon™ processor or higher
· 128MB of RAM
· Microsoft® Windows® 98/98SE/ME/2000/XP
· DirectX® 9.0 compatible 16 bit sound card
· DirectX® 9.0
(more...)
|
Create Your Entity That Will Follow A Path
 |
| Figure 1 |
 |
| Figure 2 |
|
In this case we are going to create three entities that will then
be attached to a fourth entity. The three enties will be different
pieces of a shuttle ship, the door, the exterior and interior. The
fourth entity will glue all those pieces together allowing us to control
the whole shuttle by only controlling the fourth entity. It will also
allow us to position the whole shuttle more easily in our level.
First, drag to create a small brush, then right click on it and turn
it into a script_model from the entity menu. Next type "model"
into the "key:" text box and then type the path of the model
you want it to use (Figure 1). In this tutorial it will be, "models/vehicle/e-shuttle-door.tik"
for the "value:" text box. Second, give it a targetname
of "shuttle_door".
Next, copy the new script_model you just created by pressing space
bar, edit the model "value:" so it says, "models/vehicle/e-shuttle-int.tik"
instead. Edit the targetname to say "shuttle_int".
Last piece of the shuttle, copy the previous script_model again and
edit the model value text box to say, "models/vehicle/e-shuttle-ext.tik".
Edit the targetname to say, "shuttle_ext".
You now have all the pieces of the shuttle and need to piece them
together so it looks right. Start with the door and line it up with
the interior of the shuttle in a side view. Once you get the door,
align the exterior to everything else.
Next you need to create a script_object entity the same way you started
to make the script_model (drag out a brush, choose script_object from
the entity menu). Texture the script_object with the "origin"
texture from the common texture directory. Give the script_object
a targetname of "shuttle_origin". Place the script_origin
anywhere you like that makes sense to you. In my example file, I placed
it on the front nose of the shuttle.
Create A Path For The Entity To Follow
Create an info_splinepath entity (Figure 2). Edit its entity properties
and give it a targetname of "path01". Add more info_splinepaths
where you want the shuttle to fly through. Make sure the first info_splinepath
entity "path01" has a target of the next info_splinepath.
Lets say, the second info_splinepath you add has a targetname of "path02".
Then the first info_splinepath will need to have a target of "path02".
Continue this linking of info_splinepaths for your entire path. If
you want it to loop to the beginning, make sure the last info_splinepath
targets the first info_splinepath. If you want the shuttle to stop
at the end of the entire path, the last info_splinepath should not
have any target specified.
Create Your Script
This is where it all comes together. The following comes directly
from the .scr script file that is included in the .zip file that you
can download at the end of this tutorial.
Bind each piece of the shuttle to the same script_object entity called
$shuttle_origin. The $shuttle_origin serves two purposes, one to act
as an origin for the shuttle and two, to make it easier to control
the whole shuttle object as one entity, instead of making each shuttle
piece follow the same path. You can think of the shuttle as a model
with different pieces you can glue together. The binding of the pieces
to $shuttle_origin makes $shuttle_origin glue the pieces together
to $shuttle_origin. So if you want move all the pieces of the shuttle,
you only have to tell the $shuttle_origin to move.
The first purpose in this example (act as an origin) is to position
the shuttle where we want it. Every object in the game has an origin,
lights, monsters, and the player has an origin too. You don't have
to use a script_object to get an origin, you could use a script_origin
entity. However, a script_origin entity is very small in size and
hard to see in the editor sometimes. With a script_object, you can
make it any size you want so you can find it in the editor easily.
You can also use the origin of one of the models, but it's not easily
visible in the editor.
$shuttle_door.bind($shuttle_origin);
$shuttle_ext.bind($shuttle_origin);
$shuttle_int.bind($shuttle_origin);
//make all the pieces non-solid
$shuttle_door.notsolid();
$shuttle_ext.notsolid();
$shuttle_int.notsolid();
wait( 1 ); //wait 1 second before the shuttle takes off after
the level loads.
//$shuttle_origin will play a sound of the shuttle moving
$shuttle_origin.playsound( "sound/vehicles/shuttlecraft/shuttle_decelerate.wav",
10 ,1 ,1024 );
$shuttle_origin.followpath( $path01 );
$path01 is the first info_splinepath entity with the targetname of
$path01 in the editor. This targets another info_splinepath entity
with a targetname of $t1. You can see this by hitting 'n' when the
info_splinepath entity is selected. It will say targetname and target.
That's all there is to it! Bind the pieces together and then have
them follow the path with the special .followpath() command. The code
needs to be inside a function, like main() before it can work. Take
a look at the included .scr file to see how I set it up.
This concludes the path following tutorial.
Tip
In the info_splinepath entities, you can use the angles "key:"
with "values:" such as "0 0 180" or "30 10
0" to manipulate the shuttles orientation as it follows the path.
Download Example Map
http://game.rbkdesign.com/ef2/example_maps/paths.zip
Includes (1) paths.bsp, (1) paths.map, (1) paths.scr
|