Country creation

From Hearts of Iron 4 Wiki
Jump to: navigation, search

Quick check-list[edit]

  • Define a unique 3-character country tag
  • Create a file in /Hearts of Iron IV/common/countries
  • Create a file in /Hearts of Iron IV/history/countries
  • Add localisation
  • Add a large, medium and small flag for each ideology
  • Optional: Create a file in /Hearts of Iron IV/history/units
  • Optional: Add the country to the game

Country tag[edit]

Countries need a 3-character country tag. This is how a country is referred to in all of the game's script. All country tags must be unique. A country must not share a tag with any other country.

To create a tag, add a new file to /Hearts of Iron IV/common/country_tags (or edit an existing file) and add something like the following:

SCO	= "countries/Scotland.txt"

where

countries/Scotland.txt

is address of the country file that will be created/edited, located in /Hearts of Iron IV/common/

Country file[edit]

Create a new file in the /Hearts of Iron IV/common/countries folder. It is recommended one copies the file of a very similar country, then rename and edit it.

Graphical culture[edit]

Defines the set of graphics used for units. For Scotland this would be:

graphical_culture = commonwealth_gfx
graphical_culture_2d = commonwealth_2d

Color[edit]

This is the country's colour on the political map mode. It uses the RGB color scale.

color = { 2  10  222 }

colors.txt[edit]

Also, make sure that you add the country's color to /Hearts of Iron IV/common/countries/colors.txt:

TAG = {
  color = rgb { 219 219 119}
  color_ui = rgb { 255 255 155}
}

`color_ui` usually is a more intense version of the normal color. It is used to render the borders of the country (If borders look ugly, make sure you have done this right). Colors may also be specified in HSV format.

Country history[edit]

Create a file in the /Hearts of Iron IV/history/countries folder. Alternatively, copy, rename, and edit a similar file. The file name should be [country tag - country name], e.g. "SCO - Scotland". This file contains information about the history and various other default attributes of the country.

Order of Battle[edit]

This line will link to the 'Order of Battle' (OoB) file which will define the amount and location of units the country has at the start. All countries need an OoB link, but if the country is to be released one doesn't need to add one later on.

oob = "SCO_1936"

Research slots[edit]

Defines the amount of research slots a country has access to at the start. Normally, major powers have 4 slots, minor countries in North America and Europe have 3 and minor countries in the rest of the world have 2.

set_research_slots = 3

Technology[edit]

Here the technology a country has from the start is declared. A list of technologies can be found in /Hearts of Iron IV/common/technologies.

set_technology = {
	infantry_weapons = 1
	infantry_weapons1 = 1
	tech_support = 1		
	tech_recon = 1
	early_fighter = 1
	early_bomber = 1
	early_submarine = 1
	basic_destroyer = 1
	early_destroyer = 1
	early_light_cruiser = 1
	basic_light_cruiser = 1
	early_heavy_cruiser = 1
	transport = 1
}

Diplomacy[edit]

If the new country has any diplomatic relations, these can be declared here. It is recommended that one adds relations only in one file (not in both the faction leader's file and the minor ally's for instance).

Factions[edit]

Factions are defined by adding the following line:

create_faction = Clanintern

The country that belongs to the file this line is in will take the role of faction leader. Other countries may be added to the faction:

add_to_faction = IRE

Puppets of members should always be added to the faction as well, to prevent bugs.

Puppets[edit]

Puppets are defined as follows if the player has the 'Together for Victory' Expansion:

set_autonomy = {
	target = ENG
	autonomous_state = autonomy_integrated_puppet
}

and as follows if they don't:

puppet = ENG

In order to make the mod useable for both types of players an if-statement should be used:

if = {
	limit = {
		has_dlc = "Together for Victory"
	}
	set_autonomy = {
		target = ENG
		autonomous_state = autonomy_integrated_puppet
	}
	else = {
		puppet = ENG
	}
}

If the player has 'Together for Victory', Great Britain will be an integrated puppet, if not, they will be a regular (the only type of) puppet.

Tech sharing[edit]

If the player has 'Together for Victory' one can add the country to a tech sharing group:

add_to_tech_sharing_group = haggis_investigators

An if-statement as shown above will be required to limit it to 'Together for Victory' owners and to prevent bugs with those that don't own it.

Set Politics[edit]

Defines the popularity of different parties in the country:

set_politics = {
	parties = {
		democratic = { 
			popularity = 93
		}

		fascism = {
			popularity = 4
		}
		
		communism = {
			popularity = 3
		}
	}
}

Country Leaders[edit]

Defines the leaders a country has. In theory adding a leader for only the starting ideology would be enough, as the other ones will be randomly generated, it is possible however, to define the leaders of all parties.

