rss rss Like this on facebook Twitter this +1 this Steam group

Compiling a Script

How to compile a script in Fallout 2 ...

This is written by Zixdey.

It took me several hours to get it all sorted out the first time, even with the P.bat and all.

I plan to write a few manuals myself when I have the time. For now there's a pretty good manual I found that you can use, it's how I learned:

And since it's only 3:30AM and I have to get up at 6:30AM, I decided to write a manual myself. Violla:

Writing Fallout2 Scripts in the Modern Age for Beginners, by Zixdey

Tools you'll need:
  • The Fallout2 Game wink
  • The Fallout2 Mapper
  • Dat Explorer (or any other .dat extraction utility)
  • Watcom 11.0 C compiler (yes, it's free!) (Any C compiler should work, but the FO2 developers originally used watcom 11.0, so I use the same. It works perfectly smile

    A basic outline of what needs to be done:
    1. Compile your script
    2. Assorted annoying bits and pieces

    Before you can do anything you need to extract the master.dat file. For this there are several programs, I use Dat Explorer. Just extract everything into the 'data' directory in the main Fallout2 directory: c:\bla\bla\Fallout2\data\

    (Run datexpl.exe. Choose Dat file and then open 'master.dat'. Now right-click the main window and select 'Extract all files to ...'. Choose the 'data' directory in Fallout2's main directory (c:\...\Fallout2\data\).

    Note: Get ready to use a Command prompt (which is like DOS).
    (To open one just do 'Run...' the write 'cmd' and hit Enter.)

    If you're REALLY clueless about DOS:
    'cd mydir' enters a the directory 'mydir'
    'cd ..' goes back up on edirectory
    'dir' lists the files in the current directory
    'copy a b' copies file 'a' to file 'b'
    'del a' deletes the file 'a'
    'del *.txt' delete all files ending with 'txt'
    'format c:' erases your entire hard drive smile

    Let's get started:

    You write your script. Say it's called 'script.ssl', and it's in the directory 'c:\...\Fallout 2 Mapper\scripts\Arroyo\'. Go to that directory. Make sure in the 'scripts' directory (which contains 'Arroyo') the files 'dos4gw.exe' and 'compile.exe' can be found (they come with the mapper and are there by default).

    1. Compile your script
    This includes 2 sub-steps:

    1.1. Pre-Compilation
    This is where you use the watcom compiler. Copy 'script.ssl' to 'temp.c', then run:
    c:\watcom\binnt\wcc temp.c /pc /fo=temp.i /w4
    (The path might differ if you use Win9x and not WinXP/2000... I think you need to use 'binw' instead of 'binnt', but I haven't tried it.)

    This will create the file 'temp.i' Now rename 'temp.i' to 'temp.ssl' for the next step...

    1.2. Actual Compilation
    This is where you use FO2's home-made script compiler. Run:
    ..\dos4gw ..\compile temp.ssl

    This will create ''. Rename this file '', and this is your compiled script!

    (Don't forget to remove all those temporary files you created on the way. 'del temp.*' works smile

    2. Copy your script to where Fallout2 can find it
    Copy your script ('') from where you compiled it to Fallout's 'scripts' directory:

    3. Add your script to the file 'script.lst'
    This file is in the same directory. Just open the file with a text editor (notepad works) and add your script's file's name at the end ('').

    4. Edit some map and tell it to use the script
    For critters (which includes people, the player's character, animals, enemies and so on) change the category on the bottom left to 'critters', left click on the critter on the map whom you want to use your script, click 'edit' in the middle of the bottom toolbar, then click the button 'New Script' in the window that opens. Now choose your script from the enormous list, and save the map. (You might want to backup the '.map' file as well before doing this.) The same goes for objects (computers, doors, ...). I think each map has a map script attached to it, not sure yet.

    5. Get rid of patch000.dat
    You have to make sure you don't have the file patch000.dat sitting around in your Fallout2 directory. Otherwise the game will ignore your script. (Just rename it patch000.bak or something...)

    That's it! Nothing to it, eh? wink

    Just run the game and it should work. It's easier to check out your mod by opennig the map in the map editor and pressing F8, which lets you play the map.

    There's also a shortcut for steps 1+2:

    In c:\...\Fallout 2 Mapper\scripts\ there is a file P.bat that comes with the mapper. It's supposed to do steps 1+2 automatically for you. To use it just go to the directory as written before step 1 in a command prompt and run the following command:
    ..\P.bat script

    (Note that you have to write 'script' and not 'script.ssl'!)

    The 'P.bat' that comes with the mapper didn't work well for me. The main things that usually need changing are the watcom compiler's location and Fallout2's location.

    Here's the content of the 'P.bat' I use, so you can just copy/paste:
    @if not exist %1.ssl goto DONE
    @copy %1.ssl temp.c
    @c:\watcom\binnt\wcc temp.c /pc /fo=temp.i /w4
    @copy temp.i temp.ssl
    @..\dos4gw ..\compile temp.ssl
    @if %errorlevel% neq 0 goto ERROR
    @rem The path in the following line should point to the Fallout 2 folder:
    @copy ..\..\Fallout2\data\scripts\
    @del temp.c
    @del temp.i
    @del temp.ssl
    @goto DONE

    @echo ERROR: %_CWDS%%1.ssl >> ..\err.log


    Happy scripting!