MSON files, inXile's variant of the JSON format, are used for modding the game. They are the text representation of each object and contain all the editable fields and properties. The game will automatically write out the original objects to the 'Mods' folder so that they can be modified.
The current location of the 'Mods' folder can be found in Options -> Modding, and can also be changed there.
Any text editor will suffice, but Notepad++ is recommended for viewing and editing MSON files.
FOLDERS
- Export: MSON files are written here after the objects are loaded by the game. Note that each scene (map) must be loaded first in-game before it can be exported. Game never reads from this folder.
- Import: Location where mod changes have to be stored. Game never writes to this folder.
- ExportImport: Same as 'Export', but after an override MSON from 'Import' has been applied; view these to confirm that any changes have been applied correctly. Game never reads from this folder.
- Arizona/sceneName: Scene-specific data for maps in Arizona.
- LosAngeles/sceneName: Scene-specific data for maps in California.
- Table: Contains special, game-wide settings.
- Scene-specific: If in the 'Arizona' or 'LosAngeles' folders, then fall into this category. Access to these objects is limited to their specific map.
- Universal: If not scene-specific, then object is always loaded and can always be referenced in MSON files.
The folder layout mimics the class hierarchy. Class determines which fields/properties the object will have and how it will behave. The folder structure for any files in 'Import' should always be the same as in 'Export'.
For instance, if you wanted to change the values of the M-16 rifle, you would copy the MSON file from
"Mods\Export\ItemTemplate\ItemTemplate_Equipment\ItemTemplate_Weapon\ItemTemplate_WeaponRanged\AssaultRifle_Tier_3_2.mson"
into
"Mods\Import\ItemTemplate\ItemTemplate_Equipment\ItemTemplate_Weapon\ItemTemplate_WeaponRanged\AssaultRifle_Tier_3_2.mson"
and then modify it.
If you wanted to create a new ranged weapon, you would similarly place it in that directory, eg.
"Mods\Import\ItemTemplate\ItemTemplate_Equipment\ItemTemplate_Weapon\ItemTemplate_WeaponRanged\myRifle.mson"
*Important* Do not copy all the MSON files from Export into Import. This will dramatically slow down loading, as all those files will need to be parsed than the non-changes applied to each object. Only copy files over that you actually intend to edit.
REFERENCE MATERIAL - in "Mods\Export"
- classes.txt: Can be used to look up the data types for each field of a class.
- enums.txt: All the valid options for each enum field.
- miscellaneous.txt: Various lists.
- portraits.txt: Names of all the built-in portraits.
LOG FILES - in "Mods"
- debug.txt: General status messages.
- debug_import.txt: Any messages concerning the loading of MSON overrides will be outputted here, so if a change doesn't seem to be working, check for any errors.
- debug_export.txt: Messages regarding the writing of pre-existing object MSON files go here.
- debug_exportimport.txt: Messages regarding the writing of MSON files after an override.
- debug_statcalc.txt: If enabled in "Table\Game.mson", will write out the complete calculation for the selected stats.
The main Unity log file should also be checked for errors:
Windows: output_log.txt in "Wasteland 2 Director's Cut\Build\WL2_Data"
Mac: Player.log in Macintosh HD -> Users -> USERNAME -> Library -> Logs -> Unity and look for Player.log
Linux: Player.log in "~/.config/unity3d/inXile Entertainment/Wasteland2DC:Director's Cut/" and look for Player.log
OBJECT NAMES
Each object derived from UnityEngine.Object has a name. To refer to other objects in MSON override files, you have to use these names. If there's a space ( ) in the name, use double-quotes (") around the name.
Object names must be unique within a class tree, ie. you can't have both an ItemTemplate_Stackable 'Bandage' and ItemTemplate_Usable 'Bandage', as they are both in the ItemTemplate class hierarchy. These are always case-insensitive.
In situations where a universal and scene-specific MSON with the same name both exist, the universal one will take precedence.
To create new objects simply give them a distinct name.
Some objects, notably GameObjects, don't always have unique names, so be wary of changing those fields and test to confirm the right object was linked to.
MSON EDITING
The best way to learn the formatting rules is to look at the exported MSONs. Find pre-existing objects that already have the intended functionality that you want, and then copy over the relevant fields.
- The field/property name and the value to be assigned to it must be separated by a colon (:).
- Overrides only need to contain the fields that you wish to modify, the rest should be deleted so the game does not waste time on them.
eg. the following is a valid MSON file for an ItemTemplate_Weapon, with the other fields remaining unchanged:
{
minDamage : 5
maxDamage : 12
armorPenetration : 3
}
- A text string or object name does not need to be surrounded by double-quotes (") if only a single word.
- Enum fields will accept 1) an integer, 2) just the value name, 3) the enum name followed by a period (.) followed by the value name.
eg. the weaponType field in ItemTemplate_Weapon is of type WeaponType enum, all the following are equivalent:
weaponType : WeaponType.Ranged_2H
weaponType : RANGED_2H
weaponType : 4
- Multiple array/list entries on one line can be separated using a comma (,). Alternatively, a line return works.
- The first element in an array/list has the index 0.
- Indices for arrays/lists are optional, if automatically increment based on last provided index. If none were ever provided, will start at 0.
- An ampersand (&) after the assignment colon can be used to keep the contents of the original array/list and only selectively replace the provided elements.
eg. both of the following are equivalent, altering only the 8th-element in the array:
equipment :& [ EquipmentSlot.WeaponR : Energy_Toaster_Gamma_Ray ]
equipment :& [ 7 : Energy_Toaster_Gamma_Ray ]
- References to objects/textures/meshes should never include the file extension, ie. MSON/PNG/OBJ/etc.
- Comments must be placed behind two forward slashes (//). Exported files will contain a description of many fields in a comment.
- New objects can be initialized with values from another object by placing the name of the pre-existing object and a colon ahead of the open curly bracket ({) at the start of the MSON file.
eg.
Handgun_Tier_1_1 : {
displayName : "<@>Desert Eagle"
price : 280
}
- To output full calculations of a particular stat, the debugStats field in Game.mson in the 'Table' folder can be used.
eg.
debugStats : [ // data will be written to the 'debug_statcalc.txt' file
{
statName : chanceToHit
mobName : ""// checks both displayed and template name; partial matches accepted
combatOnly : true
targetedOnly : true // if the calculation is versus a specific target
}
]
0 comments