Plants vs. Zombies Wiki
Advertisement

The user file in Plants vs. Zombies contains data about your progress in the game, money, unlocked modes, trophies, achievements, purchased items, plants in your Zen Garden, and your Zombatars. By directly modifying the user file you can change any of these things, and do certain things that are either very difficult (like earning $999,990) or not possible in the game (like having a Cob Cannon in your Zen Garden). You can also do things that are very easy if you want.

Plants vs

Screenshot of Plants vs. Zombies user file editor. See download link in text at left.

User file editor

The easiest way to modify the user file if you have the PC version of Plants vs. Zombies is using the Plants vs. Zombies user file editor. See screenshot at right and sample video below that walks through some of the features.

Plants_vs._Zombies_user_file_editor

Plants vs. Zombies user file editor

Video demonstrating use of the user file editor, along with commentary.

 

To use the user file editor, simply download the ZIP archive, extract it, and execute the application. It will locate the file and provide options to edit it. It automatically creates backups of your user file, so it is safe to use. Report any issues to dc@moonflare.com or. Full source code is available from github  under the Creative Commons Zero Waiver.

The remainder of this article describes the format of the user file. This information can be used to directly modify the user file using a hex editor, such as Fhred, or to create new software tools to manipulate it.

File location and version

This information is based on the following version of Plants vs. Zombies (from readme.html in the installation directory):

Version 1.2.0.1073
Release Date: May 5, 2009
Build Date: August 20, 2012
Platform Path
OS X ~/Library/Application Support/PopCap/PlantsVsZombiesMac/userdata
Windows For Vista and up: C:\ProgramData\PopCap Games\PlantsVsZombies\userdata
For 2000 and XP: A folder named “userdata” under the directory in which the main executable file PlantsVsZombies.exe is located

Your user file is called user1.dat. If you have multiple users, there might be user2.dat, etc. - they are in the order listed in users.dat. If your file starts with 0x0C (file version 12) it should be compatible with the below information. Otherwise there will be differences, but overall it should be similar.

The game loads and saves user1.dat at startup/exit and when switching users, and also saves it at various other points. You must exit the game or select a different user to edit the file. You can only edit it after starting the first level.

WARNING: Create a backup copy of your original user#.dat file before modifying it, or you may end up with a corrupt file that crashes the game with no way to recover except to uninstall and reinstall, meaning you will lose all of your data!

Example

Say that you wanted to increase your money to $100000. The field for money (see below) is at offset 0x008, and is coded as the number 10000 (money divided by 10). The number 10000 in hexadecimal is 2710. The field is four bytes long, and the bytes (pairs of hexadecimal digits) are provided in reverse order (little endian), so this will be encoded as 10 27 00 00. So load user1.dat in your hex editor, go to offset 0x008 in the file, and change the next four bytes to 10 27 00 00.

Types and formatting

In the below, decimal integer values will be written normally (e.g. 25) and hexadecimal values preceded by "0x" as in "0x1C". All values are little-endian. Fields labelled "UNIX timestamp" are given in terms of the number of seconds since Jan 1, 1970 12:00:00am in UTC and can be converted using this online converter .

File format

Offset Size
(bytes)
Description
0x000 4 File format version (0x0C or 12 with PvZ version 1.2.0.1073)
0x004 4 Current level in Adventure Mode (from 1 to 50, e.g. 3-5 is 25). The game also recognizes levels 51-60 (stage 6), which takes place in the Day setting but has harder zombies and is buggy. If 0x00C (Number of times Adventure Mode completed) is zero, this also determines what plants are available and some unlocks. They become available at the following levels:



Note: All items that become available in the shop at certain levels can be enabled without purchasing them using other fields in the file below, allowing them to be used at lower levels.

