Creating a .mod file

From Hearts of Iron 3 Wiki
Revision as of 14:16, 29 August 2016 by Joepiepoepie5 (talk | contribs) (Structuring the file)
Jump to navigation Jump to search

What is a .mod file?

A .mod file is a file that tells the game where to find your mod. You can edit the file so that it partly replaces the vanilla game or entirely, further on in this tutorial we'll explain how to create this file and how to structure it.

Say, you created a new country and you want to implement it into the game, you first have to structure your .mod file and tell the game where to find it. You do this by kind of giving commands to the game via the .mod file. That's all it really does, tell your game where to find your country. We'll explain how to do this in the next segment.

Structuring the file

You have made your mod, and now you want to make the game run it. You first have to give the name of your mod, the name that is in the lower left corner of the screen whenever you play a mod. Here is how you do it :

name = "Example Mod"

Now that is the first line of your file. now we have to tell the game where your mod folder is, here's how it's done :

path = "tfh/mod/Example_Mod"

The above line tells your game where to find your mod files, so far so good right? Ok so now we have to tell the game exactly what folders to replace with your modded folders. This may be a bit confusing, but the next line doesn't really "replace" the whole folder, it only replaces files that are in the modded folder. So, say, you have a new countries.txt in your common folder, you just write this line and the rest of the files that should be in that folder that are missing will be filled by the vanilla files. Here's how to write it :

replace_path = "common"

Simple right? And you can do this with every folder the game uses, such as history, or the map folder. We're not done just yet, there is one more thing to do, telling the game where to keep your savegames and setup/error log files. The folder where this is saved is called a user directory, often shortened as user_dir. This should be the last line in your file, and here is how to do it :

user_dir = "Example_Mod"

And that is really all there is to it. I do however recomend that you use a .mod file from another mod because if you want to create this from scratch it's a bit more work and may confuse you even more, and when you copied the .mod file from your other mod, you can clear it, and replace the lines inside with your own lines.

The full file

Now that we've created the file, here is how it should look like if you did everything like the above tutorial :

name = "Example Mod" path = "tfh/mod/Example_Mod"

replace_path = "common"

user_dir = "Example_Mod"