How to modify Hearts of Iron Yourself

Hearts of Iron is amazingly modifiable, unfortunately a small mistake can result in CTDs (Crash To Desktop) or seriously unbalance or alter the course of the game. (Example: Albania builds ONE infantry division repels the Italian invasion and the entire Balkan campaign is significantly different).

Excellent source of modification information: Havard's HoI Hacking Haven

This guide will flow more or less from the easiest changes to the most difficult.

In order to find out the province number for a province use F12 (console) and type "showid" then when your mouse is pointed over a province in the lower right corner the province number will be indicated.

Military Leaders - these are stored in the \db\leaders directory. All files seem to be automatically read and included in the game. General convention is to name the file "country.csv". Reading the header plus some documentation from the message boards is more or less all you need to know to include or alter the ratings of your favorite leaders for any country.

Rank 0 Field Marshal can command 12 divisions
Rank 1 General can command 9 divisions
Rank 2 Lt. General can command 3 divisions
Rank 3 Major General can command 1 division

Ranks above 3 don't seem to harm the game but only allow command of one division.

Military Leader Skill Value - unknown how much actual game impact these have. General convention is that anything above 2 is a very good leader and no leaders will start with a skill above 5 (skill of five is reserved for the very best commanders).

Traits - add documentation for traits.

AI files - in the \ai directory you can create additional "ai" files for each country. These will not be used unless you include a line "ai = country.ai" in the appropriate country's country.inc file (in the \scenarios\year directory). Bolt's research indicates that altering the percentage mix for unit production adjusts the force mix the AI attempts to achieve (i.e. if you only specify 20% infantry units and already 37% of your units are infantry then no infantry will be produced). Research values (at the bottom) are not well understood. Although they can be specified with fractional values the save game file shows only integer values (thus fractions are ignored).

Raising the max_garrison_prop to 1.00 (100%) should prevent any troops from being sent as expeditionary forces.

When setting the relative research values use whole numbers only. Fractions are ignored.

Victory Points - these seem to have very little effect on the behavior of the AI. But to annex a nation you must conquer all victory points and to puppet a nation you must capture 75% of the VPs. Victory Points per province can be altered in \scenarios\year\vp.inc

Units - \db\units contains text files for each type of unit. The values and settings (as well as new unit models) can be adjusted inside these files. These are fairly straight forward. Note: the manpower values in these files seem to be doubled for actual in game production; movement rates of less than one are forced up to one in the game.

Build costs appear to be truncated down to an integer value (and can be adjusted by a minister effect). Build costs also influence the reinforcement cost and the reinforcement cost is influenced by fractional build cost amounts!

Note: Cavalry (probably all infantry types) do not actually use oil even if you set their fuel consumption above zero. Oil usage is 1/2 if units are not moving.

Transport weight appears to not be implemented. Apparently a unit with transport capability greater than zero can carry one division irregardless of the capacity of the transport or weight of the division.

Fractional movement speeds do work. A Cavalry division at speed 4.4 is ten percent faster than an Infantry division at 4.0.

OOB - the starting order of battle for each country is set in the \scenarios\year\country.inc file. This file also contains the starting provinces the country owns; the starting technologies the country knows; what province is that country's capitol; political alignment; starting resource pool; and can even include units in production.

Setting an initial organization level in the initial OOB does nothing.

Technology - technology can be altered in the files in \db\tech\. It's fairly straight forward to alter the cost or time to develop a particular technology, a bit more complex to alter the effect of the technology.

Scenarios - in the \scenarios directory and end in ".eug" Initial world market trades are also set in this file. Initial members of the alliances are set in this file. Wars (at start) are also set in this file.

Events - Events can be altered or added in the \db\events\ directory, you can name your file anything but it must be included in the \db\events\events.txt file (this file is included in the scenario.eug file).

To manually test fire an event use (F12 Console):

The trigger conditions for an event are logically AND'd together. Within a NOT however the conditions are logically OR'd together (before the NOT is applied). (in other words all conditions inside a NOT must be false for it to fire)

The "add_division" command now works (as of v1.06) in events:

  command = { type = add_division which = unittype when = province value = brigade}

Government Leaders - these can be altered in the \db\ministers\ministers_country.csv

Revolts - \db\revolt.txt - not understood

Modifiers

Attack, Defense and Movement modifiers can be adjusted by being set in the INC files or by techs. These are adjustments to the built in modifiers! For example attacking at night has a -50% modifier if any set night_attack modifier is zero. Defending at night is only -25%.