create_country_leader = {
	name = "Ronald McDonald"
	desc = "POLITICS_RONALD_MCDONALD_DESC"
	picture = "gfx/leaders/Europe/Portrait_Europe_Generic_land_3.dds"
	expire = "1965.1.1"
	ideology = fascism_ideology
	traits = {
		scary_clown
	}
}

One can add a custom portrait by adding it in in DDS-format, which may require Gimp or Paint.net to edit.

A list of traits can be found in /Hearts of Iron IV/common/country_leader. It is possible to add more there as well.

Military leaders[edit]

Custom army leaders may be defined here:

create_corps_commander = {
	name = "Sean McHaggis"
	portrait_path = "gfx/leaders/Europe/Portrait_Europe_Generic_land_4.dds"
	traits = { panzer_leader fortress_buster }
	skill = 4
}

As well as naval leaders:

create_navy_leader = {
	name = "James McSeafarer"
	portrait_path = "gfx/leaders/Europe/Portrait_Europe_Generic_navy_1.dds"
	traits = { blockade_runner superior_tactician }
	skill = 4
}

Variants[edit]

Special variants on equipment available for this country from the start can be defined as well:

create_equipment_variant = {
	name = "Haggis Class"
	type = submarine_1
	upgrades = {
		sub_engine_upgrade = 3
		sub_stealth_upgrade = 2
		sub_torpedo_upgrade = 2
	}
}

Localisation[edit]

Add the localisation for your new country to the following file

/Hearts of Iron IV/localisation/countries_l_<language>.yml

where <language> can be either English, German, Spanish, French, Polish, Russian or Brazilian Portuguese. A file can be created for each language for better coverage across the supported languages.

Define the localisation for the country's name and its adjective as follows for every ideology:

SCO_communism: "People's Republic of Scotland"
SCO_communism_DEF: "The People's Republic of Scotland" #For events
SCO_ADJ: "Scottish"

Flag[edit]

Each country need 12 flags: 4 flags, 1 for each ideology, including non-aligned, and 3 sizes for each: Standard, Medium, Small. Each flag needs to be a TGA-file with the name of the country tag and the ideology the flag is meant for.

Size-requirement
Standard 82x52 pixel
Medium 41x26 pixel
Small 10x7 pixel

All flags are located in /Hearts of Iron IV/gfx/flags.

Order of Battle (optional)[edit]

If the country will exist at the start, an order of battle is necessary for the country to have an army. Create a new file in /Hearts of Iron IV/history/units or copy one from a similar country. It should be named exactly the way it's linked in the country's history file.

Division Template[edit]

First the default division template will be defined, simply set up what regiments will fill the country's divisions:

division_template = {
	name = "Blueskirt Division"

	regiments = {
		infantry = { x = 0 y = 0 }
		infantry = { x = 0 y = 1 }
		infantry = { x = 0 y = 2 }
		infantry = { x = 1 y = 0 }
		infantry = { x = 1 y = 1 }
		infantry = { x = 1 y = 2 }
		infantry = { x = 2 y = 0 }
		infantry = { x = 2 y = 1 }
		infantry = { x = 2 y = 2 }
		infantry = { x = 3 y = 0 }
		infantry = { x = 3 y = 1 }
	}
}

As can be seen, this division exists solely out of infantry.

Division Placement[edit]

Division can be placed as follows:

units = {
	division= {	
		name = "1st Blueskirt Division"
		location = 9392 # Edinburgh
		division_template = "Blueskirt Division"
		start_experience_factor = 0.2
		start_equipment_factor = 0.3

	}
}

The name is simply the name the game shows for the division, the location is where the division is on the map, the template links to the template defined above and start_experience_ and _equipment_factors define how much experience and equipment the division has.

Adding the country to the game[edit]

There are three ways to implement the new country into the game.

  • Using events
  • By national focus
  • Editing state history

Adding countries by event or national focus[edit]

Main article: Event Modding

There are multiple ways to add a country's presence by event or national focus. Here are two:

set_state_owner = 119

Using this script in an event option or national focus reward, when scoped to the new country, will cause the province to be owned by the new country. If it is occupied by a third power and the new country is at war with them however, the region will remain occupied.

transfer_state = 119

This script will change both the ownership and control to the scoped state. If a third country occupies it it will go to the new country regardless of the state of relations between it and the occupying power.

Adding countries with state history[edit]

Change the owner and cores in province history files so that they include the new country either by default or in defined bookmarks (for instance only in 1939)

Modding
Documentation EffectsTriggersModifiersScopesLocalisation
Scripting AIBookmarksBuildingsCosmetic tagsCountriesDivisionsDecisionsEquipmentEventsIdeasIdeologiesNational FocusesResourcesTechnologyUnits
Map MapTerrainStatesSupply areasStrategic regions
Graphical InterfaceGraphical Assets
Cosmetic PortraitsNamelistsMusicSound
Other Console commandsTroubleshootingMod structure