Red Faction: Guerrilla Steam Edition

Red Faction: Guerrilla Steam Edition

Not enough ratings
[Mod Creation] Guide to the ModLoader Format (TL;DR Make stuff work together!)
By Sturm-Falke101
Medium level tutorial for new mod creators to convert their existing work to the ModLoader format. (TL;DR Make stuff work together!)
   
Award
Favorite
Favorited
Unfavorite
Information for Mod Creators
Before we start: This is not a tutorial on how to mod in general. You should learn how to mod prior to making ModManager-Compatible mods. A correct guide will be made in the future.

While reading this you should always keep the included mods at hand and look at them as a reference. Seeing stuff "in action" will always ease the learning process alot.

You can obtain the ModManager Under the section titled Download Information.
You can obtain the Decompiler required to mess with the files Here[www.factionfiles.com].
General Structure
Each mod comes in its own folder, containing a ModInfo.xml file. In case you want to start a new mod it is usually the best to copy an existing one and then modify it to your needs.
The general structure of the modinfo.xml file looks like this:

<Mod Name="My Mod Name"> <Author>My Name</Author> <Description> A description text about my mod.</Description> <WebLink name="Name of my homepage">http://www.myhomepage.com</WebLink> <Changes> ... </Changes> </Mod>

Feel free to change any of the above, you can even delete the weblink part if you don't want a link.
These tags are simply shown in ModManager and do not have any influence in the game.
<Changes> Tag
The <Changes> tag is where all the magic happens. It is a list of actions that the ModManager should perform while activating the mod. There are two types of change actions available (That we know of)
  • Replace
  • Edit
<Replace> Tag
Replace
<Replace File="build/pc/cache/items.vpp/repair_tool.str2_pc" NewFile-"repair_tool.str2_pc" />

Replace is the most simple change action available. It will take a file from your mod folder with the same name as defined in the "Newfile" attribute and use it to replace the original game file defined in the "File" attribute. The "File" path can even describe a file contained in a game archive.
In the above example the ModManager automatically understands that "items.vpp" describes the unpacked version of the archive "items.vpp_pc". thus it will first unpack the archive "items.vpp_pc" to "items.vpp" and replace the contained file "repair_tool.str2_pc" with the file from your mod directory. Afterwords it will pack the archive "items.vpp_pc" up again.

DO NOT use Replace to exchange XTBL files! It will work, BUT your mod will override all changes made by other mods to this file! those mods are considered "unclean", because they can easily override, disable or break other mods. Use the Edit change action for XTBL files instead!
<Edit> Tag
Edit
<Edit file="build/pc/cache/misc.vpp/weapons.xtbl" LIST_ACTION="COMBINE_BY_FIELD:Name,_Editor\Category"> <Weapon> <Name>edf_pistol</Name> <_Editor><Category>Entries:EDF</Category></_Editor> <Max_Rounds>9999</Max_Rounds> </Weapon> </Edit>

Edit is used to modify XTBL and ScriptX files (experimental ASM file support is included too). XTBL files usually contain thousands of different settings. Replacing the w hole file just to edit one of those settings is very blunt and ugly and also prevents two mods from editing the same file, as they wouldjust overwrite each other. With edits you can now define which setting you want to modify, WITHOUT touching all the other values. The "File" attribute defines the file you wish to modify.

The XML structure inside the Edit tag is the same as the XTBL file (without the outer <root> and <Table> tags since those are obvious). All content inside the Edit tags will be merged into the given file 1:1. Content of tags with the same name will be replaced with the new content.
Exceptions (LIST_ACTIONS)
The only exception for this rule are lists. List in XML are tags that have multiple children with identical names. In this case the ModManager cannot know how to merge them and you will have to give him a hint on how to behave. This is what the LIST_ACTION attribute is used for.
  • LIST_ACTION="ADD" will add the new children tags to the list, without touching the existing ones.
  • LIST_ACTION="REPLACE" will delete all existing tags in the list and replace them with the new ones.
  • LIST_ACTION="COMBINE_BY_FIELD:****" iterates through all children of the list in search for a child that has equal values. If such a child is found, the content of the tags will be merged. If no child with equal values is found, the tag
    will be added as a new one.
In most cases "COMBINE_BY_FIELD:name" will be used, to merge all children with the same "name" value. This may sound complicated at first, but you'll get used to it really fast. You can observe the use of _LIST_ACTION in all bundled mods.
Mod Package Formatting - Simplified
I am going to Copy-Paste this section from my other guide for the sake of simplicity. Follow these instructions when you are done with your mod.


Adding mods (Yay!)

Mods that use the Mod Manager format use a very easy to understand method for adding new mods. It goes like this:

Modder creates mod in ModInfo.xml
Modder creates folder named whatever he wants, and puts the ModInfo.xml in that folder
Modder Zips up the folder and releases it to the public.

All you need to do is extract the folder - Making sure theres a ModInfo.xml in the root folder after extraction, and throw the whole folder into your mods folder (Default is "C:\Program Files (x86)\Steam\steamapps\common\Red Faction Guerrilla\mods")!
Modder Tips! (Player Section)
If you have any tips or hints related to RFG Modding feel free to post in the comments!
The best will get posted here.

It helps to know a little bit about XML! - Sturm-Falke101
I was attempting to edit multiple files in the same ModInfo.XML and I screwed something up simply because I didn't understand how to nest things.

Code Annotation! - Sturm-Falke101
You can Annotate your code so others (Or even yourself) can understand confusing parts inside your XML file.

This one goes with the above tip, it helps to know a bit of XML!
<!-- Message Here Still an Annotation -->
OR
<!-- Behold! A message! -->
5 Comments
[skrrt] 1986 Toyota Corolla 20 May, 2016 @ 11:52am 
Where do you get mods and is there a mod that extends the amount of ammo you can carry but not your clip?
Sturm-Falke101  [author] 28 Mar, 2015 @ 7:19pm 
Look through misc.vpp, I don't remember if you can find the list in vehicles.xml or which folder has the list of vehicle class names. Be aware that I'm pretty sure the actual xml name doesn't line up with what the internal vehicle name is; open the file.
AsG_Alligator 28 Mar, 2015 @ 9:01am 
Do you happen to have a list of entity names for vehicles? I want to edit the Vehicle Selector mod to allow me to use those large 8-wheeled trucks, but I need the entity name for it.
Sturm-Falke101  [author] 27 Sep, 2014 @ 4:35pm 
What? The game should have save and loads by default.
Just play in offline mode on GFWL.
Fish Salad 23 Sep, 2014 @ 5:27pm 
Creator, Is there a mod that lets you save and load again?
Just asking.