0x008 4 Money divided by 10 (e.g. 33 if you have $330). Max value is 0x0CCCCCCC, giving $2,147,483,640. If you purchase anything or pick up any coins, it will be immediately reduced to $999,990 (corresponding to 0x0001869f).
0x00C 4 Number of times Adventure Mode completed
0x010 4 Flags attained at Survival: Day (out of 5)
0x014 4 Flags attained at Survival: Night (out of 5)
0x018 4 Flags attained at Survival: Pool (out of 5)
0x01C 4 Flags attained at Survival: Fog (out of 5)
0x020 4 Flags attained at Survival: Roof (out of 5)
0x024 4 Flags attained at Survival: Day (Hard) (out of 10)
0x028 4 Flags attained at Survival: Night (Hard) (out of 10)
0x02C 4 Flags attained at Survival: Pool (Hard) (out of 10)
0x030 4 Flags attained at Survival: Fog (Hard) (out of 10)
0x034 4 Flags attained at Survival: Roof (Hard) (out of 10)
0x038 4 Streak length at Survival: Day (Endless) (up to 0x7FFFFFFF)
0x03C 4 Streak length at Survival: Night (Endless) (up to 0x7FFFFFFF)
0x040 4 Streak length at Survival: Endless (up to 0x7FFFFFFF)
0x044 4 Streak length at Survival: Fog (Endless) (up to 0x7FFFFFFF)
0x048 4 Streak length at Survival: Roof (Endless) (up to 0x7FFFFFFF)
0x04C 4 Has ZomBotany minigame trophy (0/1)
0x050 4 Has Wall-nut Bowling minigame trophy (0/1)
0x054 4 Has Slot Machine minigame trophy (0/1)
0x058 4 Has It's Raining Seeds minigame trophy (0/1)
0x05C 4 Has Beghouled minigame trophy (0/1)
0x060 4 Has Invisi-ghoul minigame trophy (0/1)
0x064 4 Has Seeing Stars minigame trophy (0/1)
0x068 4 Has Zombiquarium minigame trophy (0/1)
0x06C 4 Has Beghouled Twist minigame trophy (0/1)
0x070 4 Has Big Trouble Little Zombie minigame trophy (0/1)
0x074 4 Has Portal Combat minigame trophy (0/1)
0x078 4 Has Column Like You See 'Em minigame trophy (0/1)
0x07C 4 Has Bobsled Bonanza minigame trophy (0/1)
0x080 4 Has Zombie Nimble Zombie Quick minigame trophy (0/1)
0x084 4 Has Whack a Zombie minigame trophy (0/1)
0x088 4 Has Last Stand minigame trophy (0/1)
0x08C 4 Has ZomBotany 2 minigame trophy (0/1)
0x090 4 Has Wall-nut Bowling 2 minigame trophy (0/1)
0x094 4 Has Pogo Party minigame trophy (0/1)
0x098 4 Has Dr. Zomboss's Revenge minigame trophy (0/1)
0x09C 4 Has Art Challenge Wall-nut hidden minigame trophy (0/1)
0x0A0 4 Has Sunny Day hidden minigame trophy (0/1)
0x0A4 4 Has Unsodded hidden minigame trophy (0/1)
0x0A8 4 Has Big Time hidden minigame trophy (0/1)
0x0AC 4 Has Art Challenge Sunflower hidden minigame trophy (0/1)
0x0B0 4 Has Air Raid hidden minigame trophy (0/1)
0x0B4 4 Has Ice Level hidden minigame trophy (0/1)
0x0B8 4 Has Zen Garden trophy on Limbo Page (0/1)
0x0BC 4 Has High Gravity hidden minigame trophy (0/1)
0x0C0 4 Has Grave Danger hidden minigame trophy (0/1)
0x0C4 4 Has Can You Dig It? hidden minigame trophy (0/1)
0x0C8 4 Has Dark Stormy Night hidden minigame trophy (0/1)
0x0CC 4 Has Bungee Blitz hidden minigame trophy (0/1)
0x0D0 4 Has Squirrel hidden minigame trophy (0/1)
0x0D4 4 Height of Tree of Wisdom in feet (up to 0x7FFFFFFF)
0x0D8 4 Has Vasebreaker puzzle trophy (0/1)
0x0DC 4 Has To the Left puzzle trophy (0/1)
0x0E0 4 Has Third Vase puzzle trophy (0/1)
0x0E4 4 Has Chain Reaction puzzle trophy (0/1)
0x0E8 4 Has M is for Metal puzzle trophy (0/1)
0x0EC 4 Has Scary Potter puzzle trophy (0/1)
0x0F0 4 Has Hokey Pokey puzzle trophy (0/1)
0x0F4 4 Has Another Chain Reaction puzzle trophy (0/1)
0x0F8 4 Has Ace of Vase puzzle trophy (0/1)
0x0FC 4 Streak length at Vasebreaker Endless (up to 0x7FFFFFFF)
0x100 4 Has I, Zombie puzzle trophy (0/1)
0x104 4 Has I, Zombie Too puzzle trophy (0/1)
0x108 4 Has Can You Dig It? puzzle trophy (0/1)
0x10C 4 Has Totally Nuts puzzle trophy (0/1)
0x110 4 Has Dead Zeppelin puzzle trophy (0/1)
0x114 4 Has Me Smash! puzzle trophy (0/1)
0x118 4 Has ZomBoogie puzzle trophy (0/1)
0x11C 4 Has Three Hit Wonder puzzle trophy (0/1)
0x120 4 Has All your brainz r belong to us puzzle trophy (0/1)
0x124 4 Streak length at I, Zombie Endless (up to 0x7FFFFFFF)
0x128 4 Has Upsell trophy in Limbo Page (0/1)
0x12C 4 Has Intro trophy in Limbo Page (0/1)
0x130-0x19F Unknown
0x1A0 4 Has Gatling Pea plant from shop (0/1)
0x1A4 4 Has Twin Sunflower plant from shop (0/1)
0x1A8 4 Has Gloom-shroom plant from shop (0/1)
0x1AC 4 Has Cattail plant from shop (0/1)
0x1B0 4 Has Winter Melon plant from shop (0/1)
0x1B4 4 Has Gold Magnet plant from shop (0/1)
0x1B8 4 Has Spikerock plant from shop (0/1)
0x1BC 4 Has Cob Cannon plant from shop (0/1)
0x1C0 4 Has Imitater from shop (0/1)
0x1C4 4 Unknown, normally zero
0x1C8 4 Days since Jan 1, 2000 that left Marigold purchased from shop (zero if not purchased). Increments at midnight local time. Used to enforce one purchase per day.
0x1CC 4 Days since Jan 1, 2000 that center Marigold purchased from shop (zero if not purchased). Increments at midnight local time. Used to enforce one purchase per day.
0x1D0 4 Days since Jan 1, 2000 that right Marigold purchased from shop (zero if not purchased). Increments at midnight local time. Used to enforce one purchase per day.
0x1D4 4 Has Golden Watering Can from shop (0/1)
0x1D8 4 Amount of Fertilizer + 1000 (up to 0x7FFFFFFF, zero to hide)
0x1DC 4 Amount of Bug Spray + 1000 (up to 0x7FFFFFFF, zero to hide)
0x1E0 4 Has Phonograph from shop (0/1)
0x1E4 4 Has Gardening Glove from shop (0/1)
0x1E8 4 Has Mushroom Garden from shop (0/1)
0x1EC 4 Has Wheel Barrow from shop (0/1)
0x1F0 4 UNIX timestamp when Stinky the Snail last awoken (zero if not purchased from shop). Stinky will remain awake for three minutes after this time.
0x1F4 4

