Repair MapInfos

I posted this on rpgmakerweb forums months ago and forgot about it. Re-post it here because Netsu/Enigma reminded me.

This is a utility snippet you should use if your MapInfos.rvdata2 file is corrupted and you don’t have any suitable backup. MapInfos stores the map tree structure in the editor, so it’s a bit annoying to restore manually: it involves creating a bunch of blank maps in a new project, then paste the old ones in the Data folder… It’s ok if you have 20 maps, but what about 250?

First, create a new project (important!) and copy all the maps from the old project (just copy them in the Data folder and paste them in the new project’s Data folder). Then, paste this snippet in the new project’s script editor:

mapinfos = {}
i = 0
Dir.entries(File.expand_path('./Data')).each do |filename|
  if filename =~ /Map*(\d+).rvdata2/
    mapinfos[i] =
    mapinfos[i].name = sprintf("MAP%03d", $1) rescue "Unknown"
    i += 1
save_data(mapinfos, "MapInfos.rvdata2")

This will recreate a brand new MapInfos.rvdata2 with all the maps of your real project. Replace the old corrupted file with this new one. It will not recreate the map names nor the tree structure because they are lost but at least all of your maps will appear in the editor, which isn’t the case with a “blank” map infos file. Note that the file is created in the new project folder itself, not the Data folder.

Lastly, to avoid such a situation again, remember to backup your files.


About Kread-EX

I code. And try to make games.

Posted on 30/12/2012, in RGSS3, RPG Maker VX Ace and tagged , . Bookmark the permalink. 1 Comment.

  1. Added a rescue clause in case of… problems.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: