From Plants vs. Zombies Guide
Like Insaniquarium, Plants vs Zombies' images, sounds, texts,... can be modified and packed into game modifications, or 'mods'. However, the modifiable contents of the game are packed into an encrypted package, main.pak. So, in order to modify PvZ's contents, you need to:
- Extract the main.pak
- Have the game uses the extracted, modifiable contents.
However, you can also re-pack the modified contents into a new main.pak.
The method to extract the Main.pak of the game isn´t well known around the Internet so you will find Plants vs Zombies Mods only in the "Plants vs. Zombies Game Modifications" section of the Download Center.
Step 1: Extract main.pak
main.pak isn't just any archive, however. It's a 7½7M archive, which is used by almost all current PopCap games. There have been some tools to extract main.pak, but the best and fail-safe tool to do so is QuickBMS extractor It is capable of extracting lots of types of game archives, but we'll be using it for extracting main.pak only.
How to extract:
- Download BMS extractor here and the script used to extract 7½7M archives here (Save the webpage or copy the content into a .txt file)
- Launch the .exe file. In the first dialog, point to the script file. In the second, point to the main.pak file. In the third dialog, point to Plants vs Zombies' root folder. If you point to any other destination, later you must copy all extracted folders into the root directory.
Step 2: Force the game to use the extracted files
After everything is extracted, you must make the game use the modifiable extracted contents by renaming/moving/removing (not recommended) main.pak. The game will be forced to use the extracted folders instead.
Done! Now you should be ready to use mods or make one your own!
IMPORTANT NOTE: If you're willing to use/make mods, you must suffer a downfall: Game loading time will be 1-2 minutes longer. Why? Because when you remove main.pak, the game will search for main.pak, and then it's forced to get the contents from the normal folders instead. One solution for this is to pack the individual folders back into a new main.pak.
Make a mod
If you're used to making Insaniquarium mods, you'll have a hard time getting used to making Plants vs Zombies mods. Plants vs Zombies doesn't use sprite sheets; instead it collects individual sprites and combines them. Modding Plants vs Zombies is EXTREMELY limited, comparing to the flexibility of Insaniquarium and its sprite sheet.
Folders found in main.pak:
- data: Contains the game's font.
- properties: In this folder, only LawnStrings.txt should be messed with. This file contains all the texts in the game, like almanac entries, Crazy Dave's speeches, etc. Game of The Year version has a new file: ZombatarTOS.txt (Zombatar's Terms Of Service), but it's NOT recommended that you mod this file, since you may violate some laws.
- compiled: This folder contains files in a .compiled format, and they define the body parts placement and movements of characters in the game (For more info see this topic). Modifying them is possible, but pretty difficult (See this topic.)
- images: Contains various images (but not all, unlike what the name suggests) in the game, like lawn backgrounds, items in the game, etc.
- particles: Contains images for "particles" like splats, chunks, explosions,... and zombie heads when they're decapitated.
- reanim: Contains the characters' body parts, like plants, zombies, Crazy Dave, and more.
- sound: Like what the name suggests, this folder contains various sounds of the game and could be modified like the images too. Most of them are in .ogg format, with the exception of 2 in .au format. The game's music is in here too, in .mo3 format.
After modifying the sounds, to have the changes applied, delete the 'cached' folder first. Deleting it won't affect the game; 'cached' is the folder created by the game to 'cache' the sounds in order to load faster, you could delete it without any problems. The folder will be created again the next time you start Plants vs Zombies.
Applying a mod
If you want to use mods provided on this site, follow the instructions:
Mod Installation using a main.pak
If the Zip you downloaded contains a main.pak you just have to make a backup of your own main.pak, which is in the directory you've installed Plants vs. Zombies to, and then replace the one in the Plants vs. Zombies directory with the one from the zip.
Mod Installation using Folders
If the .zip you downloaded contains a number of folders called reanim, images, compiled... you will have to rename or shift your main.pak (if you haven't) then copy all of the folders into your Plants vs Zombies directory and approve all overwriting alerts.