View on GitHub

Metal Gear Solid V: The Phantom Pain technical information

Intro

As a modder, I restart game a lot of times and packing lua files back takes away my free time. That's why I had to make a loader, which reads lua scripts situated outside *.dat archives. It also is capable of binding functions used in external lua files to key combinations. Keys can be defined in a separate config file, stored outside of archives as well. The only thing you'll ever need to pack is the loader itself (and assets if you use them in your mod).

Installation

Manual

Snakebite

Usage

Hold ZOOM+ACTION (V+E) to bind functions to keys, then hold ZOOM+_your_key to call your function.
Script loader will look for your lua files in different directories (listed in LUA variable _G['package']['path']), I use main game directory (SteamApps\common\MGS_TPP\lua). You will need to create 'lua' folder there and put your scripts there along with provided config. An example script is included.

Every time you bind functions to keys, script loader reloads all modules listed in config file, so it is perfect for debugging your awesome mod. No game restart, no packing, no loading.

It also announces typical errors in your code (ie division by zero, wrong syntax or stuff like that) - just like regular interpreter does. It won't catch errors from MGSV functions though, so don't expect much.

Everyting you call can be logged in MGS_TPP\log.txt file.
Add local helpers = require("helpers"), then
use helpers.log(str, announce, level) in your code to put log messages into the log, no more waiting for slow terminal output.You will need to create that file by yourself.

Config file

Config is written in json because it allows me to use nested arrays. Not a fan of INI and YAML looks uncomfortable.

Structure:

Hold ZOOM+ACTION (V+E) to bind functions to keys listed in config file.

Binding more keys

Just add a new entry into keys section based on example above then hold ZOOM+ACTION to apply changes.

Important note: functions with arguments have to be wrapped into a wrapper function without arguments. Example: your function do_awesome_stuff(1,2,3) has to be wrapped in another function do_something(), which will be referenced in config.

Links