Unrealscript is the scripting language used in creating mods for POSTAL 2.
Preliminary Notes[]
The following is written to give the basic knowledge needed to make mods for POSTAL 2. This is due to the expansive nature subject which can easily fill a book. For those looking for a more thorough explanation of the subject, the Epic Games Unreal Developer website is recommended.
Introduction[]
In order for mods to function correctly in POSTAL 2, they need one or more Unrealscript files. From simple texture replacements to total conversions, Unrealscript files are needed so the engine knows what to do. They can be written in any basic text editor but must be "compiled" in order to function. IF this sounds like computer programming, it is. Unrealscript is based on observations of the JAVA programming language and C++ programming language. As such, basic knowledge in "Object Oriented Programming" is necessary.
Terms you need to know[]
- class (How the engine identifies the file)
- extends (Pulls code from another file, known as "inheritance" in coding terms)
- vars (Short for "Variables", these are things that may change depending on things that happen in the game)
- consts (Short for "Constants", these are things that don't change in the game)
- function (Tells the engine what to do)
- defaultproperties (The default state for listed Variables)
- Package (A collection of compiled Unrealscript files)
- Block or Code Block (A section of code)
In addition to the above, the reader should familiarize themselves with "curly brackets", { and }. Also known as "Braces".
Formatting[]
ShotGunDamage.U |
---|
class ShotGunDamage extends BulletDamage
abstract;
{ DeathString="%o enjoyed a facefull of %k's steaming load." DamageWeaponName="ShotGunDamage" } |
The above code is very simple. It tells the game to say a specific death string when a player gets killed during multiplayer.
Sections of code are divided into four sections:
- Class (initial declaration)
- Variables, Constants, and Structs (information being stored)
- Functions (Self explanatory)
- Default Properties (See above)
At the bare minimum, only the Class and default properties are needed though coding a mutator will need a replacement function for whatever you are replacing/mutating. An example of this can be found in the POSTAL 2 Unrealscript source files under "Workshop example".
File compiling[]
After a file is written, It needs to be compiled by the Unreal Code Compiler which is found in the System folder of POSTAL2 Editor as "ucc.exe". This can be a bit complicated as it is a command line program and simply double clicking does not work. The simplest way is to code a .bat file like so:
ucc.exe make
Copy the above in a text program and save it with a ".bat" extension and place the file in the same folder as ucc.exe. The Unreal Code Compiler has numerous other commandlets but the "make" command is the one you need to be familiar with.