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 10: Various Technological Points: INIs, Asset Paths

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.

Various Technological Points: INIs, Asset Paths

Code Tutorial 10

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 are 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 try to show you how to finish up a few things with your mod. For instance, it shows you how to supply your own game ini file (eg, Postal2.ini), and your own user ini file (eg, User.ini).

Changing the Game INI File

Currently you’re completely separate from the original content except one file… so close. That’s the initialization file, Postal2.ini. We need to make our mod able to use a separate one so don’t overwrite any of the original files. How? Easy! We just need to supply the user with a shortcut and a new INI.

First, let’s go to your System directory. Make a copy of your current Postal2.ini (the one with your menu/game type changes in it). Rename it to something appropriate. For my ‘super pack’, I’ll call the file Postal2SP.ini. It’ll be easier to sort by in the directory than something wildly different, and the user will probably never see it.

Next, find the Postal2.exe in your System directory. Create a short cut and rename it something appropriate (this can be as wild as you want since the user will click on this). We’ll call ours SuperPackinP2.

Right-click on that shortcut and go to the Properties.

Your Target Properties should something look like this:

C:\Program Files\Postal2STP\System\Postal2.exe

For the moment we need to get this shortcut working for us. If that target is not the same directory for your executable, change it now.

Now, let’s add the level to play on startup. That should be the menu level. If you don’t specify this and only the ini file, you could get some errors, so we’ll just be safe and specify it.

C:\Program Files\Postal2STP\System\Postal2.exe startup.fuk

That’s the default menu level. (If you’ve made a separate one and appropriately changed the other links to startup.fuk in the INI and so forth, then add that level instead. OR if you have a test level, and no new menu option, put that level there instead—but don’t expect the user to have that level in the end.)

Finally, let’s add the ini path.

C:\Program Files\Postal2STP\System\Postal2.exe startup.fuk INI=postal2sp.ini

As you can see, that’s the name of the new INI we just made at the start. If your ini for you mod is different, put in the appropriate name instead.

Now let’s try it out! Double-click on the shortcut and to run it.

Good! It should have run with all your mod changes intact. To test if it’s really working, delete(or just rename for the moment) your real Postal2.ini. This way you’ll know if it’s using the Postal2SP.ini you’re specifying. Also, after you’ve run the shortcut and closed the game, open the Postal2.log file. Do a search for “ini=”. You should find something like this:

Init: Command line: startup.fuk INI=postal2sp.ini

There we can see the new ini being used.

Now, here is the weirdness. You may not be making this with a ‘professional’ installer. You’re probably just making a zip of your mod. Either way, you need to ensure that this shortcut points to where the user’s Postal2.exe will be. They could have changed it, they could have moved it, but more than likely it’s in C:\Program Files\Postal2STP. I would say, as a default, make the properties in the shorcut that. Like so:
C:\Program Files\Postal2STP\System\Postal2.exe startup.fuk INI=postal2sp.ini

That’s a pretty safe default. The only problem is, if your asking them the directory with an installer and changing your shortcut for them, they’ll have to change it themselves if they have the game installed to a different directory. You’ll need to explain to them how to open the short and modify the properties in that case.

Changing the User INI File


You may have a mod that requires new keys bound to new functions you’ve written. Let’s look at adding in a separate User.ini file also. This way, you won’t overwrite the gamers User.ini file.

This is the same as the Postal2SP.ini file as above. To experiment, go to the System folder and copy the User.ini. Rename it to something similar to your game ini, like UserSP.ini.

Open the file and find this line:

LeftMouse=Fire

That binds the left mouse button to the firing of your gun.

Now, cut the Fire part out and paste it a few lines below… where you see this line:

F2=

That’s saying the F2 (function 2 key) isn’t doing anything. Paste Fire in there like so:

F2=Fire

Save the file.

Go again to your shortcut for the executable where we added the part about the game ini. Open the properties again, and look at the Target Properties. Change it to this:

C:\Program Files\Postal2STP\System\Postal2.exe startup.fuk INI=postal2sp.ini USERINI=usersp.ini

So just add ‘USERINI=usersp.ini’ to the end of the line and close the Properties.

Now you’re specifying the starting level, the game ini, and the user ini file. Pretty cool!

Run the game and get a gun. Notice how you can’t shoot with the mouse anymore! Press the F2 button and relish your programming power when your gun shoots! Laugh maniacally… that helps too when your enjoying new-found power.

Assest Paths

Assuming your working with an artist, you may have some new textures, animations, sounds, etc for you mod. It’d be really cool if you could put them in their own proper directories instead of mixing them in with original content, right? Right!

This is really easy to test! You should do it just for experiences sake!

We won’t be making new textures, we’ll just use an existing texture package. Open the Textures folder. Cut AnimalSkins.utx and go back to your Postal2STP directory and paste it there. It’s now not where it should be. Run your shortcut to your mod.

It should crash! It should quickly say it couldn’t find AnimalSkins. Right? Good.

