Modify Plants vs. Zombies

From Plants vs. Zombies Wiki
Jump to navigation Jump to search
An example of a modded Plants vs. Zombies with new textures and animations.

This page will tell you how to modify Plants vs. Zombies.

Modification will allow you to change the art, sound, animation, and many other features of Plants vs. Zombies. For a more extensive guide for modding the game, you can utilize the Modding Document or the Visual Animation Document

Before Modifying

There is a file called "main.pak" which contain files that you are using later on to edit. You'll have to extract the pack first using this tool, QuickBMS with Plugins or using PopStudio.

  • 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 lawns 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. This can be used to change pictures and stats of plants.
  • 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. Programs like OpenMPT can open, edit and save .mo3 files
Squash on water, Tangle Kelp on land, unmodified Fume-shrooms and strange plants
Water pots, sleeping Sun-shrooms in a "roof night" setting


Change venue

Go to images folder, find background1.jpg (Day), then copy the file to your folder and edit it with photo editor, such as Adobe Photoshop. After editing, replace the original file in the images folder to the file you have created.

Change Almanac entry

Modded the normal Football Zombie with the Giga-Football Zombie
Note: You can also use a hex editor or Cheat Engine.

Go to properties folder, open "LawnStrings.txt". then find the entry you want to edit. For example:

[PEASHOOTER_DESCRIPTION]
Peashooters are your first line of defense. They shoot peas at attacking zombies.
{SHORTLINE}
{KEYWORD}Damage:{STAT} normal
{SHORTLINE}
{FLAVOR}How can a single plant grow and shoot so many peas so quickly? Peashooter says,
"Hard work, commitment, and a healthy, well-balanced breakfast of sunlight and high-fiber
carbon dioxide make it all possible."

Messing with the compiled folder: old Dancing Zombie on Zombot

Then change the text accordingly. After that, save the text file.

The meanings of the words surrounded by an { or }:

  • Almanac:
  • SHORTLINE - Creates a short gap in the text just like the keyboard key: "Enter."
  • KEYWORD - a word describing what damage or things it does. Changes the font color to brown.
  • STAT - makes letters red.
  • KEYMETAL - Makes the text hidden until Magnet-shroom is unlocked. Used in the entries for zombies that have metal objects.
  • METAL - Same function as KEYMETAL.
  • FLAVOR - the description of the plant and/or zombie. Only seen at Almanac entry but can also be used anywhere else in the Almanac description. Changes the font color to brown.
  • NOCTURNAL - makes letters violet.
  • AQUATIC - makes letters light blue.

Crazy Dave:

  • PLAYER_NAME - Your name.
  • MONEY - The amount of Money you currently have.
  • NO_CLICK - Triggers Crazy Dave without clicking. Just mouse it. Used at shop and during the 7 seeds prompt (as you press yes/no instead of clicking him)
  • NO_SOUND - Makes Crazy Dave speech silent. Used at shop.
  • SCREAM - Makes Crazy Dave scream.
  • SHAKE - Makes Crazy Dave do his "BECAUSE I'M CRAZY!" dialogue line and effect.
  • MOUTH_SMALL_SMILE - Makes Crazy Dave smile when he is finished speaking.
  • MOUTH_BIG_SMILE - Makes Crazy Dave grin when he is finished speaking.
  • SHOW_WALLNUT - Makes Crazy Dave show you a Wall-nut. Used in Level 1-5.
  • SHOW_HAMMER - Makes Crazy Dave show you a Mallet. Used in Level 2-5.
  • SHOW_MONEYBAG - Makes Crazy Dave show you a Money bag. Used after completing Level 4-4, when giving Crazy Dave the Taco.
  • SHOW_TREE_FOOD - Makes Crazy Dave show you Tree Food. Used when you visit the Tree of Wisdom for the first time.
  • HANDING - Makes Crazy Dave show nothing in his hand. This is only used in Upsell, when Crazy Dave is showing the Squash in his hand, but if used anywhere else, nothing will appear.

Get Survival: Roof (Night)

  1. Go to Dr. Zomboss's Revenge, then quit after a while.
  2. Change the value to Whack a Zombie and kill every zombie (including Zomboss) and collect sun.
  3. Then Change it to Survival: Roof or Survival: Roof (Hard) or Survival: Roof (Endless).
  4. COMPLETE.

