>> 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...)
Tutorial: First Steps with Elite Force II Scripting   

The Goal

Figure 1
Figure 2
Figure 3

The goal of this tutorial is to create a short scripted sequence in which a NPC walks a few steps and makes a gesture once there.

What You Need
  • This map. Right click and save it to your Elite Force/base/maps folder.
Let's Get Started

First you should open up the firststeps.map you downloaded. It should look something like Figure 1.

You see a simple room with two light entities (they've nothing to do with the script, they're just there for, well, light). You can also see the info_player_start (that's where the player is located when the level loads). Then there's a NPC and an info_pathnode. As mentioned ealier we want to have the NPC (in our case Picard) walk forward and make a gesture. The info_pathnode marks the place where Picard is supposed to walk to.

First we have to set up some things inside the map. The NPC and the info_pathnode must have names so they can be reffered to from the script.

We'll start with Picard. Left-click on him while holding down the shift key. The NPC is now selected. Push the 'n' key and enter „targetname“ in the key field and „picard“ in the value field (without the quotes). Press return if you have not already done so (also see Figure 2).

Now do the same with the info_pathnode (select it, press n) but enter „nav1“ instead of „picard“ (Figure 3). Both entities now have targetnames. All that's left to do in Radiant is to compile the map: Open the „Build Map“ menu and click on „Normal Compile“.

What's missing now is the actual script. Open up your favorite text editor and enter the following lines:

void main()

{

wait(2);

$picard.ai_off();

$picard.walkto("$nav1");

}

Save the file into the base/maps folder under the name „firststeps.scr“(the name has to be the same as the map – apart from the extension – or EF2's compiler won't find the script). In case your were wondering, the $s are used when an entity from the map is meant (which picard of course is). We have to switch the ai off, because he wouldn't comply with our walkto order otherwise.

Now start Elite Force 2. Open the console and enter „devmap firststeps“ (again without the quotes). You will notice that Picard walks towards you, but then turn his back on you. We don't want that (would be strange for Picard to be so undiplomatic). It's caused by the info_pathnode. We didn't give it an angle key, so EF2 assumes we want Picard to turn to a yaw of zero, which in our example means that Picard turns away from us. To correct that, open up Radiant again, bring up the entities menu for the info_pathnode and give it an angle of 180. The quickest way to to that is by clicking on the 180 near the bottom of the screen. While we're at it we can also add the second thing we want to accomplish in our little tutorial: The gesture.

To accomplish this we have to add two lines to our script. It should now look like this:

void main()

{

wait(2);

$picard.ai_off();

$picard.walkto("$nav1");

waitfor($picard);

$picard.animateonce( "cin-m3_bail" );

}

The waitfor line tells the script to wait until Picard is finished with what he is doing (in our case walking to the info_pathnode). Then he is to perform the animation cin-m3_bail3 once. If we used the method anim he would have performed this animation infinitely. You can view all available animations in Radiant by bringing up the entities window and pressing + or – under „anim“. To see the animation play out, simply press ALT-a (Figure 3).

Before we can test the map again however there's something we have to do first: Delete the file firststeps.pth from your base/maps folder . I'm not entirely sure why, but if you don't do this the change in the angle will not be noticed and Picard will continue to turn to yaw 0 (i.e away from you). After you've deleted this file, everything should work fine (don't worry, you're causing no damage by deleting it. If EF2 doesn't find this file, it will create a new one – which is what we want). Now test it and everything should work as promised.

Download Example Map

http://home.in.tum.de/~hudelmai/tutorials/firststeps.map