Now, in Postal2STP, make a new texture folder like SPTextures.

Cut and paste AnimalSkins.utx into that file. The game will still crash currently because you haven’t told it about this new path.

Go into System, and open your Postal2SP.ini file. Scroll down a little to the part that looks like this:

[Core.System]

PurgeCacheDays=30

SavePath=..\Save

CachePath=..\Cache

CacheExt=.uxx

Paths=..\System\*.u

Paths=..\Maps\*.fuk

Paths=..\Textures\*.utx

Paths=..\Sounds\*.uax

Paths=..\Music\*.umx

There’s more, but you get the picture. This portion is critical. You could remove any line here with a ; in front of it like this:

;Paths=..\System\*.u

And the game would crash immediately on starting up.

Give it a try! It’s fun. Even though it can’t find a texture package, if you don’t tell it where it’s System files are, it complains even faster about not finding ‘Engine’ and the like.

Just make sure to remove the semicolons when you’re done playing.

Everything back to normal? Okay, good.. yeah, I know we’ve still got to fix this texture issue. Let’s, do that now.

Find these lines:

Paths=..\Textures\*.utx

Paths=..\Sounds\*.uax

Just below textures, place this:

Paths=..\Textures\*.utx

Paths=..\SPTextures\*.utx

Paths=..\Sounds\*.uax

Save the file. Run the shorcut. Should work now! Congrats! You’ve now added new assets to the game! Oh… yeah.. okay, well so those assets were required, but your now capable of adding new packages to the game. Say you make a new animation package. Just make a new folder for all your animations for that mod, and put a path just under the original animations path in the ini file. It should be that easy. (Well.. you see.. Epic’s engine is fickle, so sometimes I’ve found certain orders of paths don’t work. I tried originally just putting the new Textures path at the beginning of all the paths, and that crashes, but if I put our new Animations at the top, it doesn’t crash—who would’ve guessed it! That’s the fun of working with the engine J)

Moving to a New System Folder

The final, clean step for you mod would be to have a separate folder even for you System files. This supported but slightly more complicated than before. It involves changing several relative file paths.

First, let’s make a new System folder. Go to your Postal2STP working folder (the main folder where your old System folder is). Make a new, appropriately named one like SPSystem.

Go into your old System and cut the following:

Any mod *.u files.

The shortcut to your postal2 we’ve been working on

Your new INI files (game and user) for your mod

Paste all of those into your SPSystem folder.

Now comes the work of changing the paths around. Open your Postal2sp.ini file. Go to these lines:

Paths=..\System\*.u

Paths=..\Maps\*.fuk

Add in this line:

Paths=..\System\*.u

Paths=..\SPSystem\*.u

Paths=..\Maps\*.fuk

Save the file.

The last part is messy. Open the properties again to your shortcut. You should have this:

C:\Program Files\Postal2STP\System\Postal2.exe startup.fuk INI=postal2sp.ini USERINI=usersp.ini

This line is going to get so long I’ll have to put it on two lines but understand it all needs to go in that single Target Properties line in your shorcut.

Now, let’s look.. see how it’s pointing to your Postal2.exe with an absolute path (there are no ..\’s in the path)? Well.. now look at your new postal2sp.ini. It thinks it’s in the System folder. That’s just where the engine hardcode’s it to look (just the same as how you don’t need to put ..\Maps\startup.fuk to specify the starting level).

So we need to specify a relative file path from our old System folder, to our new one. That means we need to

..\ (back up one)

SPSystem (and move forward to our new folder, yeah.. it wasn’t that hard really.. just ugly when we put it all together).

So it goes together like this:

C:\Program Files\Postal2STP\System\Postal2.exe startup.fuk INI=..\SPSystem\postal2sp.ini USERINI=..\SPSystem\usersp.ini

There we go. Now, run the shortcut from your new System folder! If it complains at all, check for spelling errors in your shortcut properties and your ini file (I had a few got some crashes for a while).

Cleanup

Before you stop reading know this: You can’t work in your new System folder, or at least as far as I can tell (if you figure out a better way, post it on the forums!).

The problem is your using the ucc make to build off the old system *u files. So in order to get back to normal, copy your postal2sp.ini, shorcut to postal2, and *.u files out of your new SPSystem and paste them back into the old. Compile and build everything from the old area. You should go back into your shortcut and remove the ..\SPSystem parts and in your INI file, put a ; in front of Paths=..\SPSystem\*.u to not use those *.u’s yet. But then leave everything in the SPSystem for when your ready to finish the mod. It’s messy and ugly and prone to errors, so only do that at the last moment, and test it thoroughly. Run and test the game out of the old System. Finish it up and test more out of your new System.

In general though, you’re ready to go! Now you can include your new, separate INI file, the shortcut and your own *.u files, and even your own assets. The really cool part is, you can extract into a separate System folder and have them run the mod from there! None of yours will be mixed with the original content and any other mods should run smoothly with yours (assuming they are made as well).

Enjoy!


Nathan

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: