Idea modding

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

Quick check-list[edit | edit source]

  • Create a file in /Hearts of Iron IV/common/ideas
  • Add localisation

Categories[edit | edit source]

Ideas fall into one of three main categories, National Spirits, Designers, and Ministers, with each generally fulfilling a different kind of role.

You may also add your own categories by adding a custom file in your mod's common/idea_tags folder.

All categories will be contained in the 'idea_categories' top element and will contain :

  • Up to 6 slots; each slot will contain an idea
  • A default cost for ideas that don't have one specified in their definition.
  • A default removal cost for ideas that don't have one specified in their definition.
  • A ledger for the intelligence system to put it in that category. army, navy, air, and civilian will be put into respective categories, hidden will make it not require intelligence, while invalid will require specification for each idea in that category individually.

A sample below

idea_categories = {
    $category = {
        slot = $slot
        cost = 30
        removal_cost = 10
        ledger = hidden

The category will then be used by the idea via the slot (which allows mapping an idea to a category)
The file also includes slot_ledgers, which distributes idea slots to intelligence ledgers individually, which will take priority over the idea category's ledger. An example of it being used is

slot_ledgers = {
	XXX_idea_slot = civilian
	ZZZ_idea_slot = invalid

Invalid will require specification in each idea individually.

Some arguments which can be placed inside the category in the /Hearts of Iron IV/common/ideas/*.txt file are:

  • designer is used to mark the category as a designer for the AI.
  • law is used to mark the category as a law for the AI.
  • use_list_view is used to make the idea selection screen for that category use a list selection instead of a standard table.
ideas = {
	$slot = { 
		law = yes
		use_list_view = yes
		$idea = {
			picture = $picture
			traits = { $trait }

GFX and GUI[edit | edit source]

Each idea category represents a row in the country politics view, while each slot represents a slot under that row. By default, there can be at most 6 slots before it starts getting cropped by the right boundary of the politics view menu, but that can be changed by reducing the size of a slot in the ideas_grid gridbox in the country_politics_idea_category_entry containerWindow inside the /Hearts of Iron IV/interface/countrypoliticsview.gui file. More information on GUI files can be seen in the Interface modding article.
The idea category's icon, shown on the left of the category's row, is decided by the GFX_idea_categories sprite. The sprite is split into multiple frames horizontally, and each category is assigned a part of it depending on its order defined in /Hearts of Iron IV/common/idea_tags/*.txt. The sprite is defined in /Hearts of Iron IV/interface/countrypoliticsview.gfx and its definition in the base game consists of the following:

	spriteType = {
		name = "GFX_idea_categories"
		texturefile = "gfx/interface/"
		noOfFrames = 6

When adding a new category, make sure to update the sprite and the amount of frames accordingly.

An icon can be defined for idea slots, which will be used for them if there is no idea assigned to that slot. This is done in /Hearts of Iron IV/interface/*.gfx and a definition, taking XXX_idea_slot as an example, is done the following way:

	spriteType = {
		name = "GFX_idea_slot_XXX_idea_slot"
		textureFile = "gfx/interface/<file name>"

Make sure that the name of the sprite begins with GFX_idea_slot_.

Hidden Ideas[edit | edit source]

Hidden ideas are a special kind of national spirit that can be used if you wish to give a country a hidden modifier. For example if you wished to secretly reduce a country's recruitable pop because of an unforseen consequence, you could do this (under the country = { } brackets):

hidden_ideas = {
      XXX_hidden_problem = {
           modifier = {
                conscription = -0.01 # Reduces recruitable manpower by 1%

Arguments[edit | edit source]

  • allowed determines whether or not a country gets this idea or not. It is only checked at the game's start and never again. It's especially important for ministers and designers since not putting an allowed will mean that every country in the game will have access to that designer or minister. For most ministers and designers, original_tag = XXX is generally enough, since you want a country (and possible rebellions) to have access to that minister or designer. add_ideas ignores this check, so it does nothing in spirits or hidden ideas.
  • allowed_civil_war is a variant of allowed that determines if an idea will be transferred to a rebelling country during a civil war. Most of the time it's used for ideology checks to ensure only one side has that idea in a civil war.
  • available decides if a country can select it. If a country does not meet the requirements, then it will not be able to select it, and it will be automatically removed if the country already has it.
  • visible decides when an idea is visible and can be picked.
  • cancel will automatically remove the idea if the conditions inside are met.
  • picture decides the picture used by the idea. The picture is defined in /Hearts of Iron IV/interface/*.gfx. An example definition looks like this:
spriteType = {
	name = "GFX_idea_<picture name>"
	textureFile = "gfx/interface/ideas/<file name>.dds"

Note that file name and the sprite's name do not need to match. This sprite is used in the idea as picture = <picture name>. Note that GFX_idea_ is automatically inserted by the game and shouldn't be used in the picture argument

It is also possible to make the picture used to depend on the graphical_culture_2d of the country, defined in /Hearts of Iron IV/common/countries/*.txt. Such a definition looks like:

spriteType = {
	name = "GFX_idea_<picture name>_<graphical culture's name>"
	textureFile = "gfx/interface/ideas/<file name>.dds"

If a picture is not specified, the game will set GFX_idea_<idea name> to be used by default.

  • ledger is used to assign ideas to the intelligence ledger. It is necessary to be used in ideas that are defined in categories that have the 'invalid' ledger defined, which are 'theorist' and 'high_command' in the base game. If the idea slot has a ledger defined, the idea's individual ledger will take priority. Options include army, navy, air, civilian, and hidden.
  • modifier assigns the modifiers to the country that has them. Modifiers are listed one after another in a modifier's bracket. The list of modifiers can be seen on the modifiers page. Here's an example of an idea that would increase a country's Recruitable Population as well as lowering its factory output:
  • targeted_modifier is similar to normal modifiers, but they are targeted towards a specific tag. The list of targeted modifiers can be seen in this page. tag = TAG is used to let the game know towards whom the modifier is targeted. Note that regular modifiers cannot go into this section, they will not apply to that country.
  • equipment_bonus assigns a modifier to the specified equipment category.

If instant = yes is added to the idea, the modifiers will be applied instantly. Otherwise, they will only be added to equipment researched while the idea was active.
List of equipment can be seen in /Hearts of Iron IV/common/units/equipment/*.txt

  • research_bonus assigns research bonuses to the specified technology categories.

Note that positives make technology faster to research while negatives make it slower.

  • rule assigns the game rules changed to the country by that idea.

Allowed game rules are can_be_called_to_war, can_boost_other_ideologies, can_create_factions, can_declare_war_on_same_ideology, can_declare_war_without_wargoal_when_in_war, can_decline_call_to_war, can_force_government, can_generate_female_aces, can_guarantee_other_ideologies, can_join_factions, can_join_factions_not_allowed_diplomacy, can_join_opposite_factions, can_lower_tension, can_not_declare_war, can_occupy_non_war, can_only_justify_war_on_threat_country, can_use_kamikaze_pilots, and units_deployed_to_overlord (for subjects).

  • traits assign a trait to an idea. They will show up when hovering over the idea and they will apply the effects. If one is defined in the trait, it determines the picture shown on the paper. Traits are stored in /Hearts of Iron IV/common/country_leader/*.txt
  • on_add assigns effect to be executed when adding the idea. Note that they will be executed each time you add the idea, not just once. A flag can be used to keep track of that. An example can be seen in the 'Full idea example' section of the article.
  • on_remove is applied similarly to on_add, however, it's executed when the idea is removed instead.
  • cost is the cost in political power to add the idea. If not specified, assumed to be 150 political power.
  • removal_cost is the cost in political power to remove the idea. It is rarely used.
  • ai_will_do is the weight of the idea used when AI has to pick an idea. More info can be seen in the AI modding article.
  • name assigns the idea's name to use a different localisation key. This can be useful if you plan to modify an idea by swapping it multiple times to not create a localisation entry for each one of them.

Localisation[edit | edit source]

Localisation for ideas is defined in /Hearts of Iron IV/localisation/*_l_<language>.yml. If an idea does not have a name, the game uses the country's name-list in /Hearts of Iron IV/common/names to create a random name. This, however, does not apply to spirits and hidden ideas. An idea can have both a name and a description that appears when hovering over it. Their localisation entries are defined as such, taking ZZZ_example_idea as an example:

ZZZ_example_idea:0 "Idea's name"
ZZZ_example_idea_desc:0 "Idea's description"

Note that if the idea has a name argument inside, the specified localisation key will take priority over the idea's name.

Full Idea Example[edit | edit source]

An example of an idea that uses as many things as possible:

XXX_example_idea = {
	ledger = army

	picture = generic_coastal_navy
	cost = 200
	removal_cost = 1000
	available = {
		has_government = fascism
	cancel = {
		has_idea = ZZZ_other_example_idea
	visible = {
		NOT = {
			has_idea = ZZZ_other_example_idea
	allowed = {
		has_war = yes
	allowed_civil_war = {
		always = yes
	on_add = {
		if = {
			limit = {
				NOT = {
					has_country_flag = chosen_idea
			modify_building_resources = {
				building = synthetic_refinery
				resource = rubber
				amount = 2
			set_country_flag = chosen_idea
	on_remove = {
		if = {
			limit = {
				NOT = {
					has_country_flag = removed_idea
			add_manpower = 1000
			set_country_flag = removed_idea
	modifier = {
		license_armor_purchase_cost = -0.5
	targeted_modifier = {
		tag = GER						# Targets Germany
		cic_to_target_factor = 0.1
		mic_to_target_factor = 0.1
	research_bonus = {
		land_doctrine = -0.05
	equipment_bonus = {
		capital_ship = {
			attack = 0.1
		screen_ship = {
			instant = yes
			sub_detection = 0.1
		infantry_equipment = {
			instant = yes
			build_cost_ic = -0.1
	rule = {
		can_join_opposite_factions = no
		can_create_factions = yes
	traits = { fascist_demagogue }
	ai_will_do = {
		factor = 1
	name = XXX_localisation_key

Implementing An Idea[edit | edit source]

Ideas can be added to a country in different ways, depending on the type of idea and the intent behind adding it. Ministers and designers will be added automatically based upon their "allowed" area.
The add_ideas = idea_name effect is used to manually assign an idea to the country via code. remove_ideas = idea_name, similarly, removes it.
In order to swap ideas, which will show the difference between the 2 ideas, the swap_ideas is used as such:

swap_ideas = {
	add_idea = new_idea
	remove_idea = old_idea

Note that if the localisation entries for both ideas are the same, it will say that it modifies the idea rather than changing it to a different one.