Hearts of Iron IV Basic Mod

by Justin Gao in Workshop > Tools

970 Views, 0 Favorites, 0 Comments

Hearts of Iron IV Basic Mod

capsule_616x353.jpg

For my final project for my Computer Science Class, I chose to create a mod for a game that me and my friends played quite often called Hearts of Iron IV. The game is essentially a real time grand strategy game centered around the events prior, during, and after World War II. Imagine Risk but far more complicated and strategic. Because the game is on the Steam Workshop and is relatively easy to mod, it has been heavily modified by many different people. Some mods introduce entirely new gameplay, new scenarios, new technologies, events, to name a few. My mod introduces an alternate history scenario where the Axis are at the doorsteps of America. Of course this is still work in progress as there is plenty of content that I have not added, but this is my progress so far.

Supplies

A working computer that can run the game

The game itself, it costs $40

Optional: The DLCs which add content to the base game and make it a lot more enjoyable

Creating the Mod Itself and the Folders

Screenshot (421).png
Screenshot (422).png

The first and most important step is to create the actual mod folder. To do this, open the game launcher, then go to mods --> mod tools. From there, give your mod a name and check any of the provided tags. Make sure to assign a directory for the folder so you can access it. You can also give a version, so put whatever you want there because it doesn't really matter.

Once your mod folder is created, go to Documents --> Paradox Interactive --> Hearts of Iron IV --> mod

Your mod folder should show up. Now, you'll need to enter your mod's folder and start creating folders. Inside these folders you may also need to create subfolders. For my mod I created the following folders and their subfolders:

common: bookmarks, countries, country_tags, defines, ideas

gfx: flags, interface, leaders

history: countries, states

interface: no folders needed here

localisation: no folders needed here

Another important step is to access the original game's files since we'll be copying and modifying some of the game files. To access these files, go to SteamLibrary-->Steamapps-->common-->Hearts of Iron IV

Once all of that is done, we can move on to finally begin modding

The Things I Have Done So Far

Screen Shot 2021-06-02 at 9.06.27 PM.png
Screen Shot 2021-06-02 at 9.07.38 PM.png
Screen Shot 2021-06-02 at 9.08.38 PM.png
Screen Shot 2021-06-02 at 9.09.03 PM.png
Screen Shot 2021-06-02 at 9.09.13 PM.png

This is the progress that I have made so far. As you can see, I have modified the game quite a lot, although it still bears some resemblance to the base game. Of course there are certain people out there who have completely overhauled the interface, but I am a beginner so I do not have that knowledge as of the moment. But these are the list of things I've done:

Created a new starting date and scenario

Changed leader portraits

Changed the borders of the countries

Changed the flags, names, and colors of the countries

Created custom national spirits with their own descriptions

How to Create a New Scenario Part 1

Screen Shot 2021-06-02 at 9.06.27 PM.png

A scenario in Hearts of Iron IV is a starting setup for the beginning of a new game. They contain all of the game start information, including country information, events, and other details. The two default scenarios in game are the Gathering Storm 1936 and Blitzkrieg 1939. For my mod I created a new scenario called The Final Stand which begins on January 1, 1945. To create a new scenario as I did here, you will need to do the following:

- Create the bookmarks folder under common. Then go to the base game and find the bookmark for 1936 or 1939. For my mod I used 1936.

- Create defines under common. Then copy a file called 00_defines.lua from the base game

- Create a localisation folder under the basic mod folder. Then go to the original game files and go to localisation and find a file called abilities_l_english.yml. Copy this over to your localization folder.

- Create a gfx folder --> interface, then go to the base game and take the graphic file for either the 1936 or 1939 scenario. I took the 1939 scenario for my mod, but it really does not matter which one you choose.

-Create an interface folder Under the base mod folder. Do not put this folder under GFX. These are two completely different folders. Then copy a file from the base game called aces.gfx and put it in the interface folder.

How to Create a New Scenario Part 2

Screen Shot 2021-06-02 at 10.00.15 PM.png
Screen Shot 2021-06-02 at 9.07.38 PM.png

The screenshot above shows the basic format for a bookmark, which is what we are using to create a new scenario. You can change the name, scenario tag, date, starting time, and the default country. You can also remove countries from the starting menu as I did with the Soviet Union. To do this you remove the country's entry in this bookmark file. I also uploaded the file above.

name = This will be the name for your new scenario. Put whatever you want