Number of Seed Slots minus 6 / number of slot upgrades (0 to 4)

0x1F8 4 Has Pool Cleaner from shop (0/1)
0x1FC 4 Has Roof Cleaner from shop (0/1)
0x200 4 Number of remaining uses of Garden Rake (up to 0xFFFFFFFF)
0x204 4 Has Aquarium Garden (0/1)
0x208 4 Amount of chocolate + 1000 (up to 0x7FFFFFFF, zero to hide)
0x20C 4 Tree of Wisdom available (0/1)
0x210 4 Amount of Tree Food + 1000 (up to 0x7FFFFFFF). If set to zero, Crazy Dave will appear and give 5 Tree Food as though it were your first visit to the Tree of Wisdom.
0x214 4 Has Wall-nut First Aid from shop (0/1)
0x218-0x2EF Unknown
0x2F0 4 Unknown. (Set from 0 to 1 when getting the Almanac, and later reset to 0, but unknown effect.)
0x2F4 4 UNIX timestamp when Stinky the Snail last fed chocolate (zero if never). Stinky will remain awake and hyper for 1 hour after this time.
0x2F8 4 x position of Stinky the Snail
0x2FC 4 y position of Stinky the Snail. If these are set too large, Stinky will be offscreen but still moving.
0x300 4 Mini-games unlocked (0/1)
0x304 4 Puzzle Mode unlocked (0/1)
0x308 4 Animate unlocking of last unlocked level on next visit to Mini-games. (0/1)
0x30D 4 Animate unlocking of last unlocked Vasebreaker level on next visit to Puzzle Mode. (0/1)
0x310 4 Animate unlocking of last unlocked I, Zombie level on next visit to Puzzle Mode. (0/1)
0x314 4 Animate unlocking of last unlocked level on next visit to Survival Mode. (0/1)
0x318 4 Unknown, normally zero
0x31C 4 Show "Adventure Complete!" dialog on next visit to main menu. (0/1)
0x320 4 Has Magic Taco. When starting level 4-5 (0x23), Crazy Dave will buy your taco for $1000. (0/1)
0x324 4 Unknown. (Turned from 0->1 when visiting Zen Garden with Stinky the Snail for first time)
0x328 4 Unknown, normally zero
0x32C 4 Unknown, normally zero
0x330 4 Number of plants in Zen Garden