Switch Plants

You can make a Peashooter give sun or a Sunflower lob melons if you want. All you have to do is go into the compiled/reanim folder and switch two files (like Sunflower and Peashooter). Make sure the names are exactly the same or the game will not be able to start. If you want to have two of the same sprite for plants, just duplicate the file for Sunflower.reanim, and call another one Threepeater.reanim. Make sure the real Threepeater file is renamed something else. You can do this with other images too, like making the Melon-pult shoot wheels, or you can make the pictures for anything change.

Modifying animation trajectories

Before changing the animations, a copy of Adobe Flash/Animate must be installed, and the version must be greater than CS4 owing to the necessary .jsfl file required to compile the fla files to reanim. It's also highly recommended to have prior experience with these programs, as knowing what you're doing will make the editing process much more straightforward.

Note: this will only work for reanim.compiled

First, download the necessary files from this video:

An example of the right (left) and wrong (right) ways to organize a .fla file for conversion to .reanim.

Then open up one of the .fla files that you wanted to change the animations with. Make sure to not remove the anim layers included in the .fla files, as this will cause the game to crash. If you want to add additional files, you can drag and drop images you have saved onto the canvas.

After you're done editing your plants, or zombies' trajectory, make sure to put every additional files you have added (if there's any) to the reanim folder, or otherwise the game will crash. Then find the FlashReanimExport.jsfl included with the fla files and drag it into Flash.

If an error pops up, it means that you've done something wrong. An easy error to trigger is "TypeError: frame has no properties" - this can be solved by making sure every layer has frames extending to the end of the animation, and that the length of the animation is no different than that of the original.

After the script is finished running, it'll create a .reanim file in the same folder as your .fla is saved. Now for the last steps, you need to cut it and paste it on the compiled\reanim folder and open up PVZUtil 1.0 to convert your reanim file into a .reanim.compiled file. Enjoy modding!

Modifying Gameplay

This is much more advanced than simple texture modding or animation swapping. Since Plants vs. Zombies is compiled, most modding will require you to edit the actual exe file. This can be done with a program such as HxD. Lists of what hex addresses do what can be found throughout the internet, for example this doc. Most modding is done in the original version of the game, not the Game of the Year version. Each version of the game uses different hex addresses for each thing, but both are still moddable in the same ways provided you know which addresses correspond with eachother.

Note: If an address is above 400,000 and you are using HxD, subtract 400,000 in a hex calculator. Not all addresses will work properly.

First, open HxD. With Ctrl + O, you can select PvZ1 EXE

Next, find an address you want to change. The address is the hex value next to something. For example, Peashooter's recharge in non-GOTY is 29F2C4. When you find an address, press Ctrl + G and paste the address. Press enter. This will automatically go to the hex code that determines the recharge of peashooter in this case. At the right side, in data inspector you should see the value that it said it should be in the document. In some cases you may need to check hexadecimal base to see the proper address. At the side in data inspector, you can change the value to anything you want. For example, you can change Peashooter's recharge to 200, which is 2 seconds. Repeat this process for any address you want to modify. When you are done, Ctrl + S to save (you can't load PvZ otherwise)

If you mess something up with the EXE and it refuses to start, you have to restart your modding with a new EXE unless you have a backup.


Level editing

To modify the length of levels and what zombies spawn in each level, you will need to modify the hex values of the game exe.

The location of adventure level data is stored at the following hex addresses (in HxD, some other programs you may need to add 400000 to the address):

Original PvZ (Not Game of the Year) 2A34E8
PvZ Game of the Year edition 4D125A
Bloom and Doom (December 2008 beta) 293080

The first 50 values is the level length. The number stored is the amount of zombie waves that will spawn in the level, with every 10th being a huge wave. Levels can be set to have a number other than a multiple of 10, and will thus not end on a huge wave. The first levels have special code which overwrites this, so it is not recommended to edit them.

The following is the level lengths for the original version of Plants vs. Zombies:

Level: 1-1 1-2 1-3 1-4 1-5 1-6 1-7 1-8 1-9 1-10 2-1 2-2 2-3 2-4 2-5 2-6 2-7 2-8 2-9 2-10 3-1 3-2 3-3 3-4 3-5 3-6 3-7 3-8 3-9 3-10 4-1 4-2 4-3 4-4 4-5 4-6 4-7 4-8 4-9 4-10 5-1 5-2 5-3 5-4 5-5 5-6 5-7 5-8 5-9 5-10
Hex location (6A....) 34E8 34EC 34F0 34F4 34F8 34FC 3500 3504 3508 350C 3510 3514 3518 351C 3520 3524 3528 352C 3530 3534 3538 353C 3540 3544 3548 354C 3550 3554 3558 355C 3560 3564 3568 356C 3570 3574 3578 357C 3580 3584 3588 358C 3590 3594 3598 359C 35A0 35A4 35A8 35AC
Hex value : 04 06 08 0A 08 0A 14 0A 14 14 0A 14 0A 14 0A 0A 14 0A 14 14 0A 14 14 1E 14 14 1E 14 1E 1E 0A 14 0A 14 14 0A 14 0A 14 14 0A 14 14 1E 14 14 1E 14 1E 1E
Decimal value: 4 6 8 10 8 10 20 10 20 20 10 20 10 20 10 10 20 10 20 20 10 20 20 30 20 20 30 20 30 30 10 20 10 20 20 10 20 10 20 20 10 20 20 30 20 20 30 20 30 30

After the level length data, there is the zombie data for each level.

There are 50 levels in adventure, which means that there will be 50 values for each zombie. 1 means the zombie will appear in the level, and 0 means the zombie will not appear in the level. Between the zombie values there will be a singular address which will be a number corresponding with the zombie in question.

For example, in the non-GOTY PvZ, the address 2A3814 will be 03 indicating that the following 50 addresses will show what levels zombie number 03 will spawn in. Zombie 03 is the pole vaulting zombie, which appears in levels 1-6, 1-7, 1-9, 1-10, 2-4, 3-4, 3-9, 5-2. Therefore, there will be hex 01 on the corresponding with each of these levels. Note how some mini-game levels have special code, which is why the pole vaulting zombie is set to spawn in 2-5 but doesn't and why it spawns in 5-10 despite the level data not saying it. If you would like for the pole vaulting zombie to spawn in level 3-1 for example, all you need to is to go 21 addresses after the initial address containing the 03 and then set it to 01.


The following is the spawn data from the original version of Plants vs. Zombies. Note how this data is not entirely accurate, as other code exists that contradicts it. For example the aforementioned 2-5, which always spawns zombies from graves and thus does not use this data. Additionally, certain zombies are hardcoded to spawn on certain levels, notably the first one they appear in. The bungee zombie can also appear on every roof level whenever it summons zombies on the final wave, and the ducky tube zombie can also appear on every pool level.

Zombie Zombie1.png
Flag Zombie1.png
Conehead Zombie1.png
Pole Vaulting Zombie1.png
Buckethead Zombie1.png
Newspaper Zombie1.png
Screen Door Zombie1.png
Football Zombie1.png
Dancing ZombieOld.png
Backup DancerOld.png
Ducky Tube Zombie1.png
Snorkel Zombie1.png
Zomboni1.png
Zombie Bobsled Team1.png
Dolphin Rider Zombie1.png
Jack-in-the-Box Zombie1.png
Balloon Zombie1.png
Digger Zombie1.png
Pogo Zombie1.png
Zombie Yeti1.png
Bungee Zombie1.png
Ladder Zombie1.png
Catapult Zombie1.png
Gargantuar1.png
Imp1.png
Dr. Zomboss1.png
Peashooter Zombie1.png
Wall-nut Zombie1.png
Jalapeno Zombie1.png
Gatling Pea Zombie1.png
Squash Zombie1.png
Tall-nut Zombie1.png
Giga-gargantuar1.png
HEX (6A....) 35B4 3680 374C 3818 38E4 39B0 3A7C 3B48 3C14 3CE0 3DAC 3E78 3F44 4010 40DC 41A8 4274 4340 440C 44D8 45A4 4670 473C 4808 48D4 49A0 4A6C 4B38 4C04 4CD0 4D9C 4E68 4F34
1-1 Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No
1-2 Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No
1-3 Yes Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No
1-4 Yes Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No
1-5 Yes Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No
1-6 Yes Yes Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No
1-7 Yes Yes Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No
1-8 Yes Yes Yes No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No
1-9 Yes Yes Yes Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No
1-10 Yes Yes Yes Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No
2-1 Yes Yes No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No
2-2 Yes Yes Yes No Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No
2-3 Yes Yes Yes No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No
2-4 Yes Yes Yes Yes No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No
2-5 Yes Yes Yes Yes Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No
2-6 Yes Yes Yes No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No
2-7 Yes Yes Yes No No No Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No
2-8 Yes Yes Yes No No No No No Yes Yes No No No No No No No No No No No No No No No No No No No No No No No
2-9 Yes Yes Yes No No No Yes No Yes Yes No No No No No No No No No No No No No No No No No No No No No No No
2-10 Yes Yes Yes No No No Yes Yes Yes Yes No No No No No No No No No No No No No No No No No No No No No No No
3-1 Yes Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No
3-2 Yes Yes Yes No Yes Yes No Yes No No No No No No No No No No No No No No No No No No No No No No No No No
3-3 Yes Yes Yes No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No
3-4 Yes Yes Yes Yes Yes Yes No No No No No Yes No No No No No No No No No No No No No No No No No No No No No
3-5 Yes Yes Yes No No No No Yes No No No Yes No No No No No No No No No No No No No No No No No No No No No
3-6 Yes Yes Yes No No No No No No No No No Yes Yes No No No No No No No No No No No No No No No No No No No
3-7 Yes Yes Yes No Yes No No No No No No Yes Yes Yes No No No No No No No No No No No No No No No No No No No
3-8 Yes Yes Yes No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No
3-9 Yes Yes Yes Yes Yes No No No No No No No Yes Yes Yes No No No No No No No No No No No No No No No No No No
3-10 Yes Yes Yes No Yes No No No No No No Yes Yes Yes Yes No No No No No No No No No No No No No No No No No No
4-1 Yes Yes Yes No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No No
4-2 Yes Yes Yes No No No No Yes No No No No No No No Yes No No No No No No No No No No No No No No No No No
4-3 Yes Yes Yes No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No
4-4 Yes Yes Yes No No No No No No No No No No No Yes No Yes No No No No No No No No No No No No No No No No
4-5 Yes Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No
4-6 Yes Yes Yes No No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No
4-7 Yes Yes Yes No Yes No No No No No No No No No No Yes No Yes No No No No No No No No No No No No No No No
4-8 Yes Yes Yes No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No
4-9 Yes Yes Yes No Yes No No No No No No No No No No No Yes No Yes No No No No No No No No No No No No No No
4-10 Yes Yes Yes No Yes No No No No No No No No No No Yes Yes Yes Yes No No No No No No No No No No No No No No
5-1 Yes Yes Yes No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No
5-2 Yes Yes Yes Yes Yes No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No
5-3 Yes Yes Yes No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No
5-4 Yes Yes Yes No No No No Yes No No No No No No No No No No Yes No No Yes No No No No No No No No No No No
5-5 Yes Yes Yes No Yes No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No
5-6 Yes Yes Yes No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No
5-7 Yes Yes Yes No No No No No No No No No No No No No No No No No Yes Yes Yes No No No No No No No No No No
5-8 Yes Yes Yes No No No No No No No No No No No No No No No No No No No No Yes Yes No No No No No No No No
5-9 Yes Yes Yes No Yes No No No No No No No No No No Yes No No No No Yes Yes Yes Yes Yes No No No No No No No No
5-10 Yes Yes Yes No Yes No No No No No No No No No No Yes No No No No Yes Yes Yes Yes Yes No No No No No No No No


The document linked above also contains this data, in more detail. Zombies are in the order of the almanac, with Zombotany zombies coming afterwards and giga-gargantuar last. In the beta versions that have the Dog Walking Zombie, the Dog Zombie, and the Propeller Zombie, their value is between the normal almanac zombies and the Zombotany zombies, thus shifting the addresses of the Zombotany zombies and giga-gargantuar.

Zombies that have not yet been encountered will not appear if you set them to appear in levels before they are first encountered. Setting address 00D6A3 (HxD in original non-GOTY PvZ) to 235 will disable this.

Gallery

See Modify Plants vs. Zombies/Gallery of mods.