desc = The tag for the scenario. This will be useful for your localisation file, but we'll get into that later. Just make it whatever you want for now, but put it in all caps.

date = The date is formatted like this: YEAR.MONTH.DAY.TIME

picture = Picture associated with the bookmark. Ignore this for now, this will be useful later

default_country = Basically the country that the game selects by default when the user enters the scenario. Put the tag for the country that you want the game to select by default. For example, Germany would be GER

How to Create a New Scenario Part 3

Screen Shot 2021-06-02 at 10.21.03 PM.png
Screen Shot 2021-06-02 at 10.26.13 PM.png

Next we will need to go to the defines folder and edit 00_defines.lua. This file basically determines when the game will start and end. Normally the game runs from 1936-1948 so if your scenario is within that time frame then this can be left alone. However, for my scenario the game runs beyond the normal time frame so I changed the END_DATE to January 1, 1960 starting at 12:00. Everything else can be ignored for the sake of this tutorial.

The next step is to change the graphic file which we put under gfx --> interface. Change the name of the file to something similar to the name of your new scenario. Then open the file in some photo editing program and do whatever you want with it. I personally replaced the default file with a picture from the internet. After that is done, replace the file with your new picture. Make sure to export as a DDS file.

Now we need to go to the aces.gfx file under the interface folder NOT under the gfx folder. Here we need to get the game to recognize our newly created graphic file. Use the default template given in the file and shown below. Replace "gfx/aces/ace_m_0.dds" with the name of your graphic file. Since my graphic file was called "the_last_bastion_1945," I used that. Make sure to leave dds at the end. Also change the picture name "GFX_ace_m_0" to whatever you want. For my mod I changed it to "GFX_the_last_bastion"

spriteType = {
name = "GFX_ace_m_0"

texturefile = "gfx/aces/ace_m_0.dds" }

Now go back to the bookmark file under bookmark folder under common. Remember how I mentioned the picture tag would be useful? Now we're going to replace it with the picture name that we just created. So in my mod it was "GFX_the_last_bastion." With all these steps complete, the graphic file should now be working.

How to Create a New Scenario Part 4

Screen Shot 2021-06-02 at 10.47.30 PM.png

Finally we will give our scenario a custom description. To do this, go to localisation then open abilities_l_english.yml. Delete everything except for the first two lines. The second line is the template. Remember how we gave our bookmark a description tag back in part 2? Copy that over like this:

THE_LAST_BASTION:0 ""

The description for the scenario should be put in between the quotation marks. You can also give each nation a description. To do this, go back to the bookmark file and copy the nation bookmark description next to history. So for the USA, this would be "USA_GATHERING_STORM_DESC." Format it like this in the localisation file:

USA_GATHERING_STORM_DESC:0 ""

Your scenario should be completed now

Leader Graphics

Screen Shot 2021-06-02 at 10.52.52 PM.png
Screen Shot 2021-06-02 at 10.52.55 PM.png
Screen Shot 2021-06-02 at 10.52.58 PM.png
Screen Shot 2021-06-02 at 9.07.38 PM.png

Editing leader graphic files are fairly simple, it only requires some copy and pasting and the proper folders. Use the gfx folder you created earlier and create leaders. Then create a folder for each country who's leader you're editing. Use the country's tag. Go to the base game and get the leader files. Put them in their respective nations. Then open them in your photo editor and do whatever you want with them. Save and export as a DDS file.

How to Transfer States

Screen Shot 2021-06-02 at 9.08.38 PM.png
Screen Shot 2021-06-02 at 10.59.15 PM.png

In Hearts of Iron IV, each country is broken up into different states. These are usually the same states in real life. For example the United States is divided up into fifty states in the game as it is in real life. As you can see in the screenshot above, I did a lot of state transferring. To do this, you first want to go back to steam, right click on Hearts of Iron IV then go to properties and type -debug- under Launch Options. These will let you detect the ID assigned to each state and the game will also notify you of any errors. Then create the history folder under the mod folder, then create states. The states folder is used to store states. From there, copy over the states that you want from the base game into the states folder of your mod. Open a state file and change the owner by entering the new owner's tag. In my example here, I changed the owner of Corsica to Italy or ITA. You can also change the state into a core for another nation. A core is essentially an integral part of a nation, unlike something like an occupied state. In example, I made Corsica a core of Italy as well which gives Italy all of the resources, manpower, and industry Corsica has to offer.