Creating a .mod file
In this tutorial I will try to learn you how to get started on your mod file. It is recommended that you copy an existing .mod file and wipe it clean to begin this tutorial. First we will be talking about what a mod file is, then we will show you step by step how to fill it in and in what order, and then we will show you the full file that we created together. Mind that "Example Mod" is just a standart term used in this tutorial to indicate that you can type the name of your own mod here.
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 even make a total conversion mod with it, 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 all it really does is replace the 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 :
extend = "common"
There is also a second line, this one is used for when you want to replace an entire folder. It is especially useful for the events or decisions folder for when you want total custom decisions. This is how you should write this line of code :
replace_path = "events"
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 recommend 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" extend = "common" replace_path = "events" user_dir = "Example_Mod"