>> 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: Tricorder Puzzles

Putting It in the Map

The entity list in Radiant now includes puzzle_object. Put this object in the map and place it wherever it's supposed to go as usual. Here is a list of the key values you can set:

  • model – This is an optional parameter. If it is not set, then the puzzle_object will be invisible (this is for when you have a pre-built object like a computer console that you want the player to use, so you just place the puzzle_object in front of it). If this value is set to the desired TIKI file, then that model will be the puzzle_object and show up where you place it. The TIKI you specify has to be setup with specific animations in order for it to work properly (so these have to be setup in the actual TIKI file):
    • puzzle_idle – used for when the puzzle is sitting there waiting to be approached
    • puzzle_opening – used for when the player approaches the object. Normally used to ‘open' the object.
    • puzzle_waitingopen – this is the ‘open' idle for the object once the player has approached and is standing next to it.
    • puzzle_closing – used for when the player backs away from the object, solves the puzzle, cancels the puzzle, or fails the puzzle. Used to ‘close' the object.
    • puzzle_openon– When the puzzle is running, as in when you are using the tricorder on it.

The only TIKI that is used in EF2 that is setup properly for puzzle_objects is enviro/borg-sphere_shield-pannel_shield-pannel-wall.tik. In all other cases we just placed the puzzle_object next to a panel that needed to be used.

  • puzzleobject_opendistance – specifies the distance the player should be before the puzzle ‘opens'. The default is 200 units. NOTE: this only applies when you have set a TIKI to be used in the ‘model' keyvalue.
  • puzzleobject_canceledthread - This thread will be called when the player clicks on the ‘cancel' button in the puzzle UI. The cancel button is not available if there is a time limit or a ‘number of failed attempts before failure' value set (e.g. for the keypad puzzle).
  • puzzleobject_failedthread - Will be called when the player fails the puzzle proper. This happens when there is a time limit that expires, or, depending on the puzzle, if the player does something specifically wrong (e.g. routing power to a short circuit in a routing puzzle).
  • puzzleobject_itemusedthread - Will be called when the player successfully activates the puzzle object by scanning it with the Tricorder (or whatever object is set in the ‘puzzleobject_itemtouse' keyvalue). This is where you tell the puzzle to initialize and run one of the graphical UI puzzles.
  • puzzleobject_solvedthread - Will be called when the player successfully solves the puzzle.
    Example: value: modulate_done

    In the level script you can then write a function for "modulate_done"; for instance:

    void modulate_done()
    {
    centerprint("Modulation completed!");
    }

  • puzzleobject_itemtouse - Specifies which item the player must use on the puzzle object in order to activate it. Should probably always be set to ‘Tricorder'.
  • puzzleobject_timetouse – If this is set, then it will turn the puzzle_object into a modulation bar puzzle (where the bar comes up and progresses while you continue to use it). This is how many seconds the object has to be used continually to be solved. IMPORTANT by setting this, you are choosing to not have the puzzle_object use one of the UI puzzles (meaning keypad, wave modulation, or routing).

General Tricorder Puzzle Scripting Setup

First, you have to include the global_common script, before any other include statements:

#include "maps/global_scripts/global_common.scr"

Then, include the following two global scripts:

#include "maps/global_scripts/global_debugUtils.scr"
#include "maps/global_scripts/global_tricorderBase.scr"

And then include any particular puzzle scripts you are going to use on the level:

#include "maps/global_scripts/global_tricorderRoute.scr"
#include "maps/global_scripts/global_tricorderMod.scr"
#include "maps/global_scripts/global_tricorderKeypad.scr"

The script tri_route.scr is for the Signal Routing puzzle.
The script tri_mod.scr is for the Modulation puzzle.
The script tri_keypad.scr is, of course, for the Keypad puzzle.

Each script (i.e. each puzzle type) has its own set of functions that are used to setup an individual instance of a puzzle (see below).

Resetting a Puzzle

Whenever a puzzle is successfully completed, it will not allow the player to activate it again. If you want the puzzle_object to become available again, you need to call this function on it after it has been solved:

$targetnameOfPuzzleObject.puzzleobject_reset();

A puzzle will automatically reset its self if it was canceled or failed.

Setting Up Different Puzzle Types

After setting up the puzzle_object in the map file, now you have to setup and launch the puzzle from within your script. Here's how to do that with all the different types of puzzles. The particular function calls for each puzzle type should be run in the puzzleobject_itemusedthread function that gets called.

Keypad Puzzle Setup

These are the functions that you need to execute to setup the puzzle before you run it.

You need to set the secret code (which the player has to know or guess), like so:

tricorderKeypadSetup_setSecretCode( 5,4,3,2,1,0,0,0,0 );

The first zero in the sequence marks the end of the code, and all numbers after the first zero need to be zero (e.g. the above code is the 5-digit number ‘54321').

You need to set the style of the keypad (either federation or romulan). If you do not set this, the puzzle will default to federation. To change it to ‘romulan':

globalTricorderKeypad_SetType( "romulan" );

You then need to set if the player has ‘found' the secret code. If you do not set this, then it will default to FALSE:

tricorderKeypadSetup_setScannedCodeFlag( TRUE );

If this is set to TRUE, the player will see the code displayed at the bottom of the puzzle UI, and all they have to do is enter it. Otherwise it says ‘unknown.' This was used in EF2 where the player could scan other terminals in the level to retrieve the code, and then it would show up when they access the puzzle.

To run the puzzle once all parameters have been set:

thread tricorderKeypadRun( $targetnameOfPuzzle, 0, 3 );

The first parameter is a reference to the puzzle_object entity itself. The second parameter is the desired time limit in seconds that the player will have to enter the entire code (enter zero for no limit, meaning they'll have infinite time). The third parameter is how many times the player can hit a wrong button before the puzzle “fails” (in this example, 3 times). This means how many times a wrong entry can be pressed before the puzzle will fail out. So, in our example code of 54321, the player has 3 ‘wrong tries' before the puzzle fail. So if the player presses 7, then 4 as the first two digits, he's used up 2 of his 3 tries. If he then presses 5, the five will appear at the bottom of the puzzle UI. If the player were then to hit anything but 4, then they would use up their last try and the puzzle would fail. If you want the player to have infinite number of tries, set this parameter to zero.

Wave Modulation Puzzle Setup

These are the functions that you need to execute to setup the puzzle before you run it.

You need to set how many waves there are (1, 2, or 3):

tricorderMod_setNumWaves( 3 );

You will want to randomize all the values for the waves:

tricorderMod_setAllRandomParms();

This will set the puzzle that has to be solved to something random.

To run the puzzle once all parameters have been set:

thread tricorderModRun( $targetnameOfPuzzle, 0 );

The first parameter is a reference to the puzzle_object entity itself. The second parameter is the desired time limit in seconds that the player will have to modulate all the waves (enter zero for no limit, meaning they'll have infinite time).

Signal Routing Puzzle Setup

Design

This will is a visual interface puzzle where there is a graphical depiction of a circuit pathway that is currently broken. There will be:

  • A puzzle field grid that is 11 x 11, where each grid space contains a piece
  • A source side (on the left side of the field)
  • A destination side (on the right side of the field)
  • There can be up to three sources
  • There can be up to three destinations
  • There can be up to three types of transmitted signal. What this means is that each source can transmit one of three different types of signal, and each destination can receive one of three different types of signal. So for example, in a puzzle you could have 3 sources where 2 transmit green signal, and one transmits yellow, and you could have 3 destinations where 2 receive yellow, and one receives green.

The 11 x 11 puzzle field is a grid layout of various square pieces. The individual piece types are:

  • Single wire: A connection that passes a signal straight through from one side of the square to the opposite side of the square. Can be rotated in 90 degree increments.
  • Splitter wire: A connection that takes the incoming signal from one side of the square, and outputs it through the 2 sides that are perpendicular to the incoming side. Can be rotated in 90 degree increments.
  • Right angle wire: A connection that takes the incoming signal from one side of the square and passes it through another side of the square that's 90 degrees angled from the incoming side. Can be rotated in 90 degree increments.
  • Burned in piece: This can be any one of the 3 connection wire pieces (single, splitter, and right angle), but it has been burned into the circuit board and can not be rotated (it is stuck in its current orientation). The signal can still flow through the piece.
  • Bridge space: A connection where the horizontal pathway is independent from the vertical pathway. So two signals can go through the same square and they won't interfere with each other (they cross over each other). This piece can not be rotated.
  • Short circuit space: If a signal is routed into this piece, it will short circuit the entire puzzle and cause it to fail out.
  • Empty space: This is a blank square with nothing in it

The way the puzzle works is that by rotating the various pieces, you create connections from the left side (sources) to the right side (destinations). The destinations will each respond to a particular signal type. You have to route the proper signal to the proper destination. Once all the destinations have a signal flow of the needed type, then the entire puzzle will be solved.

If two different signal types intersect, the higher order power source will override the lower order power source. This is determined when you setup the sources by identifying them as power source 1, 2, or 3, 1 being the highest order source, and 3 being the lowest order source.

Implementation

Setup of a routing puzzle is accomplished with a few (baznillion) function calls. There is a discreet order to which they have to be called. Here is a sample sequence for a two source, two destination puzzle layout (all setup functions need to be called in-line, i.e. without the ‘thread' command):

tricorderRoute_reset();

tricorderRoute_setSource1Row( 5 );
tricorderRoute_setSource2Row( 8 );

tricorderRoute_setDestination1( 6, 5 );
tricorderRoute_setDestination2( 11, 8 );

tricorderRoute_beginDef();

tricorderRoute_setNextRow( piece1, piece2, piece3, piece4, piece5, piece6, piece7, piece8, piece9, piece10, piece11); //this function call is repeated 11 times, once for each row of the puzzle

tricorderRoute_Run( getcurrententity(), timelimit );

tricorderRoute_reset - This should be called every time as the first setup function for a routing puzzle. It resets the internal state of the puzzle to default before beginning the new puzzle definition. DO NOT START DEFINING THE PUZZLE UNTIL THIS HAS BEEN CALLED!

tricorderRoute_setSource1Row – Sets the row of the first source. There is a separate function for each source (just swap out the number 1 in the function name to be either 2 or 3). YOU CAN NOT HAVE MULTIPLE SOURCES ON THE SAME ROW!

tricorderRoute_setDestination1 – Sets the row of the first destination. The second parameter sets which source the player has to connect to this destination. In the example, since Source1Row is set to 5, setDestionation1( 6, 5 ) means that there is a destination node at row 6, and that the corresponding source is the one on row 5.

It's set up this way to allow you to have one, two or three destinations that have to be routed from one source (i.e. if you want to have one source signal that is split into three destinations). There is a separate function for each destination (just swap out the number 1 in the function name to be either 2 or 3). YOU CAN NOT HAVE MULTIPLE DESTINATIONS ON THE SAME ROW!

tricorderRoute_beginDef – Tells the script that you are now going to begin defining each row of the puzzle field. Each setNextRow function that follows will define a row of the puzzle going from left to right, starting in the upper left hand corner of the grid and working its way down. So the first setNextRow function will define row one, the next setNextRow function will define row two, the next setNextRow function will define row three, etc…. You keep doing this until all eleven rows have been defined

tricorderRoute_setNextRow – This function actually defines a row of the puzzle. The eleven parameters define the eleven columns within this row. The first parameter is the column at the far left, and each parameter after this defines the next column to the right. The number you enter for each parameter defines the piece that goes into that square. These are explained in the next section.

tricorderRoute_Run – This function runs the puzzle. The first parameter is a reference to the puzzle_object entity itself. The second parameter is the desired time limit in seconds that the player will have to solve the entire puzzle (enter zero for no limit, meaning they'll have infinite time).

Puzzle Field Creation

I recommend drawing out two 11 x 11 grids on paper to assist you in layout out routing puzzles. The first grid is meant for drawing out the puzzle pictorially, using lines and such to create what the puzzle will actually look like in the game. The seconrd grid is meant to be filled in with the numeric values of the pieces used in the top grid. This makes for easy reference when actually defining the puzzle field with the tricorderRoute_setNextRow setup functions in script. At the bottom is a reference table that has the numeric ID's of the individual pieces, which are what have to be passed into the tricorderRoute_setNextRow function.

The various puzzle pieces along with their IDs. Image courtesy of Tempest
Here is a copy of the numeric ID's of the individual pieces:

ID BURNED ID BURNED ID
0 16 Straight E-W 6 22 Tee !N 32 Empty
1 17 Straight N-W 7 23 Tee !E
2 18 Angle N-E 8 24 Tee !S
3 19 Angle E-S 9 25 Tee !W
4 20 Angle W-S 10 26 Bridge
5 21 Angle W-N 11 27 Short circuit

The numbers next to the piece descriptions are the piece ID's. The ID column contains the number of the piece in its normal state. The BURNED column is that same piece but in the burned state (meaning it can not be rotated, so hence the burned ID's for the bridge and short cut pieces are superfluous).

The direction of the piece is indicated by the compass directions in the pieces description (north is facing to the top of the screen, east is facing to the right side of the screen, south is facing to the bottom of the screen, and west is facing the left side of the screen).

For the Tee descriptions, the ‘!' represents ‘not'. So since these are the pieces that split the signal into two directions, this description means the one side of the piece that has no signal associated with it. So for example, ‘!N' means that there is no signal touching the north or top facing part of the piece. Meaning that the signal will travel through the S, E, and W sides of the piece.