Followed by 88 (0x58) bytes for each plant in the Zen Garden, with the following structure:

Offset Size
(bytes)
Description
0x00 4 Plant type (in order of Almanac, plus some extra):


0x04 4 Garden location:


0x08 4 Column of plant, or in Mushroom Garden/Aquarium Garden spot number (0 to 7)
0x0C 4 Row of plant (0 to 3 in Zen Garden, 0 in Mushroom Garden/Aquarium). If out of range, plant will render in upper-left and be unclickable. Plants can be placed in same position and still be manipulated.
0x10 4 Unknown, normally 1
0x14 4 Unknown, normally 0
0x18 4 Last watering UNIX timestamp, zero if never. Plant will want water if this is more than several seconds in the past and number of times watered is not maximum for current size.
0x1C 4 Unknown, normally 0
0x20 4 Color of plant (only affects Marigolds):
  • 0x1 - White petals, white center
  • 0x2 - White petals, yellow center
  • 0x3 - Magenta petals, yellow center
  • 0x4 - Orange petals, yellow center
  • 0x5 - Pink petals, yellow center
  • 0x6 - Cyan petals, yellow center
  • 0x7 - Red petals, yellow center
  • 0x8 - Blue petals, yellow center
  • 0x9 - Purple petals, yellow center
  • 0xA - Light purple petals, yellow center
  • 0xB - Yellow petals, yellow center
  • 0xC - Light green petals, yellow center
  • Out of range will default to white petals, yellow center
0x24 4 Number of times fertilized (plant grows with each, up to 3)
0x28 4 Number of times watered (up to 6), resets to zero after Fertilizer or Phonograph used
0x2C 4 Unknown, normally 5
0x30 4

What the plant currently needs for happiness:



Need for water/fertilizer is based on other fields (last watered/fertilized timestamp and number times watered/fertilized).

0x34 4 Unknown, normally 0
0x38 4 Last use of Phonograph/Bug Spray UNIX timestamp, zero if never. Plant will remain happy for 1 day after this timestamp.
0x3C 4 Unknown, normally 0
0x40 4 Last fertilized UNIX timestamp, zero if never
0x44 4 Unknown, normally 0
0x48 4 Unknown, normally 0
0x4C 4 Unknown, normally 0
0x50 4 Unknown, normally 0
0x54 4 Unknown, normally 0

