Hearts of Iron IV

Hearts of Iron IV

29 ratings
How To Make A Custom Country!
By AnorakRaven
A guide on making your own custom nation, from the very basics to the more advanced areas.
   
Award
Favorite
Favorited
Unfavorite
Intro
Welcome! This is going to be the first of (hopefully) many guides in regards to HoI4 and its modding flexibility. Below you will see multiple different images and links based off of the guides I have seen in the past as well as the info needed to make a custom nation and most of its constituent parts. Before doing so, I'd HIGHLY recommend reading up on my beginner's guide here. This'll set you up with the tools needed and prepare you mentally beforehand. Ya ready? Lets go!
Syntax and Variables
This is an index/collection of links focused on the commands, flags, and/or variables you will utilize when making a custom nation. I'd recommend reading through this when needed as well as looking into the unmodded game's files to see what the starter countries look like. Information for this section was ripped right out of the HOI4 Wiki's Country creation[hoi4.paradoxwikis.com] page.

<yourmod>/common/countries/<countryname>.txt

graphical_culture = Defines the set of graphics (models/textures) used for army units, for Albania this would look like:

graphical_culture = eastern_european_gfx
graphical_culture_2d = eastern_european_2d

color = Defines the color that shades the territories owned/occupied by your country. Can be defined with RGB or HSV values (just use RGB though, honestly...)

<yourmod>/common/countries/colors.txt

Country Tag = The country tag is a 3-character tag used by Hearts of Iron 4's engine internally when referencing a specific country, for Albania, the tag would be ALB.

color_ui = normally a more intense version of the color = values defines above, I've experimented with this and honestly it either does nothing or totally breaks the game so I just set it to the same value as color =.

<yourmod>/history/countries/<TAG - Country Name.txt>

capital = defines the location of the country's capital via a State ID, in-game, the regions that are given names (e.g the American states for example) are states, with provinces being the much smaller areas that make up individual states. You can hover over a state in-game while in debug-mode in order to read off all information including state ID. (Or, if you installed Visual Studio Code and the extensions I recommended, you can go into that, press CTRL+SHIFT+P, and type out "Preview" before clicking the preview world map option, allowing you to view the in-game map and all its debug info without having to launch! Seen below.)


oob = stands for Order of Battle, this is syntax telling the game to call the respective oob file (which can be found in history/units/<TAG_YEAR.txt>) for that nation (and depending on the amount of action the country sees: the oob for a specific YEAR.) oob files are usually split based on whether or not they're land or naval units (defined as <TAG_YEAR_naval.txt>,) naval units are also split up by whether or not a player owns DLC, with those who do own it using <TAG_YEAR_naval_mtg.txt> and those who don't using <TAG_YEAR_naval_legacy.txt> files.

set_research_slots = does what it says on the tin, major countries (U.S, France, Britain, Germany, etc.) will start with 4, minor countries in North America & Europe will have 3, and minor countries everywhere else will start with 2, not every country has this tag within their files, not having it there means that the country will default to 2 as standard.
set_stability = allows you to define the country's starting stability as a decimal-based percentage (0.7 meaning 70% stability in CAN (Canada)'s case. This is multiplied by 100 to get the in-game number.
set_war_support = same as stability, but for war support.

set_technology = is used for when you wish to have a country start off with certain pre-existing technologies (which can be found in the common/technologies folder,) omitting this means your country will simply start with nothing in the tech tree completed at all. You WILL have to set the technologies for ships twice if you add in naval techs in order to create a version with MTG support and one for legacy/non-DLC owners.

add_ideas = is used to add in things such as national ideas, spirits, or military/political advisers.

Misc.[hoi4.paradoxwikis.com]

set_autonomy = is a DLC-based command (Together For Victory) which sets the level of autonomy/independence a subject state has towards the host nation you are currently editing. These levels can be seen here.[hoi4.paradoxwikis.com] You can also view other diplomatic actions such as trades, non-aggression pacts, and guarantees of independence here.[hoi4.paradoxwikis.com] The link also shows the remaining information in regards to custom country creation.
File & Folder Structure|Root Directory
Before we start we have to recreate the file & folder structure seen within the vanilla game's unmodified files, these can be found within \Program Files (x86)\Steam\steamapps\common\Hearts of Iron IV.

Your mod folder should look like this, EXE/Example files are examples with the proper syntax applied to them, any files without them are files which should be copied over from the base-game's folders into your mods folders.

