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.
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.
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.
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:
You can print all the fields and functions of any object. For example, to see what is contained within the
Game object, type:
To see the value of a variable, you must use
See the list of Global Variables for other objects that you can examine.
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).
This should give you enough knowledge to understand and modify most of the scripting in Legends.
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.