All the scripting and tools necessary to make a custom gametype in Warfork
Introduction
AngelScript Basics
Excellent documentation on AngelScript and its features is available from the official AngelScript manual.[www.angelcode.com]
Pk3 Structure
Note: all paths are relative to the root of the Pk3. foo/bar refers to a file or folder bar contained under a folder foo, which is in the root of the Pk3.
For the following section, replace mygametype with the short name of your gametype. This is also the name that shows up in the server browser.
The gt file is a semicolon separated file containing the list of AngelScript files to be loaded when your gametype is started. Any script or function you intend on using must be included in this list.
For example, the bomb gametype gt file has the following contents:
/shared/constants.as; /shared/utils.as; /shared/files.as; generic/quickmenu.as; generic/matchstates.as; generic/bots.as; generic/items.as; generic/awards.as; bomb/main.as; bomb/player.as; bomb/bomb.as; bomb/site.as; bomb/round.as; bomb/media.as; bomb/bots.as; legacy/quake1.as;
Most of these scripts are actually commonly loaded in many gametypes. Documentation on these base .as scripts is covered later. These paths are relative to the progs/gametypes folder, but if prefixed with a slash, actually refers to a path under progs/.
Notably, bomb includes bomb/main.as which happens to include many of the game hooks for the bomb gamemode. As we will see later, this is no more than an organizational trick. You are free to name your scripts however you please and put them in whatever folder (under gametypes) you wish.
The gtd file is pretty straightforward. It is simply the ‘pretty’ title of your gamemode, as well as the description.
For example, the bomb gtd has the following contents:
Bomb and DefuseTeam game mode where in which players join either the attacking team or the defending team. Each team attempts to complete their mission objective, either planting the bomb or defending the bomb site, or eliminate the opposing team.
The first line of the gtd is the title, followed by a mandatory blank line, and then the description.
Both of these files are necessary in order to have your gametype be loaded.
The custom AngelScript files you write should be included under progs/gametypes/. To avoid confusion and issues with identical names, it is best practice to put your scripts under a folder named after your gametype, like progs/gametypes/mygametype.
Scripting Preface
The implementation for the Free For All gamemode can be found under data0_21pure.pak3/progs/gametypes/ffa.as. It’s commented quite nicely and contains at least a stub for all of the game hooks. This is a good base to start with.
Scripting Hooks
A complete list of these functions, along with documentation on what they mean and their parameters, can be found at http://livesow.net/wsw/api/game/gt_script_calls.h. You should also consult the provided implementations to see how gametypes typically react to these events.
Additional information on these functions and the interpretation of GT_ScoreEvent args can be found in the Scripting Reference section.
Scripting Techniques
Scripting Reference
Loading and Playing
On Windows:
Place your pk3 under
C:\Program Files (x86)/Steam/steamapps/common/fvi/Warfork.app/Contents/Resources/basewf
You can then use your gametype to start a local game, or load it onto a server.
Be sure to keep an eye on the console for script errors!