Your root folder should have 4 folders in it alongside the descriptor.mod file you get from mod creation like the original guide said.

  • common is the folder which contains all the information needed for the game to function as well as the redirects and scripts needed for it. Think of it like the game's skeleton and nervous system combined into one.
  • gfx (shortened from Graphics) is the games textures and models, stuff like flags, the textures of the different territories, political & military leaders, etc, all go in here. Utilizing either DDS or TGA image formats.
  • history contains the information needed for things such as what territories a nation owns/claims, their pre-existing units, their research techs, focus trees, etc. These utilize txt file formats in UTF-8 character encoding.
  • localisation is the localisation the game utilizes, things such as tooltips, unit names, the country names on the map, etc, utilize this file to define what appears. These are often split up based upon what they cover (construction, countries, etc,) then further based upon what language they're in.
File & Folder Structure|common

  • countries contains the colors.txt and <countryname>.txt files utilized for defining the graphical culture of a nation as well as their color on the political map in-game. The graphical culture has many different variations ranging from Asian to Middle Eastern to African and define what the ethnicity of the randomly generated leader portraits appear as. Examples below.

  • country_tags tells the game what country tag is connected to what country (alongside pointing it to the countries folder and the corresponding file.)
File & Folder Structure|gfx

  • flags contains the image files needed for your country, in the base game, these are split up into the flags folder itself as well as two subfolders, small, and medium. Each folder contains 4 different variations of a countries flag, these variations are defined by the countries flag when influenced by a respective ideology (in the base game, these are defined as communist, democratic, fascist, and non-aligned. If you wish for the flag to be static however, you can just name the file TAG.tga and it will appear if there're no other options.) These flag files must be in the .tga image format, with the file itself having RLA Compression disabled in 32-bit color depth with bottom-up (or as GIMP puts it bottom-left) orientation. The first two are necessary for the flag to even appear, the last is needed so it doesn't appear upside-down in-game (THE WONDERS OF TECHNOLOGY!) Standard files must be 82x52 pixels in scale/size, medium-sized files are 41x26 pixels, and small files are 10x7 pixels.
  • leaders contains the leader portraits necessary for custom leaders to appear, with subfolders named by the country-tag of the leader's respective country, these are in the DDS image format with a resolution of 156x210 pixels. With their naming syntax being portrait_<countryname OR TAG>_firstname_lastname.dds. Examples below.
File & Folder Structure|history

  • countries contains the country txts which are used to organize a nation's capital, the order of battle, what technologies they have pre-researched, etc. It also organizes what focus tree they use.

  • states contains the state files relevant to your nation(s,) these could be states they have claims on, cores on, states with modified terrain or resource values, etc.

  • units (also known as order/orders of battle or O.O.B) contains the files which set-up the pre-existing armies & units you assign at the start of the game. You can read more about how this works here.[hoi4.paradoxwikis.com]
File & Folder Structure|localisation

  • localisation contains all the different names for each country, including the four ideologies as well as special variations. It also includes definitive variants of their names (the German Reich vs. German Reich) as well as adjectives for each nation (American, German, etc.)
Making Your Nation|Step 1|Colors & Tag Creation
Final Tips
I cannot reinforce this enough: COPY OVER FILES FROM A PRE-EXISTING NATION if you're just starting off in modding. While you certainly can write from a blank file, it makes things far far easier for fresh modders like you or I.

Step 1|Colors & Tag Creation

Copy over the colors.txt file and pull a country file from common/countries in the base-game files, then put them into your mod, rename the country file to the name of the nation you wanted to add in the game. In my case, it'll be Vierreich. I'll pull Germany's country file for it since they both share similar geographic positions on the map. The colors are adjusted via RGB or HSV values (you can decide which to use in colors.txt) which you can pull off of color pickers online or one of the image editors I recommended in the previous guide.



The colors in the above image are Germany's original color values, I'll set them to a flat 100 each for this example. Moving onto colors.txt, you can copy one of the base-game color fields already present and past it at the very bottom of the file, then just adjust the color values as well as change the tag. For country tags I'd recommend the first letter of the nation's name, then the middle letter, then the last one. Its good for consistency but you need to make sure the tag isn't already taken up by a nation present in-game, you can do that by hitting CTRL-F and putting in the tag you wish to use to check if it has already shown up in the files. I'm unaware as to what color-ui does so just paste in the same values which you had in the first color field. In this example below, I made the tag for the Vierreich VRH.


With that done, you now need to go to the 00_countries.txt file you copied over from the base game and open it up, add in your country the same way all the others are added in.



Making Your Nation|Step 2|History Files, Ideology, & Leader
Either copy over a file from the base-game's /history/countries folder, or make your own with the naming syntax of TAG - <countryname> in this example. I copied over Mongolia's country file, then renamed it to be Vierreich's file.



In order to figure out the capital's location, open up HOI 4 using the debug/dev launcher I showed you how to make in the previous guide, then click on nudge. Then in the top-right, click states.

Now, look over the map and look for a specific state ID. Provinces get highlighted with a golden border which pulses, while states are the larger brass/bronze color. In this example, I will change their capital to that of Thuringen by hovering over Thuringen's area and noting the tooltip which pops up, this tooltip contains all the information you could ever need state-wise, the state ID is at the top of the tooltip, in Thuringen's case, the ID is 60. So I change the ID in the countries' file from 330 to 60. I'll also change their order of battle from Mongolia's 1936 variant to Germany's 1936 variant.


Further down, you will also notice the set_politics bracket twice, once with no brackets surrounding it, and again right below with a date bracket surrounding it, this is for the bookmarks you choose before selecting a country (in base game this is The Gathering Storm in 1936 and Blitzkrieg in 1939.) You will also see a set_popularities field. Feel free to change this all to whatever you please, however the popularities you set in set_popularities MUST add up to 100 even or else it will break.



Beneath that, you will see the Leader field. Often times these country leader fields have a name and then something like "POLITICS_JOHN_DOE_DESC", this is the file redirecting the game to a unique text string somewhere else in the game's directory, this can be replaced with a different redirect or you can just type out your description there outright. In this example, I'll use a portrait from vanilla with the file renamed as a placeholder. While in my example above it has a redirect, you can just replace it with the file-name in quotes like I do so below or put in "gfx/leaders/TAG/leadername.dds" with quotes (keep in mind its case sensitive.) Its also important to note that the leader MUST have a matching ideology with the political system the country is using (Communist country needs Marxism, Democratic is Liberalism, etc)

Making Your Nation|Step 3|Flags, Localisation, & States
Flags: The Lazy Way
Because I'm lazy I just use the flag converter I linked in the previous guide. This is what the converter looks like when filled out.
Real talk its probably better to resize them down to the standard/large size I linked above in order to avoid any scaling or positioning issues like the ones you see in the screencap but its 5:22 A.M here in Tampa Bay, Florida and I've been working on this guide since 12 AM so SCREW IT!
Localisation
Simply open up the localisation file you copied over into your mods folder from the main game and copy the GER strings you see at the top. Rename the tags to your own country tag and rename the strings within the quotation to whatever you wish.

States
To figure out which states you want your country to use, you will have to go into HOI4 in dev mode, figure out which states you want them to have cores/claims on, then copy them over from the base-game into you mod and edit the country tags inside of them. Simply change the tag in the ADD_CORE_OF = to make it a core, and change it to be the owner in owner = if you want it to be a currently conquered territory of the nation. A GREAT and really quick way to do this is to open up the nudger, click on the states you want, and click open in the bottom left, using Notepad++ or Visual Studio Code allows you to open multiple state files and edit their owners all at once via finding the original country tags replacing them with your own countries tags using CTRL + Shift + H. Then just click on update, then save, and go to your Paradox Interactive/HOI 4 directory, you will see a brand new history and localisation folder, simply cut and paste that into your mod directory and BOOM!
Done!
5 Comments
Szikla Mar 25 @ 8:59am 
Nice tutorial and I followed these steps with a youtuber whom created a tutorial how to make these things. My only problem when I tried to create my country from scratch the country name works, the flags luckily appears normally but the leader portraits not works as intended also my country leader, officers etc all are using english names instead of asian (My mod is to create a Tungic republic) using Chita as capital which is the Far Eastern Republic capital but I wanted to make it a standalone country from them. Partly works but need some help to fix it.

The other nations what I "created" are existing ones but not playable like Buryatia, Karelian Republic. These works normally (still needs to expand) but I want to make a totally new country to play with.

Thanks in advance.
FireGamer02 Sep 16, 2022 @ 2:17am 
one question i made a own country everything is good then i made my second country. I wanted to test it but only my first country show up what so what should I do now?
RustyNail Sep 4, 2022 @ 10:10am 
Quick question, what about focuses?
Eternal Anglo Feb 20, 2022 @ 6:35pm 
Really great guide. Do you know how to edit the existing Reichskommissariats? (i.e. add portraits for their leaders) I can only find parts of their file & folder structure dotted around.
atari Jun 25, 2021 @ 2:24am 
How would you change the land owned in a different bookmark? so in 1936 x land is owned and 1939 x and z land is owned.