Metal Gear Solid V: The Phantom Pain

File information

Last updated

Original upload

Created by

The Iron Rose

Uploaded by

Vazeron1

Virus scan

Safe to use

About this mod

A quick and simple hassle free tutorial for modifying The Phantom Pain's Lua Files.

Permissions and credits
Have a basic guide to modding MGSV, aimed at total newcomers.

1) Download the MGSV QAR Tool from the files section.
2) Update your dictionary.txt file from the files section.
3) Extract the .lua files from data0.dat and 00.dat. Run the following in the command prompt and make sure to include the -r flag, as it decrypts the .lua: MGSV_QAR_TOOL.exe 01.dat -r or MGSV_QAR_Tool data1.dat -r
4) Use Notepad++ to make your changes
---4a) Optional: Download JSON Viewer from the Notepad++ Plugin Manager (highlight the entire document before using) for easier reading
---4b) Required if you have followed step 4a: If you have formatted the .lua, use regex to revert back to unformatted .lua. You don't need to do this if you have not formatted the .lua.
5) Repack 00.dat with the following command: MGSV_QAR_TOOL.exe 00.inf -r
---5a) If you have added a file not normally present in 00.dat: Open data0.inf and copy the line containing the edited .lua file(s) you have added to your 00 folder. Paste into 00.inf. Obviously this requires you to place the new file in the proper location with a proper folder tree.
6) Copy the new 00.dat back to MGS_TPP/master/0 and enjoy!

Note: Make sure you are modding 00.dat, not data0.dat. Data0.dat contains vanilla, unpatched files. 00.dat is the patch file, and will overwrite data0.dat in case of a conflict, and will also contain the most up to date .lua files in any event. 01.dat should also work for this purpose, but it's a larger file that's broadly irrelevant for most gameplay changes.

Note for merging: If you want to use two mods together (such as my Enhanced Suppressors mod and the Item Unlocker), take the edited .lua from one mod and put it into your 00 folder, then rebuild 00.dat. If the mods in question contain files that are not normally in 00.dat you'll have to make sure all the edited files are named and listed in 00.inf.

There's also a mod installer called SnakeBite that some mods require. Installing and using Snakebite is as simple as downloading and running the program.

Note on Regex: Regex is shorthand for Regular Expression. Normally, .lua files for MGSV have no whitespace or newlines, which means all the code is on just one line. They can be formatted as JSON for easier reading, but unfortunately the game won't read them back in. To resolve this, you can do one of two things.
1) Keep one version of the .lua file in question JSON formatted and examine it for reference. Keep another copy of the .lua file unformatted and make any changes to that file.
2) Edit away with the formatted JSON, and then when it comes time to rebuild the patch (00.dat/data0.dat) use regular expressions to strip the JSON formatting.

Now, I don't know regex very well and only really use it for unformatting JSON for MGSV, but it has wider uses. Fortunately there's really only two commands you need to know. "\R" to remove all lines and and "^\s*" to remove all whitespace. Use as follows and make sure to run ^\s* before \R.



So to revert JSON formatting open Notepad++, go to replace, type in ^\s* in the find bar, put nothing in the replace bar, hit replace all. Do the same for \R. Make sure to tick the "Regular Expression" box.

Use Notepad++'s plugin manager to find JSON Viewer.