Next, we're going to get your UnrealScript package set up. This part of the tutorial assumes you have no prior knowledge of setting up UnrealScript. If you already know how to make new script packages, you can skim this section for the relevant info (and remember that you can include the P2GameMod in the same package as your weapon, powerup, or other custom content, they don't have to be in separate packages)
Open up the POSTed Local Files (Right click POSted --> Properties --> Local Files --> Browse Local Files), and create a new folder. Call it "MyPackage" for now (you'll be able to give it a more meaningful name later). Open up that new folder, and inside create a new folder called "Classes". Open THAT up, and create a new text document called "MyReplacer.uc" (again, you can give it a better name later, this is what we're going with for now).
You now have an empty script file. Open it up with your favorite text editor, and paste in the following:
// My awesome game mod that adds my awesome actors into stock maps
class MyReplacer extends P2GameMod;
// Called after the player spawns on a new map.
// We're overriding this function to drop in new items based on the map name.
function PostTravel(P2Pawn PlayerPawn)
local string CurrentMap;
CurrentMap = P2GameInfo(Level.Game).ParseLevelName(Level.GetLocalURL());
if (CurrentMap ~= "Suburbs-3")
// Default properties required by all P2GameMods.
// GroupName - any Game Mods with the same GroupName will be considered incompatible, and only one will be allowed to run.
// Use this if you make mods that are not designed to run alongside each other.
// FriendlyName - the name of your Game Mod, displayed in the game mod menu.
// Description - optional short description of your Game Mod
Description="My awesome replacer that adds my awesome actors that are mine."
What we've done here is created a basic P2GameMod, which is one of two ways to get custom content into POSTAL 2 (the other being creating your own maps). Right now, it checks after every level change to see if the map is Suburbs-3. If it is, it does nothing. We'll make it do something later.
Go ahead and save, then back out to your POSTAL2Editor folder. From here, go into System, and create another new file: MyReplacer.int. It's going to look like this:
This file tells POSTAL 2's Workshop Browser that we have a P2GameMod located at MyReplacer.MyReplacer. Without it, the game wouldn't know where to find our replacer. Save changes and exit.
We need to do one more thing: compile our script package. Open Postal2.ini with a text editor, and find this section:
Scroll down until you see a bunch of lines that start with "EditPackage=", until you find a blank space. At the bottom, put in:
Save changes and exit. Launch the file called "UCC_Make.bat" to compile your new script package. If you've done everything right, a text window should pop up like this:
Success - 0 error(s), 0 warnings
Press any key to continue . . .
If you didn't get this result, double-check all of your steps and try again. Press any key to dismiss the window.
We now have an UnrealScript package! Launch Postal2.exe directly from the Explorer window, and go to the Workshop Browser to verify that "My Replacer" appears in the Available Mods column. Go ahead and exit POSTAL 2, we're ready to move on.