General
Legends Website
Tutorial & Skiing
Legends FAQs
Player Configuration
Legends Teams List
How to Host
Server List Backup

Add-Ons
New Maps
New Skins
New Voices
Player Scripts
Server Scripts & Mods

Modding
Legends Mapping Guide
Legends Scripting Guide
Creating Team Skins
Creating Voice Packs

Gameplay Guide
Legends Guide

Linux
Installation Instructions
Installer Script
Package Creator Scripts
Legends Distro Status

Legends Scripting Project

This is a guide to document how to make and modify Legends scripting. Legends uses TorqueScript which has very similar syntax to C. TorqueScript files use the .cs file extension, however, many files listed here are .unf files. An UNF is just a ZIP file, you can open it with 7zip, WinZip, etc.

Scripting Resources

Official documentation and resources for the Torque Gaming Engine can be found at the Garage Games website: TGE SDK Documentation (Note that some sections are not available for public viewing). For scripting, you will want to read Chapter 5: Torque Script. The section The TorqueScript Language is all you need to get started, the other sections will probably just confuse you.

Exploring Legends Scripting

A great deal of Legends is scripted, which is good for modding because you can view the scripting. The Torque Gaming Engine is proprietry, so it is not possible to mod any part of the game that is in the engine, but you can call functions in the engine through the scripting. All of the scripts for Legends are contained in /usr/games/legends/legends/scripts.unf. Unzip this file and you'll be able to see all the scripting for Legends.

Inside scripts.unf are two directories - client and server. Most of the code is in the server section, which mostly defines the gameplay - weapons, gametypes, modules, armour, flags, switches, inventories, generators, forcefields, etc. The client section mainly defines the GUIs, HUDs (on screen displays, such as weapon HUD, chat HUD, etc), and user interface.

In-Game Console

TorqueScript commands can be entered in the in-game console. Press the backquote (`) key to bring up the console. You will see lots of messages, anything that you see in the console will be saved to your console.log. All commands must end with a semi-colon (;). To see a list of console functions, type:

dumpConsoleFunctions();

You can print all the fields and functions of any object. For example, to see what is contained within the Game object, type:

Game.dump();

To see the value of a variable, you must use echo

echo($server::PlayerCount);
echo(LightMaleArmor.maxDamage);

See the list of Global Variables for other objects that you can examine.

Legends Script Documentation

  • Legends scripts.unf Listing: List of scripts inside Legends
  • Useful Functions: List of commonly needed functions.
  • AI Functions: List of AI bot functions.
  • Object List: List of objects used in the scripting. These can be accessed through the in-game console with ObjectName.dump();.
  • Datablock List: List of datablocks use in the scripting. These can be accessed through the in-game console with DatablockName.dump();.
  • Global Variable List: List of global variables. These can accessed through the in-game console with echo($variable_name);.
  • Flow Chart: Diagram of script execution - useful for seeing where a function is called from, and what functions it calls.

Tutorials

List of tutorials to get you started with scripting. The tutorials should be real examples that show how to usefully modify the existing Legends scripting. For example: adding a waypoint to an objective/player; generating event messages; grabbing an object; starting a new round within a match; adding secondary effects to weapons (flag drop, disorientation, freezing).

Basic Scripting

This should give you enough knowledge to understand and modify most of the scripting in Legends.

  • Override Mod: This is an example of a script which makes changes to Base Legends scripts, without using whole datablocks or editing/replacing existing .cs files
  • Modifying Parameters: This is the easiest form of modding/scripting. Change game parameters to make skiing faster, weapons fire faster, players jet higher, etc.
  • Basic Scripting: Some simple loops and conditionals. Use a function from the Legends scripts as an example.
  • Functions: Example using more than one function.
  • Arrays And Data Structures: How to use arrays and data structures.
  • Objects: Datablocks, packages, namespaces, inherritance.
  • Using The Engine: Commonly used functions in the Torque Gaming Engine.

Making Complete Scripts

Add-on Scripts

These are scripts that are optional add-ons to Legends. They are a good starting point for learning how to script. Client-side scripts are scripts that players download for automating certain gameplay aspects or tracking statisics. Server-side scripts are for server operators and are generally mods that alter the gameplay of Legends.

Requested Pages

  • Gametypes
  • Weapons
  • Objectives: Flags, Switches, Nexuses
  • Armours
  • Vehicles
 
scripting/index.txt · Last modified: 2011/03/27 10:29 by TerroX