The Zen Garden plants are followed by the following fields. In the table below offsets start after the last plant. To find the base, take the number at offset 0x330 (number of plants), multiply it by 88 (0x58), and add 0x334.

Offset Size
(bytes)
Description
0x00 2 Home Lawn Security achievement (zero/nonzero)
0x02 2 Nobel Peas Prize achievement (zero/nonzero)
0x04 2 Better Off Dead achievement (zero/nonzero)
0x06 2 China Shop achievement (zero/nonzero)
0x08 2 SPUDOW! achievement (zero/nonzero)
0x0A 2 Explodonator achievement (zero/nonzero)
0x0C 2 Morticulturalist achievement (zero/nonzero)
0x0E 2 Don't Pea in the Pool achievement (zero/nonzero)
0x10 2 Roll Some Heads achievement (zero/nonzero)
0x12 2 Grounded achievement (zero/nonzero)
0x14 2 Zombologist achievement (zero/nonzero)
0x16 2 Penny Pincher achievement (zero/nonzero)
0x18 2 Sunny Days achievement (zero/nonzero)
0x1A 2 Popcorn Party achievement (zero/nonzero)
0x1C 2 Good Morning achievement (zero/nonzero)
0x1E 2 No Fungus Among Us achievement (zero/nonzero)
0x20 2 Beyond the Grave achievement (zero/nonzero)
0x22 2 Immortal achievement (zero/nonzero)
0x24 2 Towering Wisdom achievement (zero/nonzero)
0x26 2 Mustache Mode achievement (zero/nonzero)
0x28 1 Accepted Zombatar license agreement (0/1)
0x29 4 Number of Zombatars

Followed by 72 (0x48) bytes for each Zombatar, with the following structure:

Offset Size
(bytes)
Description
0x00 4 Unknown, always 0xFFFFFFFF
0x04 4 Skin color (0 to 11)
0x08 4 Clothes type (0 to 11, 0xFFFFFFFF for none)
0x0C 4 Clothes color (always 0x2F for None selected)
0x10 4 Tidbits type (0 to 13, 0xFFFFFFFF for none)
0x14 4 Tidbits color (always 0x2F for None selected)
0x18 4 Accessories type (0 to 14, 0xFFFFFFFF for none)
0x1C 4 Accessories color (always 0x2F for None selected)
0x20 4 Facial hair type (0 to 16, 0xFFFFFFFF for none)
0x24 4 Facial hair color (0x0C to 0x1C, 0x1D for red X, 0x2F for None selected)
0x28 4 Hair type (0 to 15, 0xFFFFFFFF for none)
0x2C 4 Hair color (0x0C to 0x1C, 0x1D for red X, 0x2F for None selected)
0x30 4 Eyewear type (0 to 15, 0xFFFFFFFF for none)
0x34 4 Eyewear color (0x1E to 0x2E, 0x2F for red X/None selected)
0x38 4 Hat type (0 to 13, 0xFFFFFFFF for none)
0x3C 4 Hat color (0x1E to 0x2E, 0x2F for red X/None selected)
0x40 4 Backdrop type (0 to 4)
0x44 4 Backdrop color - applies only if type is 4 (0x1E to 0x2E, 0x2F for red X/None selected)

The Zombatars are followed by the following fields. In the table below offsets start after the last Zombatar. To find the base, take the number at offset 0x330 (number of plants), multiply it by 88 (0x58), take the number at offset 0x2D (number of Zombatars), multiply it by 72 (0x48), and add both to 0x365.

Offset Size
(bytes)
Description
0x00-0x13 Unknown
0x14 1 Have created at least one Zombatar before, don't display saved JPEG to desktop message (0/1)

Notes

  • The game sets achievements to 0x0101 when obtained, but any nonzero value will work. Some achievements are set to 1 automatically at startup if their conditions are already met and cannot be turned off (e.g. Towering Wisdom achievement if height of the Tree of Wisdom is at least 100 ft, Home Lawn Security if Adventure Mode is completed at least once).
  • There is no field for the Gold Sunflower Trophy. You get it automatically if you enable all other trophies.
Advertisement