Using BAIN and Archive.exe to Package a Skyrim Mod
Packaging a mod for distribution in Skyrim is a pain. The preferred method for doing so is to make a BSA package, but the process for doing this in the CK is error prone due to skipping a lot of things one may not even realize are missing. More after the break.
Gather Your Tools
You'll need to have the following installed or readily available:
Archive.exe (comes with the CK)
Wrye Bash 297 or higher.
UnFuzer (if you have voice files to convert first)
Look for Wrye Bash's mod installation folder. This will usually be found with your Steam install of Skyrim. Mine is located at C:\Steam\steamapps\common\Skyrim Mods\Bash Installers
In the Bash Installers folder, create a new folder with the name of your mod.
In this new folder, create the subfolders you'll need. Usually meshes, textures, sound, scripts, etc.
Below each of the top level folders, you'll need to copy all of the data files your mod uses into their appropriate subfolders. The results will look something like this:
Be sure when gathering up the compiled scripts (.pex files) that you remember to copy any of the vanilla Skyrim scripts you may have altered. It isn't necessary to include your source code files (.psc) but they're handy for other people who might want to learn how you did something.
When copying the face texture data, you can leave out the .tga files. The game doesn't use those.
Once you have everything in place, open up Wrye Bash and switch to the installers tab. Your project folder should appear at the top, similar to this:
Scroll through the list of files it shows you. If you're familiar with BAIN, this shouldn't feel any different than installing other peoples' mods. The only difference being that your project folder is listed with them. For all intents and purposes, BAIN will treat it just like any other mod on your system.
Aside from neatly organizing things, this also has one huge benefit. You'll immediately know if something you install later has a conflict with it because your project status will change from green to some other color. Usually orange or yellow, just like it does when other mods conflict with each other.
If your mod has voice files, you'll want to convert those into Skyrim's standard format, the .fuz file. This is a combination of .lip and .wxm files. .wxm files start out as .wav files. Skyrim apparently only wants to see .fuz files. Check your voice folder and see what you have. If you have a bunch of .wav files, it's time to open up UnFuzer.
Configure it to look into your project folder. In my example, it would look like this:
The checked options are necessary in order to process the entire folder in one easy step. Simply click on the "Refuz" button to process the folder. It will tell you how many files were converted. It shouldn't take very long.
When you're done, close that out and return to Wrye Bash. It may be indicating to you that your project is no longer in a proper state. This is normal since you just switched the data files for your voice content into a new format. Right-click on your project and select "Anneal".
It should have everything sync'd up properly once that's done. If you end up with it telling you files are missing, right-click your project again and select "Install Missing".
Now it's time to package the results into a BSA you can distribute the mod with.
Locate the Archive.exe utility. It's in the same folder as the CreationKit.exe file. Double click it to open it up. You'll have a somewhat spartan display:
The first thing you want to do is go to where it shows "Root Dir" and click the button to the right of the box with "Data" in it.
It will ask you to browse to a folder. Find the Bash Installers folder and use the folder for your mod project that's underneath it.
Next, you need to select the appropriate checkboxes at the top. Usually this is one checkbox for each folder type. In my example, meshes, textures, sound, voice, and misc. Misc covers things like scripts and SKSE plugins if you have them. You'll also want to check the two boxes for retaining names. Compressing the file is up to you, but if you're going to distribute to Steam Workshop, you should leave it uncompressed.
Now you want to drag your files in. With Archive.exe still open, switch to Windows Explorer. Navigate to your project folder. Select everything inside of it EXCEPT the .esp file.
Drag the selection from there onto the taskbar icon for Archive.exe. When Windows switched to it, drop your cursor in the empty space.
If it works you should see something like this:
From here, go to File->Save As. It should be displaying your Skyrim Data folder. Give the file a name that matches your .esp file and let it save that in the Data folder.
When it's done, you should have a .bsa file in your Data folder to go with your .esp file.
You'll also notice a .bsl file there. If you're going to upload to Steam Workshop, leave it there for now. If not, that's safe to delete. The game ignores those.
Congratulations! You've now packaged a working BSA file for you mod without having to trip over the CK doing it!
As you make edits and additions to your mod, don't forget to keep your project folder in BAIN up to date as well. Wrye Bash can detect changes in existing files, but it cannot detect when you add new ones to your Data folder.
When in BAIN, you can right click your project, select "Sync From Data" and it will update all of those for you automatically, leaving only the new stuff you need to track down again. Then it's just a matter of repacking your BSA again to update to the mod hosts.
Feel free to post questions in the comments section, or comment on what sort of refinements this needs.
"It is pointless to resist, my son." -- Darth Vader
"Resistance is futile." -- The Borg
"Mother's coming for me in the dragon ships. I don't like these itchy clothes, but I have to wear them or it frightens the fish." -- Thurindil
Well. I guess that's that then.