Unofficial Tribes 2 Coding FAQ Tribes 2 General Game Information Modifications Heads-Up-Displays Scripting/Coding Mapping Missions Custom Skin Creation Screenshots, duh! Links to Greater Sites Origional Tribes Page
Tribes 2 Links: Weapons Armor Vehicals Packs, Deployables Official Map Editor Guide Scripting
Tribes2 logo Team combat on an epic scale.

Let start out by giving credit to theTribes 2 Coding FAQ. This is a direct copy of there FAQ page. I hope they don't get made at me now for copying it since I gave them credit.

What do I need to get started?
Obviously, you need a working copy of Tribes 2. If you have been messing with your script files in the base directory you should reinstall and apply the latest patch. Make sure you patch your game BEFORE you start editing. You need a zip program like WinZip to extract the scripts. Also, you need a good plain text editor with search and replace features. The ability to search through multiple files at once will save you tons of time. Personally, I use Editplus 2. Others have suggested UltraEdit32 and Microsoft Visual Studio. David Dunscombe is working on a Tribes2 Code IDE. Beta versions can be found at or in the files section.

Where are the script files?
The scripts are located inside the scripts.vl2 file in your \Tribes2GameData.ase directory. All *.vl2 files are actually regular zip files with a renamed extension. You can use WinZip to open them. To get started, make a directory called whatever you want your mod to be names in your \Tribes2GameData directory. I will call the directory MyMod for the purpose of this FAQ. Now extract the scripts.vl2 file into the \Tribes2GameDataMyMod directory. Now your ready to get started.

Note: I recommend that newbie coders have two mod directories, one to serve as a test bed for modifications, and another with finalized code.

What are *.dso files?
A *.dso file is the compiled version of the corresponding *.cs file. If you want to distribute modifications without showing people your code, you can distribute the .dso file instead of the .cs file. Rumor has it that Dynamix will be switching to a one .dso file system for easier distribution.

What language are the scripts written in?
The scripts are not written in any existing programming language. They are written in a scripting language created by Dynamix (the developers). Therefore, there are no books you can buy to learn more about this specific language. The language does have a syntax that roughly resembles C, so if you learn more C you should have an easier time editing the scripts.

How do I test my modifications?
Create a shortcut to the Tribes2.exe file located in your \Tribes2GameData directory and place it wherever you want. Right-click on the shortcut and go to "Properties". Edit the "Target" line so that it has "-nologin -mod MyMod" at the end. Replace MyMod with the name of the directory you created in \Tribes2GameData. My target line looks like this (I put my scripts in a directory called "Evo"):
     C:\DynamixTribes2GameDataTribes2.exe -nologin -mod Evo
Now double-click the shortcut and the game will run using your mod.

How do I get a log of any errors my modifications generate?
You have to edit your console_start.cs file in your \Tribes2GameData directory to enable logging. Goto around line 135 and find the part that says:
   else if ( \$arg $= "-mod" && $hasNextArg )
      setModPaths( \$nextArg );
      \$i += 2;
All you have to do is add a line after \$i += 2; that says:
Any messages will be outputted to console.log in your \Tribes2GameData directory. You can safely leave this file modified and it shouldn't hurt anything.

How do I log function entry and exits?
Use the trace() function. To turn on function tracing, use:
And to turn it off, use:      trace(0);

How do I comment my scripts?
Anything after a "//" on a line is a comment and is ignored by the game. Simply place a "//" at the start of a line and put your comment after that. You can also put a comment after a statement:
     DoSomething();   // This code does XYZ
What are all the semicolons for?
Much like the C or C++ programming languages, the Tribes 2 scripting language requires that all commands end with a semicolon. The syntax is:
Forgetting a semicolon is probably the most common cause of errors in a newbie's script.

How do I declare a variable?
You are not required to declare variables in the Tribes 2 scripting language before you use them. You can start assigning them values.

What are the \$ and % symbols in the scripts?
When a percent sign (%) is used before a variable name, the variable is defined or accessed locally (exists only in that function). When a variable name is preceded by a dollar sign (\$), the variable is defined or accessed globally (visible to all functions). If anyone has further information on how these work, please let me know.

What is the syntax for switch and switch\$ statments?
Tribes2 switch statments act much like C switch statments except for one major difference. Since the Tribes2 scripting language does not have variable types, you must use switch to compare numerical data and switch\$ to compare strings. They are the switch equivalents of == and $= (see below). Here are some samples I pulled from various *.cs files:
From ChatGui.cs, this handles IRC commands:
        case "PING":
        case "PONG":
        // Removed other cases for length
           return false;
From LaunchLanGui.cs this handles the Launch menu:
        case 0:
        case 1: // Start Training Mission
        case 2:
        // Removed other cases for length
        case 12:
What is the syntax for if statments?
If statments use the same syntax as the C programming language. A few samples are below:
     if (myvar == 3)
        echo( "Myvar is 3." );
     if (name \$= "Bob" || name $= "Joe")
        echo( "Your name is either Joe or Bob." );
     if (name \$= "Fred")
        echo( "Hi, Fred!" ');
     } else {
        echo( "Hey!! Your not Fred!" );
Check the reference section for a list of operators you can use in if statments (comparison operators).

How do I add items or take away items from a player's inventory?
Use the incInventory and decInventory. Examples:
     // Add one grenade to player's inventory
     %player.incInventory(%gren, 1)
     // Subtract one unit of ammo from player's inventory
     %player.decInventory(%ammo, 1)
Which projectiles are fired by which gun?
These are the ones that have been found so far:
     ELFProjectile         - Elf gun
     EnergyProjectile      - Blaster
     GrenadeProjectile     - Grenade Launcher
     GrenadeProjectile     - Mortar
     SeekerProjectile      - Missile Launcher
     LinearFlareProjectile - Plasma Gun
     SniperProjectile      - Laser Rifle
     TargetProjectile      - Targeting Laser
     LinearProjectile      - Disc Launcher
     TracerProjectile      - Chaingun
     ShockLanceProjectile  - ShockLance
Which vehicles are derived from which datablocks?
     ScoutVehicle      - Wildcat Grav Cycle
     AssaultVehicle    - Beowulf Assault Vehicle
     MobileBaseVehicle - Jericho MPB
     ScoutFlyer        - Shrike Scout Flier
     BomberFlyer       - Thundersword Bomber
     HAPCFlyer         - Havok Heavy Transport Flier