>> 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: Creating Lifts

Overview

Figure 1
Figure 2
Figure 3
Figure 4
The goal of this tutorial will be to make the platform outlined in Figure 1 to reach the upper level whenever the player will touch it. There will be a 1 second delay before the platform starts moving, and it will take 3 seconds for it to reach the upper level. The delay between each trigger event will be of 3 seconds as well.

Scripting is not a mandatory step to create lifts; the map "dm_ctf_station" that was supplied with the GDK illustrates this fact. However, designing them this way will grant you a greater ability to adjust their behaviour quickly, without having to recompile your map whenever you change a parameter.

Create Your Lift

Create a brush that will represent the lift. Create an other one whose height will be equal to the distance that the lift will have to travel. Texture it with the "moveclip" shader, available under the "common" texture set. This brush will prevent any player from being crushed by the lift. If the player bumps into it, the lift is ordered to come down if it was upstairs and the player downstairs (Figure 2).

Select both these brushes. Turn the selection into a "script_object" entity so we will be granted to control the behaviour of the lift via the map script. Give it a targetname, e.g. "platform" (Figure 3).

Create Your Script

This part will be very simplified because I coded a new global function that you will be able to use straight in any of your levels to achieve lifts responsive to a touch event. This global function is implemented within the file "global_user.scr"; in order to run the test map, you will have to put the global_user.scr script into the "maps\global_scripts" directory. If you plan to release levels using this function, you will have to redistribute this file along with it.

In Figure 4 you can see there is not much to write. The #include line tells the script parser the location where the global_user.script file can be found. The "globalUser_OnTouchLift()" function is defined within global_user.scr and can be accessed through the lift.scr file. The parameters supplied to this function through lift.scr configure the behaviour of the lift. To get a thorough description of them, check the file "global_user.scr" and read the supplied comments. However, it is not necessary to understand or even look at the global_user.scr file. The only scripting you have to do is in your level script to control the lift as explained below.

In your level script you will need to call the function "globalUser_OnTouchLift() and supply it with specific arguments or otherwise known as paramters. Below is an exact copy of what you will find in the lift.scr.

// $platform: the entity targetname of the lift
// 0: location of the platform, 0 is downstairs and 1 is upstairs
// 384: total height the platform moves up and down
// 3: time to reach destination (in seconds)
// 3: delay before making platform triggerable again after the
// destination is reached
// 1: delay before platform starts moving when triggered to move
// 816: sound scope in game units (farthest distance away sound can be heard)
// .8: sound volume
// trigger sound
// move sound
// stop sound
//
// the keyword "thread" is not mandatory here, but it would have been
// if there had been several lifts using this function in the test map

thread globalUser_OnTouchLift($platform,
0,
384,
3,
3,
1,
816,
.8,
"sound/environment/switches/switch_01.wav",
"sound/environment/machine/solanlift.wav",
"sound/environment/machine/solanlift_stop.wav");

To make your lift work you only need to modify the values typed above.

For example, if you wanted the lift to move faster, you can change the first number "3" to "1" so that it takes 1 second to reach its destination. Then you can change the second number "3" to "1" to make the delay of time 1 second before one can trigger the lift again. If you wanted the lift to move only 64 units high, change the number "384" to "64".

This concludes the tutorial, if you have any questions, email Bluehair at bluehair@wanadoo.fr

Download Example Map

http://game.rbkdesign.com/ef2/example_maps/lift.zip

Includes (1) lift.bsp, (1) lift.map, (1) lift.scr, (1) global_user.scr