NOTE: There really is no point to this article anymore save the addendum at the bottom which teaches you how to hack the path info in the EXE. See the Programs section for newer MPQ compiler tools which allow you to generate MPQ files without any hassle.
This short article will teach you the basics of making a custom MPQ file. You should already be familiar with the fact that the MPQ files in the Starcraft directory are where all Starcraft's information is stored. So, a custom MPQ file would allow you to permanently change the files Starcraft uses. Basically, it is a Starcraft patch that doesn't require the Stardraft patchloader (or anything besides placing a file into your Starcraft directory).
Here's what you need to do first:
1. Reinstall Starcraft Broodwar 1.04. That doesn't mean you have to wipe your Starcraft 1.05, just install it in a different directory. All you need is Staredit 1.04 and its MPQ files.
2. Get Stardraft 1.04 (see the Misc. Programs section).
The reason you need to do this is because Stardraft 1.05 has a bug that prevents its Staredit Enhancer from working on Staredit 1.05. It will probably be fixed in the next version of Stardraft.
Now, the theory behind this is pretty basic. Ever notice that whenever Starcraft gets patched by Blizzard (like for 1.05) a little file called patch_rt.mpq shows up in your Starcraft directory? Well basically, that file contains all of the MPQ files that Blizzard "patched." See where we are going here? =)
Second, recall (or learn if you didn't know) that SCM and SCX files are simply MPQ files. In fact, you can look at them with an MPQ Viewer and find stuff like staredit\scenario.chk (your uncompressed map) and staredit\wav\*.wav (your map's sounds) inside. Well, we make use of this fact because really the only thing that makes a *.scm and a *.mpq file different is the extention (which, of course you can easily change =).
So basically, we are going to import our custom files (the ones we would normally import into a Stardraft CWAD) into our custom mpq -- or, in this case, our scm/scx map. Then, we will rename our map to patch_rt.mpq and -- voi'la -- custom MPQ which patches Starcraft. Here's the basic instructions:
1) First we want to extract all the files from the current patch_rt.mpq file that is in your Starcraft directory. Obviously, you can not have both Blizzard's patch file and your patch file in the directory if you're going to name them the same thing, so you will have to combine them. There really isn't anything of critical value in there (the balance changed dat files, fixed iscript for the d-web graphic, and a couple more tiny files), but its a good idea to get it just so your player doesn't wind up with Acadamies using 1.04 health. =) Besure to extract them will full paths or remeber all of them because you will have to reimport them with the same paths.
2) Fire up Stardraft 1.04 and run it on Staredit. Make sure it patches Staredit 1.04 and not Staredit 1.05. If it gives you some errors, it patched the wrong one. To get it to patch the right one, you will have to edit the "Install Path" of your Starcraft registry to point to the directory where Staredit 1.04 is located. You can easily do this with a program called RegEdit which you can find in the Misc. Programs section. Don't run any cwad patches (just click O.K.).
3) Now, select the window that opened up called the "StarDraft Control Center." Click the "Staredit Enhancer" button. Then click "enable" on the new window that opens. You should see the "Default import path:" point to staredit\wav\.
4) The default import path is actually the path that files go into when you import them through the Staredit Sound File Manager. In other words, it is the MPQ path. With the Staredit Enhancer running, you can change this path and import any file (not only wavs) into your map with the Sound File Manager. Here's the low down:
1. Change the Default import path to the MPQ path one of the custom files you want in your custom MPQ. This would be the same as if you would place your file in a CWAD except without the file name. For example, if you were replacing unit\protoss\corsair.grp then you would change the default import path to unit\corsair\. Be sure not to put a slash in front and remember to put a slash at the end.
2. Click "Apply" to change the path. Now, open up the Sound File Manager in Staredit and import your file(s) that goes in that path. Make sure it is named correctly before importing. For our example, we would import corsair.grp.
3. Go back to the Staredit Enhancer panel and repet step a and b for all the files you want to import into your map (putting each one in its respective MPQ path).
5) When you finish, place 2 start locations on the map and then save (if you don't put start locations, Staredit won't let you save =). Now we are almost done.
6) The last step is to rename your whatever.scm file to (exactly) patch_rt.mpq. Now, simply place it in your Starcraft directory and all your changes should be in place. You probably want to back up your old Blizzard patch_rt.mpq file before over writing it, so if you want to change it back to normal you only need to put it back (otherwise you'll have to reinstall Starcraft and the patch from Battle.net).
Its as simple as that. There are several programs in the Misc. Files section (particularly those written by Porno Creep) that will make the process easier on you and offer a couple more options. So you might want to take a look at those.
One side effect of making an mpq file out of a scm/scx is that the staredit\scenario.chk file (your map data) will still be in the mpq. Now, you might think its not much of a problem besides adding a couple more kilobytes to the size of your mpq. However, it turns out that having a staredit\scenario.chk file in a mpq that Starcraft/Staredit reads will disallow it from reading other scm/scx maps. For example, if you tried to open a map in Staredit or tried to play a custom scenario in Starcraft, no matter what, it will open the staredit\scenario.chk file that is in your mpq (as opposed to the one that it is supposed to open in your scm/scx). This will not effect the actual scm/scx, it just won't let you open it.
I personally thought this was kind of a nice quirk (imagine making someone think all their maps had turned into BGH =), but there is a way to get rid of it. Go to the Misc. Programs section and download Porno Creep's MPQ Compiler. Place its files in your Starcraft 1.04 directory and run the MPQ Compiler. Open up your custom mpq that you made already. The compiler actually is simply a tweaked version of Staredit that will save your map data as mpq\format.mcm rather than staredit\scenario.chk, so it will not conflict with the staredit\scenario.chk from other scm/scx files. It will also change your file's extention to *.mpq for you. Be sure to thank Porno Creep for the nifty program.
There is a way to completely remove the map data file from your mpq, but I am not at liberty to discuss it, so don't ask.
You can not use a custom MPQ to replace smacker videos of any kind (movies, portraits, etc.). Starcraft will crash when it tries to access it. To compensate, you will either have to use Stardraft or simply tell your player to put the smackers in their corresponding directories in the Starcraft folder (i.e., emulate their paths in the mpq). This will work for all smackers, even movies.
There are a few layout files in the Install.exe that can not be patched with a custom mpq. Specifically, all the *.bin files on the CD will simply be ignored. This is because it will load those from the CD before it even looks at your MPQ. The only way to get those replaced is with Stardraft.
And the point of all this? Well, if you want to distribute your custom, this isn't a bad way to do it -- of course you'll have to warn your user to back up their old patch_rt.mpq also. But the real meat of this technique is that is will allow you to patch things that Stardraft normally can't with a normal CWAD.
Just after writing this article, I discovered a way to allow you to use custom MPQ files without having to replace the patch_rt.mpq file. Actually, Shadowflare released a simple program specifically for this technique (StarExeHack, which you can get from the Misc. Programs section), so I won't even have to instruct you on the hex editing process (which still would have been very simple).
To use this method, you will have to distribute an edited version of the Starcraft.exe file with your MPQ (which is about 1 mb). You can rename the Starcraft.exe file to whatever you like. The player would then simply place your custom mpq (say, custom.mpq) and your edited exe (say, Custom.exe) into their Starcraft directory. When they play Starcraft from your modified exe, they will aquire all the changes you made in your custom mpq. If they play Starcraft from their normal Starcraft.exe, nothing will be changed. So, in fact, it is a very user friendly method. Here's how you go about it:
1. Download Shadowflare's StarExeHack, which you can get from the Misc. Programs section.
2. Make your custom MPQ and name it whatever you like (but keep the name short otherwise it might not fit). You still should include the files from the patch_rt.mpq.
3. Make a backup copy of your Starcraft.exe. Keep one of these as your original.
4. Run StarExeHack on a copy of your Starcraft.exe that will be modified. Change the the "First MPQ Searched" from \patch_rt.mpq to \your_mpq_name_here. Obviously, put your custom MPQ's file name into the your_mpq_name_here spot. Be sure to keep the back slash in front.
5. Now, save or save as, and you got your very own exe file that will read your custom MPQ file! It's that simple.
Note that what you are really doing is making the Starcraft.exe read your custom MPQ instead of the patch_rt.mpq. That's why you should still include the patch_rt.mpq's contents in your custom one. Enjoy. =)