Live a week in the life of "The Postal Dude"; a hapless everyman just trying to check off some chores. Buying milk, returning an overdue library book, getting Gary Coleman's autograph, what could possibly go wrong? Blast, chop and piss your way through a freakshow of American caricatures in this darkly humorous first-person adventure. Meet Krotchy: the toy mascot gone bad, visit your Uncle Dave at his besieged religious cult compound and battle sewer-dwelling Taliban when you least expect them! Endure the sphincter-clenching challenge of cannibal rednecks, corrupt cops and berserker elephants. Accompanied by Champ, the Dude's semi-loyal pitbull, battle your way through open environments populated with amazingly unpredictable AI. Utilize an arsenal of weapons ranging from a humble shovel to a uniquely hilarious rocket launcher. Collect a pack of attack dogs! Use cats as silencers! Piss and pour gasoline on anything and everyone! YOU KNOW YOU WANT TO!

Post tutorial Report RSS Coding Tutorial 2: Adding an Exec Command

Tutorials using Unreal Script specific to POSTAL 2.

Posted by on - Advanced Client Side Coding

Tutorial originally released on Running With Scissor's Postal website. Was taken down more than 10 years ago. Mirrored here for archival purposes.

Adding an Exec Command

Through a New Cheat Manager

Code Tutorial 2

You must be running the new Share the Pain version of POSTAL 2 for any of this to be relevant. Using these tutorials with older code may cause you problems.

These tutorials were written to be completed in succession with one another. If you jump ahead to a later tutorial, I will be discussing things from earlier tutorials that you may not recognize. Following each one in order should greatly improve your learning experience.

This will teach you how to add a new exec command (a function that can be bound to key/mouse commands in the User.ini, or can be called directly in the game console—check P2Player.DoKick for a good example (search for DoKick in User.ini also)).

This will also teach you how to extend the cheat manager class to add your own cheats.

An important distinction to realize before starting this document is that this will modify your current game. I’m not yet writing about how to write your own packages and incorporate it into the game without modifying anything else. That is actually very extensive. I’d like to eventually write about that—time permitting.

Let’s begin.

Open a folder for Postal2\GameTypes\Classes. Make a copy of the P2CheatManager.uc file. Call it something new like ‘SuperCheatManager.uc’. Open that new file. Edit the top comments to something like that (or even more informative).

// SuperCheatManager
// my super cheats that I love and no one can take from me

Next, and very importantly, extend this new actor class from the parent cheat manager which is P2CheatManager. This ensures that all the functionality you already had will still be there, plus any new things you create.

(was this: )

class P2CheatManager extends CheatManager;

change it to this:

class SuperCheatManager extends P2CheatManager;

Now the next part is to just make sure we start a clean slate. Delete everything from just below the class definition all the way down to the block about default properties. Next, delete the line


out of default properties.

Your file should look like this now

// SuperCheatManager
// my super cheats

class SuperCheatManager extends P2CheatManager;


Or something very similar. We’re removing everything from before to keep things straight. Yes, it’s true, you can override functions in this extended class, but it would be very confusing to keep the same functions here even though functionally it would work.

Now is the fun part – the actual code writing. Let’s make a new function that fires the dude’s current weapon without having to touch the fire key. The important part is this will be an exec function. So you will be using the console in the game to type this function name in to execute the command (or of course, bind it to a key command/mouse command using the user.ini).

Here’s a shooting function—really it just calls the real shoot function—but that’s not the point of this exercise.

Exec function SneakyShoot()

Save the SuperCheatManager.uc file.

Now here’s the tricky part. The player controller (Controller handles most intelligent decisions, Pawn is the body that animates and does things and is controlled) has a class name for what cheat manager it will use. You must replace this, but you must do so in the single-player player controller class. This is DudePlayer. That is the class used in SP for all the highest level things (this is not the highest level class used in MP games—that is xMpPlayer).

The name of the variable we’re concerned with is CheatClass. The way to find this sort of thing would be to have your handy, fancy code editor you’re using to edit uc files (as I talked about in the Writing Script doc). Assuming whatever editor your using can search all files and keywords within them, do a search on ‘P2CheatManager’. This is the class we’re replacing. It’s always good to know where these things are used and how it’s used.

With a search like this you’ll see that in DudePlayer, CheatClass is set to P2CheatManager. We want to simply change that (it’s down in the default properties) to SuperCheatManager. So the new line should look like this:


Now, save the file, and build GameTypes.u (either delete GameTypes.u from System and run ‘uccmake’ or run your batch file as described earlier).

Now run your game (like I mentioned before in my previous doc on Writing Script—run it with ‘postal2 testbox.fuk’ console command from the dos window to speed things up for you).

Get a pistol. You should be able to press Tab to bring up the console and type ‘sneakyshoot’. The dude should shoot his pistol—congrats!! You’re ready to make your own exec commands, plus you have your own cheat manager ready to go.

Nathan Fouts

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Report Profile
Windows, Mac, Linux
Developer & Publisher
Running With Scissors
Send Message
Release date
Game watch
14 (1 today)
Related Games
POSTAL 2 First Person Shooter
Related Engines
Unreal Engine 2
Unreal Engine 2 Commercial
Related Groups
Running With Scissors
Running With Scissors Developer & Publisher