Effect

From Hearts of Iron 4 Wiki
(Redirected from Commands)
Jump to navigation Jump to search

Effects (also known as Commands) are used in order to affect the game dynamically from within a specific scope.

Effects are used throughout the game in numerous scopes, most commonly National focuses, Events and Decisions.

Note that certain effects may take a value from a variable, i.e. add_manpower = var:my_var This is noted by <variable> in an effect's parameters. See Variables for information on the variable effects.

The list of effects may be outdated. A complete, but unsorted, list of effects can be found in /Hearts of Iron IV/documentation/effects_documentation.html or /Hearts of Iron IV/documentation/effects_documentation.md.

New Battle for the Bosphorus Effects

Name Parameters Examples Description Notes Version Added
add_victory_points Add victory points to a province
add_victory_points = {
	province = 1234
	value = 10
}
Adds victory points to a province. Accepts negative values 1.10
set_victory_points Set the victory points of a province
set_victory_points = {
	province = 1234
	value = 10
}
Sets the number of victory point in a province. Accepts negative values 1.10

Any Scope

Can be used in country, state or unit leader scopes.

General

Name Parameters Examples Description Notes Version Added
set_global_flag <flag>
An unique string to identify the global flag with.
set_global_flag = my_flag
Defines a global flag. 1.0
play_song <song title from .asset>
A music file located in the music folder and .asset
play_song = "general_peace_1"
Plays an audio track The song must be defined in a music station in order to work. More information can be found in the Music modding page. If you wish to simply play a sound, the sound_effect effect should be used instead. 1.9.3
clr_global_flag <flag>
The unique string of a global flag to clear.
clr_global_flag = my_flag
Clears a defined global flag. 1.0
modify_global_flag flag = <flag>
The global flag to modify.

value = <value>
The value to set it to: 0 or 1

modify_global_flag = {
    flag = my_flag
    value = 1
}
Modifies a global flag. Use variables instead. 1.0
custom_effect_tooltip <string>
A localized string to display in the tooltip.
custom_effect_tooltip = my_tooltip_tt
Displays a localized key in the effect tooltip. 1.0
log <string>
An string to in the game.log
log = "myVariable: [?myVariable]"
Displays a string in the game.log when executed. Accepts all localization commands (i.e. [Root.GetName], etc) 1.5
save_event_target_as <string>
An unique string to identify the event target with.
capital_scope = {
    save_event_target_as = my_state
}
Saves the current scope as a key. Is cleared once execution ends (i.e. end of event). Use event_target:<key> to access the scope.
Do not use in Scripted GUIs.
1.0
save_global_event_target_as <string>
An unique string to identify the global event target with.
random_other_country = {
    save_global_event_target_as = my_country
}
Saves the current scope as a key. Persists after execution until cleared via effect. Use event_target:<key> to access the scope.
Do not use in Scripted GUIs.
1.0
clear_global_event_target <string>
The unique string of the global event target to clear.
clear_global_event_target = my_country
Clears a specific global event target. 1.0
clear_global_event_targets yes
Boolean.
clear_global_event_targets = yes
Clears all global event targets. 1.0
break None
break = yes
Stops execution of effects in the current scope. 1.0
sound_effect <string>
A sound reference from an .asset file.
sound_effect = "boom"
Plays the specified sound once. The sound effect must be properly defined in /Hearts of Iron IV/sound/ More info can be found in the Sound modding article. 1.0
randomize_weather <int>
A seed integer.
randomize_weather = 12345
Randomizes the weather with the specified seed. 1.0
set_province_name id = <id>
The id of the province to be changed.

name = <string>
The name to change the province to.

set_province_name = {
    id = 325
    name = LOC_KEY
}
Changes the specified province's name to the specified name. Localisation keys are to be defined in /Hearts of Iron IV/localisation/*_l_<language>.yml 1.3
reset_province_name <id>
The id of the province to reset.
reset_province_name = 325
Resets the specified province's name. 1.3
goto_province <id>
The id of the province go to.
goto_province = 325
Moves the camera position over the specified province. 1.0
goto_state <scope> / <variable>
The id of the state go to.
goto_state = 1
goto_state = var:some_state
Moves the camera position over the specified state. 1.0
change_tag_from <scope> / <variable>
The country to change from.
GER = { change_tag_from = ROOT }
GER = { change_tag_from = var:from.country }
Changes the player to the current scope from the target scope. The country the player becomes needs to be the scope in which the command is used. 1.0
create_dynamic_country original_tag = <tag>
The original tag to be used by the country.

copy_tag = <tag>
If specified, copies stuff from this tag rather than the original tag.
<effects>
Effects that will be executed on the new dynamic country.

create_dynamic_country = {
    original_tag = POL
    copy_tag = SOV
    add_political_power = 100
    transfer_state = 123
}
Creates a new dynamic country, akin to ones used in civil wars. 1.9
reserve_dynamic_country <bool>
reserve_dynamic_country = yes
Reserves the dynamic country, making sure that it does not get recycled for civil war even if it does not exist. 1.9

Border War

Name Parameters Examples Description Notes Version Added
start_border_war change_state_after_war = <bool>
Whether the state changes hands after the war.

Attacker scope
state = <id> / <variable>
The attacker state.
num_provinces = <id>
The number of provinces used in the state.
on_win = <id>
The event to fire for the attacker on a win.
on_lose = <id>
The event to fire for the attacker on a loss.
on_cancel= <id>
The event to fire for the attacker on a draw.
Defender scope
state = <id> / <variable>
The defender state.
num_provinces = <id>
The number of provinces used in the state.
on_win = <id>
The event to fire for the defender on a win.
on_lose = <id>
The event to fire for the defender on a loss.
on_cancel= <id>
The event to fire for the defender on a draw.

start_border_war = {
    change_state_after_war = no
    attacker = {
        state = 527
        num_provinces = 4
        on_win = japan_border_conflict.2
        on_lose = japan_border_conflict.3
        on_cancel = japan_border_conflict.4
    }
				
    defender = {
        state = 408
        num_provinces = 4
        on_win = japan_border_conflict.3
        on_lose = japan_border_conflict.2
        on_cancel = japan_border_conflict.4
    }
}
Starts a border war for the specified attacker and defender. The participating countries are the owners of the specified states.   1.5
set_border_war_data attacker = <id> / <variable>
The attacker state.

defender = <id> / <variable>
The defender state.
attacker_modifier = <id> / <variable>
The modifier applied to attacker strength.
defender_modifier = <id> / <variable>
The modifier applied to attacker strength.
combat_width = <id> / <variable>
The combat width used in the border war battle.

set_border_war_data = {
    attacker = 527
    defender = 408
    defender_modifier = 0.15
    combat_width = 100
}
Sets the bonuses or penalties for the attacker and defender in an on-going border war. Used after start_border_war.   1.5
cancel_border_war attacker = <id> / <variable>
The attacker state.

defender = <id> / <variable>
The defender state.
dont_fire_events = <bool>
Stops the events from start_border_war from firing.

cancel_border_war = {
    dont_fire_events = yes
    defender = 408
    attacker = 527
}
Cancels an on-going border war without a winner.   1.5
finalize_border_war attacker = <id> / <variable>
The attacker state.

defender = <id> / <variable>
The defender state.
attacker_win = <bool>
Makes the attacker the winner.
defender_win = <bool>
Makes the defender the winner.

finalize_border_war = {
    attacker_win = yes
    attacker = 527
    defender = 408
}
Ends an on-going border war.   1.5

Country Scope

The effects here must be used within a country scope.

General

Name Parameters Examples Description Notes Version Added
set_country_flag <flag>
An unique string to identify the country flag with.
set_country_flag = my_flag
Defines a country flag. The flag in this effect is used in the meaning of 'boolean flag', used to store information as true or false. To change the flag of a country via an effect, see the set_cosmetic_tag effect.   1.0
set_country_flag flag = <flag>
The flag to set.

days = <int>
Sets the flag to last for the specified amount of days. Optional.
value = <0/1>
Whether to set or to clear the flag. 1 sets, while 0 clears.

set_country_flag = {
    flag = my_flag
    days = 123
    value = 1
}
Defines a country flag. The flag in this effect is used in the meaning of 'boolean flag', used to store information as true or false. To change the flag of a country via an effect, see the set_cosmetic_tag effect.   1.0
clr_country_flag <flag>
The unique string of a country flag to clear.
clr_country_flag = my_flag
Clears a defined country flag.   1.0
modify_country_flag flag = <flag>
The country flag to modify.

value = <value>
The value to set it to: 0 or 1

modify_country_flag = {
    flag = my_flag
    value = 1
}
Modifies a country flag. Use variables instead. 1.3
country_event id = <event>
The event to fire.

days = <int> / <variable>
Fires the event in the specified number of days. Optional.
hours = <int> / <variable>
Fires the event in the specified number of hours. Optional.
random = <int> / <variable>
Adds a random number (between 0 and random, inclusive) of hours to the scheduled fire time. Optional.
random_days = <int> / <variable>
Adds a random number (between 0 and random_days, inclusive) of days to the scheduled fire time. Optional.

country_event = {
    id = my_event.1
    days = 10
    random = 50
    random_days = 10
}
Fires the specified event for the current country. Where triggers do not need to be repeatedly checked random can be a performance light alternative to mean_time_to_happen for scheduling events. 1.0
news_event id = <event>
The event to fire.

days = <int> / <variable>
Fires the event in the specified number of days. Optional.
hours = <int> / <variable>
Fires the event in the specified number of hours. Optional.
random = <int> / <variable>
Adds a random number (between 0 and random, inclusive) of hours to the scheduled fire time. Optional.
random_days = <int> / <variable>
Adds a random number (between 0 and random_days, inclusive) of days to the scheduled fire time. Optional.

news_event = {
    id = my_event.1
    days = 10
    random = 50
    random_days = 10
}
Fires the specified news event for the current country. The news event uses a different interface to the country event.

Where triggers do not need to be repeatedly checked random can be a performance light alternative to mean_time_to_happen for scheduling events.

1.0
set_cosmetic_tag <string>
The cosmetic tag to switch to.
set_cosmetic_tag = SAF_SOV_communism
Makes the current scope use the specified cosmetic tag, changing name and flag.   1.3
drop_cosmetic_tag <bool>
Boolean.
drop_cosmetic_tag = yes
Makes the current scope drop the current cosmetic tag they are using.   1.3
set_rule <rule>
Boolean.
set_rule = {
    can_create_factions = yes
}
Toggles the special game rules for the current scope. Possible rules:
  • 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_puppet
  • can_send_volunteers
  • can_use_kamikaze_pilots
  • units_deployed_to_overlord (subjects only)
1.0
add_dynamic_modifier modifier = <modifier_string>
The name of the Modifier.
scope = <scope>
If you specify it, your dynamic modifier will be scoped to this scope. Optional.
days = x
The modifiers will be removed after x days have passed. Optional.
add_dynamic_modifier = {
    modifier = example_dynamic_modifier
    scope = GER
    days = 14
}
Adds a dynamic modifier to the specified scope (the default scope is ROOT).
It can be scoped to countries, states or unit leaders.
It will be updated daily, unless forced by force_update_dynamic_modifier effect.
Examples can be found in /Hearts of Iron IV/common/dynamic_modifiers/*.txt 1.9
remove_dynamic_modifier modifier = <modifier_string>
The name of the Modifier.
 remove_dynamic_modifier = { modifier = sabotaged_ressources } 
Removes a dynamic modifier from the current scope Examples can be found in /Hearts of Iron IV/common/dynamic_modifiers/*.txt 1.9
force_update_dynamic_modifier <bool>
Boolean.
 force_update_dynamic_modifier = yes 
Forces an update to the variables of the dynamic modifier in case they need to be updated before the daily check.   1.9
scoped_sound_effect <string>
A sound reference from an .asset file.
scoped_sound_effect = "boom"
Plays the specified sound once only for the current country. The sound effect must be properly defined in /Hearts of Iron IV/sound/ More info can be found in the Sound modding article. 1.6
scoped_play_song <song title from .asset>
A music file located in the music folder and .asset
scoped_play_song = "general_peace_1"
Plays an audio track for the specified country only. The song must be defined in a music station in order to work. More information can be found in the Music modding page. If you wish to simply play a sound, the scoped_sound_effect effect should be used instead. 1.9.3

State

Name Parameters Examples Description Notes Version Added
add_state_core <scope> / <variable>
The state to add core to.
add_state_core = 345
Adds a core for the current scope to the specified state.   1.0
remove_state_core <scope> / <variable>
The state to remove core from.
remove_state_core = 345
Removes the core of the current scope from the specified state.   1.0
set_capital <scope> / <variable>
The state to make capital.
set_capital = 345
Makes the specified state the current scope's capital state.   1.0
add_state_claim <scope> / <variable>
The state to add a claim to.
add_state_claim = 345
Adds a claim for the current scope on the specified state.   1.0
remove_state_claim <scope> / <variable>
The state to remove the claim from.
remove_state_claim = 345
Removes a claim of the current scope from the specified state.   1.0
set_state_owner <scope> / <variable>
The state to change ownership of.
set_state_owner = 345
Makes the current scope the owner of the specified state. Recommended to instead use transfer_state unless transferring the ownership without transferring over the control. 1.0
set_state_controller <scope> / <variable>
The state to change controller of.
set_state_controller = 345
Makes the current scope the controller of the specified state.   1.0
transfer_state <scope> / <variable>
The state to change owner and controller of.
transfer_state = 345
Makes the current scope the owner and controller of the specified state.   1.0
set_province_controller <id>
The province to change controller of.
set_province_controller = 2999
Changes the controller of the specified province to the current scope.   1.0

Powers

Name Parameters Examples Description Notes Version Added
add_political_power <int> / <variable>
The amount to add.
add_political_power = 100
add_political_power = var:my_var
Adds the specified amount of political power to the current scope.   1.0
set_political_power <int> / <variable>
The amount to add.
set_political_power = 100
Sets the specified amount of political power for the current scope.   1.0
add_stability <int> / <variable>
The amount to add.
add_stability = 0.1
Adds to the current stability value for the current scope. Stability values are between 0 and 1. 1.5
set_stability <int> / <variable>
The amount to add.
set_stability = 0.5
Sets the current stability value for the current scope. Stability values are between 0 and 1. 1.5
add_war_support <int> / <variable>
The amount to add.
add_war_support = 0.1
Adds to the current war support value for the current scope. War Support values are between 0 and 1. 1.5
set_war_support <int> / <variable>
The amount to set.
set_war_support = 0.5
Sets the current war support value for the current scope. War Support values are between 0 and 1. 1.5
add_command_power <int> / <variable>
The amount to add.
add_command_power = 100
Adds the specified amount of command power to the current scope.   1.5

Politics

Name Parameters Examples Description Notes Version Added
kill_ideology_leader <ideology>
Ideology.
kill_ideology_leader = communism
Kills the country leader of the designated ideology for the current scope.   1.9
retire_ideology_leader <ideology>
Ideology.
retire_ideology_leader = fascism
Retires and removes the country leader of the ideology party for the current scope.   1.9
kill_country_leader <bool>
Boolean.
kill_country_leader = yes
Kills the country leader for the current scope.   1.0
retire_country_leader <bool>
Boolean.
retire_country_leader = yes
Retires and removes the country leader as head of their party for the current scope.   1.0
set_country_leader_ideology <government>
The government to set.
set_country_leader_ideology = socialism
Changes the country leader's government type for the current scope.   1.0
set_country_leader_description ideology = <ideology>
The ideology of the country leader, optional.

desc = <localisation key>
The new description.

set_country_leader_description = {
	ideology = neutrality
	desc = LOC_KEY
}
Changes the country leader's description. Must use a localisation key from any /Hearts of Iron IV/localisation/*.yml file, putting the description in quotes will not work. Localisation for more info 1.9.1
set_country_leader_name ideology = <ideology>
The ideology of the country leader, optional.

name = <localisation key>
The new name.

set_country_leader_name = {
	ideology = neutrality
	name = LOC_KEY
}
Changes the country leader's name. 1.9.1
set_country_leader_portrait ideology = <ideology>
The ideology of the country leader, optional.

portrait = <sprite name>
The new portrait.

set_country_leader_portrait = {
	ideology = neutrality
	portrait = GFX_IMAGE_NAME
}
Changes the country leader's portrait. The portrait must be defined in /Hearts of Iron IV/interface/*.gfx 1.9.1
add_country_leader_trait <trait>
The trait to add.
add_country_leader_trait = nationalist_symbol
Adds the specified trait to the current scope's country leader. Traits are found in /Hearts of Iron IV/common/country_leader/*.txt. 1.0
remove_country_leader_trait <trait>
The trait to remove.
remove_country_leader_trait = nationalist_symbol
Removes the specified trait from the current scope's country leader. Traits are found in /Hearts of Iron IV/common/country_leader/*.txt. 1.0
swap_ruler_traits Similar to swap_ideas. Removes one trait and adds another.
swap_ruler_traits = { remove = <trait> add = <trait> }
Swaps traits.   1.6
hold_election <scope>
The country to hold an election for.
hold_election = ROOT
Executes the events in the on_new_term_election on action for the current scope.   1.0
add_popularity ideology = <ideology>
The party to change.

popularity = <int> / <variable>
The amount of popularity to change.

add_popularity = {
    ideology = fascism
    popularity = -0.5
}
Adjusts the popularity for the specified party in the current scope. Values used are 0 to 1. 1.0
set_politics ruling_party = <ideology>
The party to set.

elections_allowed = <bool>
Whether elections are allowed. Optional.
last_election = <date>
When the last election was. Optional.
election_frequency = <int>
How often in months an election occurs. Optional.

set_politics = {
	ruling_party = democratic
        elections_allowed = no
        last_election = "1935.12.17"
        election_frequency = 48
}
Sets the political party setup for the current scope.  

Previously included the "parties" parameter, which has been deprecated by the "set_popularities" command. The "parties" parameter no longer works as of version 1.7

1.0 (Updated 1.7)
set_popularities <ideology> = <int>/<variable>
The popularity to set.
set_popularities = {
	democratic = 50
	neutrality = 15
	fascism = 30
	communism = 5
}
Sets the political party popularities for the current scope.  

The popularities must add up to 100, otherwise the command will have no effect.

1.7
set_political_party ideology = <ideology>
The party to change.

popularity = <int>
The amount of popularity to set.

set_political_party = {
    ideology = fascism
    popularity = 50
}
Sets the popularity for the specified political party in the current scope.   1.0
set_party_name ideology = <ideology>
The party to change.

long_name = <string>
The new full name for the party.
name = <string>
The new short name for the party.

set_party_name = { 
    ideology = neutrality 
    long_name = GER_neutrality_party_kaiserreich_long 
    name = GER_neutrality_party_kaiserreich 
}
Changes the name of the specified political party for the current scope.   1.0
create_country_leader name = <string>
The name of the leader.

desc = <string>
The description of the leader.
picture = <string>
The graphical reference to the leader portrait.
expire = <string>
When the leader dies in history.
ideology = <string>
The sub-ideology of the country leader. Does not accept regular ideologies.
Traits scope
<trait>
The trait to add. Can add multiple.

create_country_leader = {
	name = "Mohammed Zahir Shah"
	desc = "POLITICS_MOHAMMED_ZAHIR_SHAH_DESC"
	picture = "Portrait_Afghanistan_Mohammed_Zahir_Shah.dds"
	expire = "1965.1.1"
	ideology = despotism
	traits = {
		
	}
}
  The portrait string can include the full path (i.e. gfx/leaders/my_folder/custom_pic.dds) or just the name of the image (i.e. custom_pic.dds).

With just the name, the image must be in a folder that matches the tag of the current scope, for example /Hearts of Iron IV/gfx/leaders/GER/custom_pic.dds. Sub-ideologies are defined in common/ideologies

1.0

Diplomacy

Name Parameters Examples Description Notes Version Added
set_major <bool>
Boolean.
set_major = yes
Makes the current scope a major country.   1.0
create_faction <string>
The name of the faction.
create_faction = MY_FACTION_NAME
Creates a faction with the specified name for the current scope. The current scope and any subjects automatically join the faction.   1.0
add_to_faction <TAG>
The TAG of the nation to add to the faction of the current scope.
FACTION_LEADER_TAG = { add_to_faction = TAG_TO_ADD }
Adds the TAG_TO_ADD to the faction of the FACTION_LEADER_TAG.   1.0
leave_faction <bool>
Boolean.
leave_faction = yes
Removes the current scope from the faction they are part of.   1.5
remove_from_faction <TAG>
The target country.
remove_from_faction = TAG_TO_REMOVE
Removes the specified scope from the faction led by the current scope.   1.0
dismantle_faction <bool>
Boolean.
dismantle_faction = yes
Dismantles the faction of the current scope.   1.0
set_faction_name Sets a faction name as the loc name.
set_faction_name = SOME_LOC_KEY
Changes faction names.   1.6
set_faction_leader <bool>
set_faction_leader = yes
Sets the current country as the faction leader. 1.0
set_faction_spymaster <bool>
set_faction_spymaster = yes
Sets the current country as the faction spymaster. 1.9
release <scope>
The target country.
release = GER
Releases the specified non-existent country as a free nation within the current country's owned states. The effect does nothing if the country exists. All states that are cored by the specified country will be given to it. If the current country has a core on a state transferred to the released country, the core will be lost. If looking to make a subject into an independent nation, use set_autonomy. States that are owned but not controlled will be transferred to the released country, but won't be controlled by it. 1.0
release_on_controlled <scope>
The target country.
release_on_controlled = GER
Releases the specified non-existent country as a free nation within the current country's controlled states. The effect does nothing if the country exists. All states that are cored by the specified country will be given to it. If the current country has a core on a state transferred to the released country, the core will be lost. 1.9.1
release_puppet <scope>
The target country.
release_puppet = GER
Releases the specified non-existent country as a puppet of the current scope within the current country's owned states. The effect does nothing if the country exists. All states that are cored by the specified country will be given to it. If the current country has a core on a state transferred to the released country, the core will be lost. States that are owned but not controlled will be transferred to the released country, but won't be controlled by it. 1.0
release_puppet_on_controlled <scope>
The target country.
release_puppet_on_controlled = GER
Releases the specified non-existent country as a puppet of the current scope within the current country's controlled states. The effect does nothing if the country exists. All states that are cored by the specified country will be given to it. If the current country has a core on a state transferred to the released country, the core will be lost. 1.9.1
release_autonomy target = <scope> / <variable>
The subject country.

autonomy_state = <type>
The type of autonomy state to set.
freedom_level = <float>
The new freedom level value. Optional.

release_autonomy = {
    target = VIN
    autonomy_state = autonomy_puppet
    freedom_level = 0.5
}
Releases the specified non-existent country as a subject of the specified autonomy of the current scope within the current country's owned states. The effect does nothing if the country exists. All states that are cored by the specified country will be given to it. If the current country has a core on a state transferred to the released country, the core will be lost. States that are owned but not controlled will be transferred to the released country, but won't be controlled by it. The autonomy states are found in /Hearts of Iron IV/common/autonomous_states/*.txt. 1.3
give_guarantee <scope>
The target country.
give_guarantee = GER
The current scope guarantees the target country. diplomatic_relation effect can be used to remove it. 1.0
give_military_access <scope>
The target country.
give_military_access = GER
The current scope grants military access to the target country. diplomatic_relation effect can be used to remove it. 1.0
recall_attache <scope>
The target country with an attache.
recall_attache = GER
Recalls the current scope's attaché from the specified country.   1.5
diplomatic_relation country = <scope>
The target country to alter the relationship with ROOT.

relation = <type>
The relation to change.
active = <bool>
Whether the relation is started or broken.

diplomatic_relation = {
    country = SOV
    relation = guarantee
    active = no
}
Used to define a diplomatic relation between the current scope and target scope country. Possible relations:
  • non_aggression_pact
  • guarantee
  • puppet
  • military_access
  • docking_rights
1.0
add_opinion_modifier target = <scope>
The target country.

modifier = <modifier>
The opinion modifier to add.

add_opinion_modifier = {
    target = GER
    modifier = faction_traitor
}
The current scope gains the specified opinion modifier towards the target scope. Can also be used to modify trade relations by adding 'trade = yes' in the opinion <modifier> in /Hearts of Iron IV/common/opinion_modifiers/*.txt Opinion modifiers are found in /Hearts of Iron IV/common/opinion_modifiers/*.txt. 1.0
remove_opinion_modifier target = <scope>
The target country.

modifier = <modifier>
The opinion modifier to remove.

remove_opinion_modifier = {
    target = GER
    modifier = faction_traitor
}
The current scope loses the specified opinion modifier towards the target scope. Opinion modifiers are found in /Hearts of Iron IV/common/opinion_modifiers/*.txt. 1.0
reverse_add_opinion_modifier target = <scope>
The target country.

modifier = <modifier>
The opinion modifier to add.

reverse_add_opinion_modifier = {
    target = GER
    modifier = faction_traitor
}
The target scope gains the specified opinion modifier towards the current scope. Opinion modifiers are found in /Hearts of Iron IV/common/opinion_modifiers/*.txt.
Useful for when you don't know what the current scope will be.
1.0
add_relation_modifier target = <scope>
The target country.

modifier = <modifier>
The relation modifier to add.

add_relation_modifier = {
    target = SWE
    modifier = HUN_dynastic_ties_license
}
The current scope gains the specified relation modifier towards the target scope. Relation modifiers are found in /Hearts of Iron IV/common/modifiers/*.txt. 1.4
remove_relation_modifier target = <scope>
The target country.

modifier = <modifier>
The relation modifier to remove.

remove_relation_modifier = {
    target = SWE
    modifier = HUN_dynastic_ties_license
}
The current scope loses the specified relation modifier for towards the target scope. Relation modifiers are found in /Hearts of Iron IV/common/modifiers/*.txt. 1.4
add_collaboration target = <scope>
The target country.

value = <0-1>
How much collaboration to add.

add_collaboration = {
    target = TAG
    value = 0.3
}
Adds collaboration in TAG with the scoped country. 1.9
set_collaboration target = <scope>
The target country.

value = <0-1>
How much collaboration will be set.

set_collaboration = {
    target = TAG
    value = 0.3
}
Sets the collaboration in TAG with the scoped country. 1.9
recall_volunteers_from <tag>
The target country.
recall_volunteers_from = SPR
Recalls volunteers sent to the specified country back to the current country. 1.9

Subjects

Name Parameters Examples Description Notes Version Added
puppet <scope>
The target country.
puppet = GER
Makes the specified country the puppet of the current scope.   1.0
end_puppet <scope>
The target country.
end_puppet = GER
Removes the puppet status between the target and the current scope.   1.0
add_autonomy_ratio value = <float>
The freedom score to add.

localization = <string>
The localization key for the modifier.

add_autonomy_ratio = {
    value = 0.1
    localization = AST_adopt_westminster
}
Adds a freedom score ratio modifier to the current scope. Used in the subject. 1.3
add_autonomy_score value = <float>
The freedom score to add.

localization = <string>
The localization key for the modifier.

add_autonomy_score = {
    value = 10
    localization = EXAMPLE
}
Adds an exact freedom score modifier to the current scope. Used in the subject. 1.3
set_autonomy target = <scope> / <variable>
The subject country.

autonomy_state = <type>
The type of autonomy state to set.
freedom_level = <float>
The new freedom level value. Optional.

set_autonomy = {
    target = AST
    autonomy_state = autonomy_free
}
Sets the autonomy level for the specified country. The autonomy_free state will free the subject, in which case it must still be done from the current overlord's scope. The autonomy states are found in /Hearts of Iron IV/common/autonomous_states/*.txt. 1.3

Governments in Exile

Name Parameters Examples Description Notes Version Added
add_legitimacy Adds legitimacy to a government in exile.
add_legitimacy = 10
Adds legitimacy.   1.6
set_legitimacy Sets the legitimacy of governments in exile.
set_legitimacy = 10
Sets legitimacy.   1.6
become_exiled_in Makes a country a government in exile in a set country, with a set starting legitimacy.
become_exiled_in = { target = <Host tag> legitimacy = <0-100> (starting legitimacy, optional) }
Creates a government in exile. Must be fired from ROOT, the country that should be exiled, or a TAG specification must be used. 1.6
end_exile Ends a government in exile.
end_exile = yes
Ends a government in exile.   1.6

War

Name Parameters Examples Description Notes Version Added
add_threat <int>
The amount to change by.
add_threat = 10
Adjusts the level of World Tension.   1.0
add_named_threat threat = <int>
The amount to change by.

name = <string>
The localization string.

add_named_threat = { 
    threat = 5 
    name = GER_rhineland
}
Adjusts the level of World Tension and adds an entry in the World Tension tooltip.   1.0
annex_country target = <scope>
Which country to annex.

transfer_troops = yes
Whether to transfer the troops of the annexed country.

annex_country = {
    target = GER
    transfer_troops = yes
}
Annex the specified country for the current scope. Without transfering troops, the annexed country's divisions' equipment is lost. 1.0
add_to_war targeted_alliance = <scope>
The country to assist.

enemy = <scope>
The country attacking the ally.
hostility_reason = <string>
Localization for the reason for joining. Optional.

add_to_war = { 
    targeted_alliance = PREV 
    enemy = HUN 
    hostility_reason = asked_to_join
}
Adds the current scope into the war of their ally against the specified enemy.   1.0
declare_war_on target = <scope> / <variable>
The country to attack.

type = <wargoal>
The wargoal to declare with.
generator = { <state id> }
The states to supply the wargoal (i.e. take_state_focus).

declare_war_on = {
    target = GER
    type = annex_everything
}
Makes the current scope declare war on the specified country with the specified wargoal. Wargoals are found in /Hearts of Iron IV/common/wargoals/*.txt. 1.0
white_peace <scope> / <variable>
The scope to white peace.

<message>
The reason for peace.

white_peace = GER
white_peace = {
    tag = GER
    message = EXAMPLE
}
Makes the current scope white peace the specified scope.   1.0
set_truce target = <scope>
The scope to truce with.

days = <int>
The duration of the truce.

set_truce = {
    target = GER
    days = 90
}
Makes the current scope truce with the specified scope.   1.0
create_wargoal target = <scope> / <variable>
The country to target.

type = <wargoal>
The wargoal to generate.
generator = { <state id> }
The states to supply the wargoal (i.e. take_state_focus).

create_wargoal = {
    type = puppet_wargoal_focus
    target = ROOT
}
Grants the current scope a wargoal against the specified country.   1.0
remove_wargoal target = <scope> / <variable>
The country to target.

type = <wargoal>
The wargoal to remove. "all" will remove all wargoals.

remove_wargoal = {
    type = all
    target = ROOT
}
Removes wargoals from the current scope to the specified country.   1.10.2
start_civil_war ideology = <ideology>
The ideology of the breakaway country.

ruling_party = <ideology>
The ruling party of the original country. Optional.
size = <float>
The size of the breakaway country and the fraction of the original stockpile and military units it will receive. Optional.
capital = <state>
The capital of the breakaway country. Optional.
only_own_territory = <bool>
Limits the breakaway country to only own territory. Optional.
states = { <state> }
The states included in the breakway country. Optional.
states_filter = { <triggers> }
Filters to apply to the state assignment for the breakaway country. Optional.
keep_unit_leaders = { <unit leader id> }
Keep the specified leaders. Optional.
keep_unit_leaders_trigger = { <triggers> }
Keep the specified leaders that meet the triggers. Optional.
keep_political_leader = <bool>
Controls if the party leader of the revolt will join it or not.Yes meaning that the original country will keep the political leader. Optional.

start_civil_war = {
    ruling_party = communism
    ideology = ROOT
    size = 0.8
    only_own_territory = no
    capital = 282
    states = { 
        282 533 536 555 529 530 528 
    }
    keep_unit_leaders = {
        750 751 752
    }
    keep_political_leader = yes
}
Starts a civil war for the current scope with the specified parameters.   1.0
add_civil_war_target Adds a civil war target to a specific country
add_civil_war_target = TAG
Sets that the war between ROOT and TAG is a civil war, resulting in the annexation of the other side. ROOT and TAG must already be at war with each other for the effect to take place. 1.9
transfer_units_fraction Allows to transfer a precise part of the army and the equipement of a country to any country.
transfer_units_fraction= {
	target = SPD
	size = 0.5
	stockpile_ratio = 0.8
	army_ratio = 0.8
	navy_ratio = 0.5
	air_ratio = 0.5
	keep_unit_leaders_trigger = {
		has_trait = trait_SPA_nationalist_sympathies
	}
}
Transfers the specified ratio of Equipment, Army, Navy, and Airforce to the specified country. Unit Leaders can be kept by using triggers with keep_unit_leaders_trigger = {} 1.9
add_nuclear_bombs Adds nuclear bomb to TAG's stockpile.
add_nuclear_bombs = 100
Adds specified number of nukes to the country's stockpile Needs the Nuke tech to use. 1.6
launch_nuke Nukes a province.
launch_nuke = {
	province = 42
	state = 42
	controller = GER
	use_nuke = yes
}
Nukes a province.

When using state it nukes a random province in said state, with a preference to enemy occupied provinces.

Requires Nuke tech and nukes. Removes a nuke from stockpile when used. 1.6

Resources

Name Parameters Examples Description Notes Version Added
add_resource type = <resource>
The resource to add.

amount = <int>
The amount of resource to add.
state = <id>Which state to add the resource to. Variables can be used.

add_resource = {
    type = oil
    amount = 50
    state = 88
}
Adds the specified resource in the specified amount to the specified state.   1.0
destroy_resource type = <resource>
The resource to add.

amount = <int>
The amount of resource to add.
state = <id>Which state to add the resource to. Variables can be used.

destroy_resource = {
    type = oil
    amount = 50
    state = 88
}
Destroys specified resource in the specified amount to the specified state.   1.9
create_import resource = <resource>
The resource to import.

amount = <int>
The amount of resource to import.
exporter = <id>Which country exports the resource.

create_import = {
    resource = steel
    amount = 100
    exporter = GER
}
Creates an import for the current scope with the specified resource and from the specified exporter.   1.0
give_resource_rights Gives resource rights
give_resource_rights = { receiver = ENG state = 291 }
Gives all the resources of a state to the target country see 04_mtg_on_actions 1.6
remove_resource_rights Removes resource rights
ENG = { remove_resource_rights = 477 }
Removes given resource rights   1.6
add_fuel <int> The fuel amount
add_fuel = 400
Adds fuel to the current country.   1.6
set_fuel <int> Fuel amount.
set_fuel = 400
Sets country's current fuel amount.   1.6
set_fuel_ratio Set country's current fuel ratio relative to its capacity.
set_fuel_ratio = 0.5
Sets country's current fuel ratio.   1.6

Buildings

Name Parameters Examples Description Notes Version Added
add_offsite_building type = <building>
The building to add.

level = <level> / <variable>
The maximum level to add.

add_offsite_building = { type = arms_factory level = 1 }
Adds an off-map building for the current scope that produces its effects without being present in a state.   1.5
modify_building_resources building = <building>
The building to modify.

resource = <resource>
The resource to add.
amount = <amount>
The amount of resource to add.

modify_building_resources = {
    building = synthetic_refinery
    resource = oil
    amount = 1
}
Modifies the resource output of the specified building for the current scope.   1.5

National Focus

Name Parameters Examples Description Notes Version Added
load_focus_tree <string>
The focus tree to load.
Alternatively, as an effect block:
tree = <string>
keep_completed = yes/no
load_focus_tree = china_communist_focus

load_focus_tree = { tree = british_focus keep_completed = yes }
Loads a new focus tree for the current scope, retaining any shared focuses.   1.5
unlock_national_focus <focus>
The focus to unlock.
unlock_national_focus = my_focus
Bypasses the specified focus for the current scope (marks as complete without firing complete_effect of the focus).   1.0
complete_national_focus <focus>
The focus to complete.
complete_national_focus = my_focus
Completes the specified focus for the current scope.   1.0
mark_focus_tree_layout_dirty <bool>
Boolean.
mark_focus_tree_layout_dirty = yes
Refreshes the focus tree for the specified country, restarting the checks in allow_branch and position modifiers for focuses. 1.9

Decisions

Name Parameters Examples Description Notes Version Added
activate_decision <decision>
The decision to activate.
activate_decision = my_decision
Activates the specified decision for the current scope, ignoring triggers for the decision. Decisions are found in /Hearts of Iron IV/common/decisions/*.txt 1.0
activate_targeted_decision target = <scope>
The country to target.

decision = <decision>
The decision to activate.

activate_targeted_decision = {
    target = GER
    decision = my_decision
}
Activates the specified targeted decision for the specified target for the current scope. Decisions are found in /Hearts of Iron IV/common/decisions/*.txt 1.5
remove_targeted_decision <decision>
The decision to remove.
remove_targeted_decision = {
    target = FROM
    decision = my_decision
}
Removes the specified targeted decision for the current scope. Decisions are found in /Hearts of Iron IV/common/decisions/*.txt 1.5
unlock_decision_tooltip <decision>
The decision to display.
unlock_decision_tooltip = my_decision
Displays a special tooltip for the specified decision in the effect tooltip. Decisions are found in /Hearts of Iron IV/common/decisions/*.txt 1.5
unlock_decision_category_tooltip <category>
The decision category to display.
unlock_decision_category_tooltip = my_category
Displays a special tooltip for the specified decision category in the effect tooltip. Decision categories are found in /Hearts of Iron IV/common/decisions/catergories/*.txt 1.5
add_days_remove decision = <decision>
The decision to remove days from.

days = <int> / <variable>
The number of days to remove from the mission.

add_days_remove  = {
    decision = decision_here
    days = 30
}
Adds the number of days to a decision's days_remove. Decisions are found in /Hearts of Iron IV/common/decisions/*.txt 1.9
remove_decision Allows to remove specified decision without running remove_effect.
remove_decision = GER_MEPO
Removes a decision.   1.6

Missions

Name Parameters Examples Description Notes Version Added
activate_mission <mission>
The mission to activate.
activate_mission = my_mission
Activates the specified mission for the current scope, ignoring any triggers for the decision. Missions are found in /Hearts of Iron IV/common/decisions/*.txt 1.5
activate_mission_tooltip <mission>
The mission to display.
activate_mission_tooltip = my_mission
Displays a special tooltip for the specified mission in the effect tooltip. Missions are found in /Hearts of Iron IV/common/decisions/*.txt 1.5
remove_mission <mission>
The mission to remove.
remove_mission = my_mission
Removes the specified mission for the current scope. Missions are found in /Hearts of Iron IV/common/decisions/*.txt 1.5
add_days_mission_timeout mission = <mission>
The mission to add days to.

days = <int> / <variable>
The number of days to add to the mission.

add_days_mission_timeout = {
    mission = my_mission
    days = 20
}
Adds the number of days to the specified mission. Missions are found in /Hearts of Iron IV/common/decisions/*.txt 1.9

Technology

Name Parameters Examples Description Notes Version Added
add_research_slot <int>
The number of slots to add or remove.
add_research_slot = 1
Adjusts the number of research slots the current scope has. Can remove slots with negatives.   1.0
set_research_slots <int>
The number of slots to set.
set_research_slots = 4
Sets the number of research slots the current scope has.   1.0
add_tech_bonus bonus = <float>
The bonus to technology given.

uses = <int>
The amount of times the bonus can be used.
ahead_reduction = <float>
The cost reduction if ahead of time.
category = <string>
Which technology category the bonus applies to. Multiple can be defined.
technology = <string>
Which technology the bonus applies to. Multiple can be defined.

add_tech_bonus = {
    bonus = 0.5
    uses = 1
    category = radar_tech
}
Grants a research bonus to the current scope with the specified parameters. Research bonus categories are found in Hearts of Iron IV/common/technology_tags/*.txt 1.0
set_technology <technology> = <int>
The technology to add.
popup = no
To not show the popup after adding technology
set_technology = {
    suicide_craft = 1
}
Grants the specified technology to the current scope. A value of 1 sets the technology. A value of 0 removes the technology, but if it is a researchable technology, the duration it takes to research isn't reset, meaning it can be researched in 1 day. Technologies that are mutually exclusive with other technologies can not be removed by this effect. 1.0
add_to_tech_sharing_group <string>
The group to add the current scope to.
add_to_tech_sharing_group = us_research
Adds the current scope to the specified technology sharing group.   1.3
remove_from_tech_sharing_group <string>
The group to remove the current scope from.
remove_from_tech_sharing_group = us_research
Removes the current scope from the specified technology sharing group.   1.3
modify_tech_sharing_bonus id = <string>
The group to modify.

bonus = <float>
The new bonus.

modify_tech_sharing_bonus = {
    id = us_research
    bonus = 0.5
}
Modifies the specified technology sharing group.   1.3
inherit_technology Transfers all of a nations techs to a specified tag.
inherit_technology = CAN
Transfers tech. Useful when making a country independent. The scoped country inherits the techs from the targeted TAG so be careful with the scope. 1.6

Ideas

Name Parameters Examples Description Notes Version Added
add_ideas <idea>
The idea to add.
add_ideas = my_idea
add_ideas = {
    my_idea_1
    my_idea_2
}
Adds the specified ideas to the current scope. Can be used as a scope to add multiple at once. 1.0
add_timed_idea idea = <idea>
The idea to add.

days = <int> / <variable>
The number of days to add the idea for.

add_timed_idea = {
    idea = my_idea
    days = 180
}
Adds the specified ideas to the current scope for the specified number of days.   1.0
modify_timed_idea idea = <idea>
The idea to modify.

days = <int> / <variable>
The number of days to add to the idea.

modify_timed_idea = {
    idea = my_idea
    days = 60
}
Extends the duration of the timed idea by the specified amount.   1.0
swap_ideas add_idea = <idea>
The idea to add.

remove_idea = <idea>
The idea to remove.

swap_ideas = {
    remove_idea = my_idea_1
    add_idea = my_idea_2
}
Switches two ideas with a tooltip displaying any modifier differences between them. If the ideas have the same name in the localisation, it will show up as modifying the idea rather than swapping them. 1.3
remove_ideas <idea>
The idea to remove.
remove_ideas = my_idea
remove_ideas = {
    my_idea_1
    my_idea_2
}
Removes the specified idea from the current scope. Can be used as a scope to remove multiple at once. 1.0
remove_ideas_with_trait <trait>
The trait to target.
remove_ideas_with_trait = motorized_equipment_manufacturer
Removes all ideas for the current scope that use the specified trait.   1.0
show_ideas_tooltip <idea>
The idea to display.
show_ideas_tooltip = my_idea
Displays the specified idea in the tooltip for the current effect scope. Does not add the idea.   1.0

Unit

Name Parameters Examples Description Notes Version Added
load_oob <oob>
The OOB to load.
load_oob = "GER_default"
Loads the specified OOB for the current scope, applying the effects within.   1.0
division_template name
The name of the division.
regiments = {
    <unit> = { x = 0 y = 0 }
}
support = {
    <unit> = { x = 0 y = 0 }
}

The composition of the division.

division_names_group = <group>
The set of names that the divisions will use. Optional. The groups of unit names can be found in
*\Hearts of Iron IV\common\units\names_divisions
is_locked = <bool>

Whether the division is locked to modification and deletion. Optional.

priority = <int>

The priority the template receives in receiving supplies. Goes from 0 to 2. Optional, 1 by default.

template_counter = <int>

The icon used by the division. Optional. The icons can be found in *\Hearts of Iron IV\interface\subuniticons.gfx, named GFX_div_templ_<int>_large and GFX_div_templ_<int>_small.


division_template = {
    name = "Test"
    is_locked = yes
    division_names_group = USA_INF_01
    priority = 0
    template_counter = 0
    regiments = {
        infantry = { x = 0 y = 0 }
        infantry = { x = 0 y = 1 }
        infantry = { x = 0 y = 2 }
        infantry = { x = 0 y = 3 }
    }
    support = { 
        military_police = { x = 0 y = 0 }
    } 
}
Creates and adds the specified division template to the current scope. The x and y attributes represent the rows and columns in the division designer. 1.0
set_division_template_lock division_template = <string>
The name of the division template.

is_locked = <bool>
Whether the division is locked or not.

set_division_template_lock = {
    division_template = "Infantry Division"
    is_locked = yes
}
Toggles the locked status on a division template for the current scope, which prevents editing or deletion.   1.5
country_lock_all_division_template country_lock_all_division_template = <bool>
Boolean.
country_lock_all_division_template = yes
Locks all division templates for the current scope.   1.9
delete_unit_template_and_units division_template = <string>
The name of the division template.
delete_unit_template_and_units = {
    division_template = "Infantry Division"
    disband = yes #will refund equipment and manpower
}
Deletes the specified division template and all units using it for the current scope.   1.5
delete_unit state = <number id>
The id number of the state the unit must be in.

template = <string>
The template the unit must use to be deleted. id = <int>
The id given to the unit if created via the create_unit effect.

 ENG = { delete_unit = { 
            state = 787             
             disband = yes #will refund equipment and manpower
              }}
Deletes all units that meet the filters.   1.5

Equipment

Name Parameters Examples Description Notes Version Added
set_equipment_fraction <float> / <variable>
The fraction of equipment to remove.
set_equipment_fraction = 0.5
Reduces the overall equipment stockpile by the specified fraction. This should not be used in civil wars to simulate stockpile splitting. start_civil_war automatically divides stockpiles according to the respective size. 1.0
add_equipment_to_stockpile type = <equipment>
The equipment to add. Can be archetype.

amount = <int> / <variable>
The amount to add.
producer = <scope> (accepts variables)
Defines who produced the equipment. Optional.

add_equipment_to_stockpile = {
    type = infantry_equipment
    amount = 100
    producer = GER
}
Adds the specified equipment to the current scope. Note that removal will only remove equipment with the same producer defined in the effect. 1.0
send_equipment type = <equipment>
The equipment to add. Can be archetype.

amount = <int> / <variable>
The amount to add.
target = <scope> / <variable>
Which country receives the equipment.

send_equipment = {
    equipment = infantry_equipment
    amount = 100
    target = GER
}
Sends the specified amount of equipment to the specified target, removing said equipment from the current scope.   1.0
send_equipment_fraction value = <0-1>
How much equipment to send.

target = <scope> / <variable>
Which country receives the equipment.

send_equipment_fraction = {
    value = 0.3
    target = GER
}
Sends the specified fraction of equipment to the specified target, removing said equipment from the current scope.   1.9
create_production_license target = <scope>
Which country receives the license.

cost_factor = <float>
Modifies the production cost.
Equipment scope
type = <equipment>
The equipment the country is licensed to produce. Must be an non-archetype equipment.
version = <int>
The version indicates which variant should be licensed. The default is 0, meaning the base variant.

create_production_license = {
    target = HUN
    equipment = {
        type = fighter_equipment_1
        version = 0
    }
    cost_factor = 0
}
Grants the specified country a license to produce the specified equipment from the current scope.   1.4
create_equipment_variant name = <string>
The name of the variant

type = <equipment>
The equipment the variant is of.
parent_version = <int>
Ordering for multiple variants.
Upgrade scope
<upgrade> = <amount>
The upgrades configuration for the variant.

create_equipment_variant = { 
    name = "Montecuccoli Class" 
    type = light_cruiser_1 
    upgrades = { 
        ship_reliability_upgrade = 3 
        ship_engine_upgrade = 3 
        ship_gun_upgrade = 3 
        ship_anti_air_upgrade = 3 
    }
}
Creates the specified equipment variant for the current scope.   1.0
add_equipment_production amount = <int>
The amount to produce. Optional.

requested_factories = <int>
The number of factories to assigned initially. Optional.
progress = <float>
The initial production progress. Optional.
efficiency = <float>
The initial production efficiency. Optional.
Equipment scope
type = <equipment>
The name of the equipment to produce.
creator = <scope>
The country which is producing the equipment. Used if root scope isn't producer. Optional.
version_name = <string>The name of the variant to produce. Optional.

add_equipment_production = {
    equipment = {
        type = light_cruiser_2
    }
    requested_factories = 1
    progress = 0.95
    amount = 1
}
Starts a production line for the specified equipment for the current scope.   1.0

Army

Name Parameters Examples Description Notes Version Added
add_manpower <int> / <variable>
The amount to add.
add_manpower = 100000
add_manpower = var:my_var
Adds the specified amount of manpower to the current scope.   1.0
army_experience <float> / <variable>
The amount to add.
army_experience = 10
Adds the specified amount of army experience to the current scope.   1.0
create_corps_commander name = <string>
The name of the leader.

picture = <string>
The graphical reference of the picture of the leader.
skill = <int>
The skill of the leader.
attack_skill = <int>
The attack skill of the leader.
defense_skill = <int>
The defense skill of the leader.
planning_skill = <int>
The planning skill of the leader.
logistics_skill = <int>
The logistics skill of the leader.
traits = { <trait> }
The traits the leader spawns with.
female = <bool>
The gender of the leader.

create_corps_commander = {
	name = "Jean de Lattre de Tassigny"
	picture = "Portrait_France_Jean_de_Lattre_de_Tassigny.dds"
	traits = { trickster brilliant_strategist }
	skill = 4
	attack_skill = 4
	defense_skill = 2
	planning_skill = 4
	logistics_skill = 3
}
Creates a commander for the current scope with the specified attributes. Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. 1.0
create_field_marshal name = <string>
The name of the leader.

picture = <string>
The graphical reference of the picture of the leader.
skill = <int>
The skill of the leader.
attack_skill = <int>
The attack skill of the leader.
defense_skill = <int>
The defense skill of the leader.
planning_skill = <int>
The planning skill of the leader.
logistics_skill = <int>
The logistics skill of the leader.
traits = { <trait> }
The traits the leader spawns with.

create_field_marshal = {
	name = "Maurice Gamelin"
	picture = "Portrait_France_Maurice_Gamelin.dds"
	traits = { defensive_doctrine }
	skill = 2
	attack_skill = 1
	defense_skill = 3
	planning_skill = 2
	logistics_skill = 1
}
Creates a field marshal for the current scope with the specified attributes. Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. 1.0
remove_unit_leader <id>
The id of the unit leader.
remove_unit_leader = 70
Removes the specified unit leader by their id.   1.0

Navy

Name Parameters Examples Description Notes Version Added
navy_experience <float> / <variable>
The amount to add.
navy_experience = 10
Adds the specified amount of navy experience to the current scope.   1.0
destroy_ships type = <ship>
The type of ship to destroy.

count = <int> or all
The amount to destroy.

destroy_ships = {
    type = destroyer
    count = all
}
Destroys the specified type and amount of ships controlled by the current scope.   1.5
transfer_navy target = <scope>
The target country.
transfer_navy = {
    target = GER
}
Transfers the current scope navy to the specified country.   1.5
transfer_ship type = <ship>
The type of ship to transfer.

target = <scope>
The target country.
prefer_name = <string>
Name of ship in origin navy that will preferably be transferred to target navy. Optional.

transfer_ship = {
    prefer_name = "HMS Achilles"
    type = light_cruiser
    target = NZL
}
Transfers the specified type of ship from the current scope to the specified country.   1.4
create_navy_leader name = <string>
The name of the leader.

picture = <string>
The graphical reference of the picture of the leader.
skill = <int>
The skill of the leader.
traits = { <trait> }
The traits the leader spawns with.

create_navy_leader = {
	name = "François Darlan"
    picture = "Portrait_France_Francois_Darlan.dds"
	traits = { superior_tactician }
	skill = 3
}
Creates a naval leader for the current scope with the specified attributes. Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. 1.0
create_ship type = <ship>
The type of ship to create. equipment_variant = <string>
The equipment variant to use.

creator = <scope>
The country that created this ship. Optional. name = <string>
Name of the ship. Optional.

FRA = {
    create_ship = {
        type = ship_hull_submarine_1
        equipment_variant = "S Class"
        creator = ENG
        name = "My ship name"
    }
}
Create a ship from another country and assign it to the reserve fleet. If not set, it will be the scoped country.   1.9
add_mines Add mines to a strategic region for the current country.
add_mines = { region = 42 amount = 100 }
Add mines to a strategic region.   1.6

Air

Name Parameters Examples Description Notes Version Added
air_experience <float> / <variable>
The amount to add.
air_experience = 10
Adds the specified amount of air experience to the current scope.   1.0
add_ace name = <string>
The name of the ace.

surname = <string>
The surname of the ace.
callsign = <string>
The callsign of the ace.
type = <type>
The ace type.
is_female = <bool>
The gender of the ace.

add_ace = {
    name = "Amelia"
    surname = "Earhart"
    callsign = "Revenant"
    type = fighter_genius
    is_female = yes
}
Adds an ace for the current scope. Ace types found in /Hearts of Iron IV/common/aces/*.txt. 1.0

AI

Name Parameters Examples Description Notes Version Added
add_ai_strategy type = <type>
The type of strategy.

id = <scope>
What country the strategy is against.
value = <int>
The weighting added by the strategy.

add_ai_strategy = {
    type = alliance
    id = GER
    value = 200
}
Sets an AI strategy for the current scope. See AI Modding for more details. 1.0

Intelligence

Name Parameters Examples Description Notes Version Added
create_intelligence_agency Allows to create automatically an intelligence agency
create_intelligence_agency = yes
Creates an Intelligence Agency.   1.9
upgrade_intelligence_agency Allows to unlock automatically an intelligence agency uprgrade
upgrade_intelligence_agency = upgrade_form_department
upgrade_intelligence_agency = <upgrade>
Unlocks an Intelligence Agency Upgrade. Upgrades can be found in common/intelligence_agency_upgrades 1.9
add_decryption target = <tag>
Towards which country to add decryption.

amount = <int>
How much decryption to add in flat numbers.
ratio = <0-1>
How much decryption ratio to add.

add_decryption = {
    target = GER
    amount = 300
}
add_decryption = {
    target = GER
    ratio = 0.5
}
Adds decryption towards the target country target and ratio arguments are mutually exclusive. 1.9
add_intel target = <tag>
Towards which country to add intelligence.

civilian_intel = <int>
How much civilian intel to add.
army_intel = <int>
How much army intel to add.
navy_intel = <int>
How much navy intel to add.
airforce_intel = <int>
How much airforce intel to add.

add_intel = {
    target = GER
    civilian_intel = 3
    army_intel = 2
    navy_intel = 1
    airforce_intel = 2
}
Adds the specified amount of intel towards the specified country. If an intel argument is left out, 0 is assumed. 1.9
add_operation_token tag = <tag>
Towards which country to add a token on.

token = <id>
Which token to add.

add_operation_token = {
    tag = GER
    token = token_test
}
Adds an operation token towards the country, allowing access to more intel or applying a targeted modifier. Operation tokens are defined in /Hearts of Iron IV/common/operation_tokens/*. 1.9
remove_operation_token tag = <tag>
Towards which country to remove a token from.

token = <id>
Which token to remove.

add_operation_token = {
    tag = GER
    token = token_test
}
Removes an operation token from the country. Operation tokens are defined in /Hearts of Iron IV/common/operation_tokens/*. 1.9
capture_operative operative = <tag>
Which operative to capture.

ignore_death_chance = <bool>
Whether to ignore the death chance on capture (no by default).

capture_operative = {
    operative = PREV
    ignore_death_chance = yes
}
capture_operative = PREV
Captures the specified operative. Operatives can be referred to by using tags that refer to scopes 1.9
create_operative_leader bypass_recruitment = <bool>
Whether the operative is directly added to the list of available operatives or needs to be recruited.

available_to_spy_master = <bool>
Whether the operative can be recruited by the spy master. bypass_recruitment should be set to no. portrait_tag_override = <bool>
If selecting a random portrait, create one that is from the specified country rather than the current country. name = <string>
The name of the operative. GFX = <string>
The graphical reference of the picture of the leader, taken from a file in /Hearts of Iron IV/interface/*.gfx.
nationalities = { <tag> }
The nationalities of the operative.
traits = { <trait> }
The traits the leader spawns with.

create_operative_leader = {
	name = "Jacques Duclos"
	GFX = GFX_portrait_jacques_duclos
	traits = { operative_infiltrator operative_natural_orator }
	bypass_recruitment = no
	available_to_spy_master = yes
	nationalities = { FRA POL }
}
Creates an operative for the current scope with the specified attributes. Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. All arguments aside from bypass_recruitment are optional. 1.9
free_operative <tag>
The operative to be freed.
free_operative = PREV
Frees the specifies operative. Operatives can be referred to by using tags that refer to scopes 1.9
free_random_operative captured_by = <tag>
The country that captured the operative.

all = <bool>
Whether to free all operatives or not (Defaults to no).

free_random_operative = {
	captured_by = POL
	all = yes
}
Frees one random captured operative or all of them. 1.9
kill_operative operative = <tag>
The operative that is killed.
kill_operative = {
    operative = PREV
}
kill_operative = PREV
Kills the targeted operative. Operatives can be referred to by using tags that refer to scopes 1.9
turn_operative operative = <tag>
The operative that is turned.
turn_operative = {
    operative = PREV
}
turn_operative = PREV
Turns the targeted operative against their own country, transferring them to the current country. Operatives can be referred to by using tags that refer to scopes. This counts as the operative dying and will trigger the corresponding On action. Logs an error if used against your own operative. 1.9
steal_random_tech_bonus category = <category name>
The category to steal from. See /Hearts of Iron IV/common/technology_tags/* for list.

folder = naval_folder
The folder to steal from. See /Hearts of Iron IV/common/technology_tags/* for list. ahead_reduction = <float>
The reduction to the ahead of time penalty. bonus = <float>
The bonus to research speed. base_bonus = <float>
The backup bonus if no tech is available. instant = <bool>
Whether to instantly give a tech instead of a bonus or not. No by default. dynamic = <bool>
Changes between instant and non-instant based on type. No by default. name = <localisation key>
The name of the bonus. target = <tag>
The country to steal from. uses = <int>
How many times the bonus can be used.

steal_random_tech_bonus = {
    category = air_equipment
    folder = naval_folder
    ahead_reduction = 0.8
    bonus = 1.2
    base_bonus = 1.1
    dynamic = yes
    name = LOC_KEY
    target = POL
    uses = 2
}
Steals a random tech bonus from the specified country. If a country does not have a tech to be stolen, a random bonus will be applied by using base_bonus as a base. 1.9

State Scope

The effects here must be used within a state scope.

General

Name Parameters Examples Description Notes Version Added
state_event id = <event>
The event to fire.

days = <int> / <variable>
Fires the event in the specified number of days. Optional.
hours = <int> / <variable>
Fires the event in the specified number of hours. Optional.
random = <int> / <variable>
Adds a random number (between 0 and random, inclusive) of hours to the scheduled fire time. Optional.
random_days = <int> / <variable>
Adds a random number (between 0 and random_days, inclusive) of days to the scheduled fire time. Optional.

state_event = {
    id = my_event.1
    days = 10
    random = 50
    random_days = 10
    trigger_for = controller
}
Fires the specified event for the current state. Where triggers do not need to be repeatedly checked random can be a performance light alternative to mean_time_to_happen for scheduling events.

Using days = <event> / <variable> or hours may still be bugged and will not fire the event.

1.0
set_state_flag <flag>
An unique string to identify the state flag with.
set_state_flag = my_flag
Defines a state flag. Can also use syntax from set_country_flag to set a timed flag.   1.0
clr_state_flag <flag>
The unique string of a state flag to clear.
clr_state_flag = my_flag
Clears a defined state flag.   1.0
modify_state_flag flag = <flag>
The state flag to modify.

value = <value>
The value to set it to: 0 or 1

modify_state_flag = {
    flag = my_flag
    value = 1
}
Modifies a state flag. Use variables instead. 1.3
set_state_name <string>
Defines the new name.
set_state_name = "Funland"
Changes the current state's name to the specified name.   1.3
reset_state_name <bool>
Boolean.
reset_state_name = yes
Resets any changes to the current state's name.   1.3
add_claim_by <scope> / <variable>
The country to add the claim for.
add_claim_by = SOV
Adds a claim for the specified country on the current scope.   1.0
remove_claim_by <scope> / <variable>
The country to remove the claim for.
remove_claim_by = SOV
Removes a claim by the specified country on the current scope.   1.0
add_core_of <scope> / <variable>
The country to add the core for.
add_core_of = SOV
Adds a core for the specified country on the current scope.   1.0
remove_core_of <scope> / <variable>
The country to remove the core for.
remove_core_of = SOV
Removes a core for the specified country on the current scope.   1.0
set_demilitarized_zone <bool>
Boolean.
set_demilitarized_zone = yes
Makes the current scope a demilitarized zone.   1.0
set_state_category <category>
The category to change to.
set_state_category = rural
Changes the current state category to the specified category. Categories are found in /Hearts of Iron IV/common/state_category/*.txt 1.3
add_state_modifier Modifier scope

<modifier> = <float>
Adds a modifier to the state.

add_state_modifier = {
    modifier = {
        local_resources = 2.0
    }
}
Adds a modifier to the current state.   1.3
add_manpower <int> / <variable>
The amount to add.
add_manpower = 10000
Adds the specified amount of manpower to the current state.   1.0
add_resource type = <resource>
The resource to add.

amount = <int> / <variable>
The amount to add.

add_resource = {
    type = oil
    amount = 100
}
Adds the specified resource in the specified amount to the current state.   1.0
set_border_war <bool>
Boolean.
set_border_war = yes
Enables Border War status for the current state.   1.0
create_unit division = <division string>
The division string.

owner = <scope>
The owner of the division.
prioritize_location = <province>
Prioritize the specified province in the state.

create_unit = {
    division = "name = \"Infantry Division\" division_template = \"Infantry Division\" start_experience_factor = 0.5 start_equipment_factor = 0.5"
    owner = GER
}
Adds the specified division to the current state. The division string must be formatted as it is seen in the examples (to clarify, everything between 'division =' and 'owner =' must be on one single line. Multiple lines breaks the code). 1.3
add_dynamic_modifier modifier = <modifier_string>
The name of the Modifier.
scope = <scope>
If you specify this your dynamic modifier scoped to this scope (root is the effect scope). Optional.
scope = <days>
Will be removed after this many days passes. Optional.
 add_dynamic_modifier = { modifier = sabotaged_ressources } 
Adds a dynamic modifier to the current scope Examples can be found in /Hearts of Iron IV/common/dynamic_modifiers/*.txt 1.9
remove_dynamic_modifier modifier = <modifier_string>
The name of the Modifier.
 remove_dynamic_modifier = { modifier = sabotaged_ressources } 
Removes a dynamic modifier to the current scope Examples can be found in /Hearts of Iron IV/common/dynamic_modifiers/*.txt 1.9
force_update_dynamic_modifier <bool>
Boolean.
 force_update_dynamic_modifier = yes 
Forces an update to the variables of the dynamic modifier in case they need to be updated before the daily check.   1.9
teleport_armies limit = { <triggers> }
The condition that must be true for the owner of the armies for them to teleport.

to_state_array = <array>
The state array the armies will get teleported to.
to_province = <ID>
The province the armies will get teleported to.
to_state = <ID>
The state the armies will get teleported to.

teleport_armies = {
    limit = {
        has_war_together_with = ROOT
    }
    to_state_array = owned_controlled_states
}
Teleports all armies in the specified state if the owner of the armies meets the condition. Only define one of to_state_array, to_state, or to_province. If none is specified, it defaults to the capital. 1.9
add_province_modifier static_modifiers = { <modifiers> }
The list of modifiers.
province = <id>The province to apply the modifiers to.provinces = {}Scope for selecting multiple provinces. The following arguments have to go inside it:
id = <id>The ID of the province. Multiple can be specified.
all_provinces = yesSelects all provinces to which the limitations apply. The following arguments require it: limit_to_coastal = yes Limits the selection of provinces to only coastal ones.
limit_to_border = yes Limits the selection of provinces to only ones bordering a different country.
limit_to_naval_base = yes Limits the selection of provinces to only ones that have a naval base.
limit_to_victory_point = yes Limits the selection of provinces to only ones that have a victory point, or a city, in them.
 add_province_modifier = { 
	static_modifiers = { mod_modifier_1 mod_modifier_2 }
	province = 1234
} 
add_province_modifier = { 

static_modifiers = { mod_modifier_1 mod_modifier_2 } province = { id = 1234 id = 4321 }

}
add_province_modifier = { 

static_modifiers = { mod_modifier_1 mod_modifier_2 } province = { all_provinces = yes limit_to_coastal = yes limit_to_border = yes limit_to_naval_base = yes limit_to_victory_point = yes }

}
Adds a province modifier to the specified provinces in this state. Province modifiers are defined in /Hearts of Iron IV/common/modifiers/*.txt 1.6
remove_province_modifier static_modifiers = { <modifiers> }
The list of modifiers.
province = <id>The province to apply the modifiers to.provinces = {}Scope for selecting multiple provinces. The following arguments have to go inside it:
id = <id>The ID of the province. Multiple can be specified.
all_provinces = yesSelects all provinces to which the limitations apply. The following arguments require it: limit_to_coastal = yes Limits the selection of provinces to only coastal ones.
limit_to_border = yes Limits the selection of provinces to only ones bordering a different country.
limit_to_naval_base = yes Limits the selection of provinces to only ones that have a naval base.
limit_to_victory_point = yes Limits the selection of provinces to only ones that have a victory point, or a city, in them.
 remove_province_modifier = { 
	static_modifiers = { mod_modifier_1 mod_modifier_2 }
	province = 1234
} 
remove_province_modifier = { 

static_modifiers = { mod_modifier_1 mod_modifier_2 } province = { id = 1234 id = 4321 }

}
remove_province_modifier = { 

static_modifiers = { mod_modifier_1 mod_modifier_2 } province = { all_provinces = yes limit_to_coastal = yes limit_to_border = yes limit_to_naval_base = yes limit_to_victory_point = yes }

}
Removes a province modifier to the specified provinces in this state. Province modifiers are defined in /Hearts of Iron IV/common/modifiers/*.txt 1.6

Buildings

Name Parameters Examples Description Notes Version Added
add_building_construction type = <string>
The building to add.

level = <int> / <variable>
The level to set the building to.
instant_build = <bool>
Defines whether the buildings are instantly built.
province = <id>
Defines the exact province to add provincal buildings in. Can be used as a scope.
Province scope
all_provinces = <bool>
Affect all provinces. Used in the province scope.
limit_to_coastal = <bool>
Affect coastal provinces. Used in the province scope.
limit_to_naval_base = <bool>
Affect naval base provinces. Used in the province scope.
limit_to_border = <bool>
Affect border provinces. Used in the province scope.
level = <int>
Affect only provinces with buildings level below, at or above the specified level. Used in the province scope.
id = <id>
Affect the specified province. Used in the province scope.

add_building_construction = {
    type = arms_factory
    level = 5
    instant_build = yes
}
add_building_construction = {
    type = bunker
    level = 10
    instant_build = yes
    province = {
        all_provinces = yes
        limit_to_border = yes
    }
}
add_building_construction = {
    type = bunker
    level = 1
    instant_build = yes
    province = 2999
}
Starts construction in the current state for the specified building. You can limit the construction to victory points using : limit_to_victory_point > 5 (only build province buildings on province with VP over 5 ) limit_to_victory_point = yes (only build province buildings on province with VP) 1.0
set_building_level type = <string>
The building to add.

level = <int> / <variable>
The level to set the building to.
instant_build = <bool>
Defines whether the buildings are instantly built.
province = <id>
Defines the exact province to add provincal buildings in. Can be used as a scope.
Province scope
all_provinces = <bool>
Affect all provinces. Used in the province scope.
limit_to_coastal = <bool>
Affect coastal provinces. Used in the province scope.
limit_to_naval_base = <bool>
Affect naval base provinces. Used in the province scope.
limit_to_border = <bool>
Affect border provinces. Used in the province scope.
level = <int>
Affect only provinces with buildings level below, at or above the specified level. Used in the province scope.
id = <id>
Affect the specified province. Used in the province scope.

set_building_level = {
    type = infrastructure
    level = 10
    instant_build = yes
}
set_building_level = {
    type = bunker
    level = 3
    province = {
        all_provinces = yes
        limit_to_border = yes
        level < 3
    }
}
Sets the specified building to the current state (or provinces within the state). The province scope is used for provincal level buildings. You can limit the construction to victory points using : limit_to_victory_point > 5 (only build province buildings on province with VP over 5 ) limit_to_victory_point = yes (only build province buildings on province with VP) 1.4
damage_building type = <building>
The building to damage.

damage = <float>
The amount of damage to inflict.
province = <id>
The province to target for provincal buildings.

damage_building = {
    type = infrastructure
    damage = 1
}
Damages the specified building in the current state. The health of buildings is determined by the value attribute in a building's definition. This is multiplied by their level to get their total health. 1.3
remove_building type = <building>
The building to remove.

level = <int> / <variable>
The levels to remove.

remove_building = {
    type = arms_factory
    level = 5
}
Removes the specified building in the current state. For shared buildings level determines the amount, whereas for the others it is the actual level.   1.0
add_extra_state_shared_building_slots <int> / <variable>
The amount of slots to add or remove.
add_extra_state_shared_building_slots = 2
Adjusts the number of shared building slots for the current state.   1.0
set_state_province_controller controller = <tag>
The new controller of the province.

limit = { <triggers> }
The triggers that must be fulfilled by the province's current controller to be transerred to the new controller.

set_state_province_controller = {
    controller = POL
    limit = {
        OR = {
            tag = GER
            is_in_faction_with = GER
        }
    }
}
Changes the controller of all provinces within that state controlled by countries that meet triggers to the specified country.   1.9

Resistance and Compliance

Name Parameters Examples Description Notes Version Added
add_compliance <int> / <variable>
The amount to add.
 add_compliance = 30 
Adds compliance to the specified state.   1.9
add_resistance <int> / <variable>
The amount to add.
 add_resistance = 30 
Adds resistance to the specified state.   1.9
add_resistance_target <int> / <variable>
The amount to add.
 add_resistance_target = 30 
Increases resistance target in the specified state.   1.9
add_resistance_target id = <int>
The ID of the target increase.
amount = <int>/<variable>
The amount to increase the resistance target by.
occupied = <scope>
Will only apply the increase if the the occupied country is the specified scope.
occupier = <scope>
Will only apply the increase if the the occupier is the specified scope.
days = <int>/<variable>
If set, the resistance target will only be increased for the specified amount of days.
tooltip = <string>
The tooltip to show in the resistance target tooltip.
add_resistance_target = {
    id = 123
    amount = 30
    occupied = ENG
    occupier = GER
    days = 365
    tooltip = my_localisation_key
}
Increases resistance target in the specified state.   1.9
cancel_resistance <bool>
 cancel_resistance = yes 
Cancels resistance activity for the current state.   1.9
force_disable_resistance <scope>
The target country.
 force_disable_resistance = GER 
Disables resistance for the scoped state when the occupier is the specified country.   1.9
force_disable_resistance clear = <bool>
If set to yes, will clear resistance.
occupier = <scope>
Resistance will be disabled if the occupier is the specified scope.
occupied = <scope>
Resistance will be disabled if the occupied country is the specified scope.
force_disable_resistance = {
    clear = yes
    occupier = GER
    occupied = ENG
}
Disables resistance for the scoped state when the occupier is the specified country.   1.9
force_enable_resistance <scope>
The target country.
 force_enable_resistance = GER 
Enables resistance for the scoped state when the occupier is the specified country.   1.9
force_enable_resistance clear = <bool>
If set to yes, will clear resistance.
occupier = <scope>
Resistance will be enabled if the occupier is the specified scope.
occupied = <scope>
Resistance will be enabled if the occupied country is the specified scope.
force_enable_resistance = {
    clear = yes
    occupier = GER
    occupied = ENG
}
Enables resistance for the scoped state when the occupier is the specified country.   1.9
remove_resistance_target <int> / <variable>
The id of the resistance target to remove. (Must be set with add_resistance_target)
 remove_resistance_target = 30 
Removes a set resistance target increase in the specified state. Has no tooltip. 1.9
set_compliance <int> / <variable>
The amount to set the compliance to.
 set_compliance = 30 
Sets compliance in the specified state.   1.9
set_resistance <int> / <variable>
The amount to set the resistance to.
 set_resistance = 30 
Sets resistance in the specified state.   1.9
start_resistance <bool>/<scope>
Whether to start resistance or not. If set to a scope, starts resistance for the specified scope.
 start_resistance = POL 
 start_resistance = yes
Starts resistance in the specified state. If used on a state that normally can't start resistance, use along with force_enable_resistance. 1.9
set_garrison_strength <0-1>
The new garrison strength.
set_garrison_strength = 0.5 
Sets the strength of the garrison in the specified state. 1.9

Unit Leader Scope

The effects here must be used within a unit leader scope.

General

Name Parameters Examples Description Notes Version Added
unit_leader_event id = <event>
The event to fire.

days = <int> / <variable>
Fires the event in the specified number of days. Optional.
hours = <int> / <variable>
Fires the event in the specified number of hours. Optional.
random = <int> / <variable>
Adds a random number (between 0 and random, inclusive) of hours to the scheduled fire time. Optional.
random_days = <int> / <variable>
Adds a random number (between 0 and random_days, inclusive) of days to the scheduled fire time. Optional.

unit_leader_event = {
    id = my_event.1
    days = 10
    random = 50
    random_days = 10
}
Fires the specified event for the owner of the current unit leader. Uses a special interface displaying the current unit leader portrait.

Where triggers do not need to be repeatedly checked random can be a performance light alternative to mean_time_to_happen for scheduling events.

1.5
set_unit_leader_flag <flag>
An unique string to identify the unit leader flag with.
set_unit_leader_flag = my_flag
Defines a unit leader flag.   1.5
clr_unit_leader_flag <flag>
The unique string of a unit leader flag to clear.
clr_unit_leader_flag = my_flag
Clears a defined unit leader flag.   1.5
modify_unit_leader_flag flag = <flag>
The unit leader flag to modify.

value = <value>
The value to set it to: 0 or 1

modify_unit_leader_flag = {
    flag = my_flag
    value = 1
}
Modifies a unit leader flag.   1.5
promote_leader <bool>
Boolean
promote_leader = yes
Promotes the current unit leader to Field Marshal (if Commander.   1.5
demote_leader <bool>
Boolean
demote_leader = yes
Demotes the current unit leader to Commander (if Field Marshal).   1.5
retire <bool>
Boolean>
retire = yes
Retires the current unit leader (removing them).   1.5
remove_unit_leader <bool>
remove_unit_leader = yes
Removes the current unit leader. 1.0
set_nationality <scope> / <variable>
The target country.
set_nationality = GER
Switches the current unit leader to the specified country, giving them the leader.   1.5
add_unit_leader_trait <trait>
The trait to add.
add_unit_leader_trait = old_guard
Adds the specified trait to the current unit leader. Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. 1.0
remove_unit_leader_trait <trait>
The trait to remove.
remove_unit_leader_trait = old_guard
Removes the specified trait from the current unit leader. Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. 1.0
add_random_trait <trait>
The trait to add.
add_random_trait = { old_guard brilliant_strategist inflexible_strategist }
Adds a random trait from the list to the unit leader. Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. 1.5
add_timed_unit_leader_trait <trait>
The trait to add.

days = <int>
The duration of the trait.

add_timed_unit_leader_trait = {
    trait = wounded
    days = 90
}
Adds the specified trait to the current unit leader for the specified duration. Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. 1.5
replace_unit_leader_trait       Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. 1.5
remove_exile_tag Remove the exile tag on a army leader, making them no longer be considered exile leaders.
remove_exile_tag = yes
Removes a leaders exile tag.   1.6
gain_xp <int>
gain_xp = 5
Adds experience to the current unit leader, promoting to the next skill level if applicable. Cannot be used with negatives. 1.9
set_leader_description <localisation key> New leader description
set_leader_description = LOC_KEY
Changes the description of the current unit leader. Must be used with a localisation key, putting it in quotes won't work. See Localisation for more info. 1.9.1
set_leader_name <localisation key> New leader name
set_leader_name = LOC_KEY
Changes the name of the current unit leader. 1.9.1
set_leader_portrait <sprite name> New leader portrait
set_leader_portrait = GFX_IMAGE_NAME
Changes the portrait of the current unit leader. The portrait must be defined in /Hearts of Iron IV/interface/*.gfx 1.9.1

Combat

Name Parameters Examples Description Notes Version Added
supply_units <int> / <variable>
The amount of hours of supply.
supply_units = 24
Adds the specified amount of hours of supply to troops led by the current unit leader.   1.5
add_max_trait <int>
The amount to add.
add_max_trait = 1
Adds the specified amount of assignable trait slots to the current unit leader.   1.5
add_skill_level <int>
The skill to add.
add_skill_level = 1
Adds skill to the current unit leader.   1.5
add_logistics <int>
How many skill levels to add.
add_logistics = 1
Adds logistics skill to the current unit leader.   1.5
add_planning <int>
How many skill levels to add.
add_planning = 1
Adds planning skill to the current unit leader.   1.5
add_defense <int>
How many skill levels to add.
add_defense = 1
Adds defense skill to the current unit leader.   1.5
add_attack <int>
How many skill levels to add.
add_attack = 1
Adds attack skill to the current unit leader.   1.5
add_coordination <int>
How many skill levels to add.
add_coordination = 1
Adds coordination skill to the current navy leader. 1.5
add_maneuver <int>
How many skill levels to add.
add_maneuver = 1
Adds maneuver skill to the current navy leader. 1.5
add_temporary_buff_to_units combat_offense = <float>
The bonus to grant. Optional.

combat_breakthrough = <float>
The bonus to grant. Optional.
combat_defense = <float>
The bonus to grant. Optional.
combat_entrenchment = <float>
The bonus to grant. Optional.
org_damage_multiplier = <float>
The bonus to grant. Optional.
str_damage_multiplier = <float>
The bonus to grant. Optional.
war_support_reduction_on_damage = <float>
The bonus to grant. Optional.
cannot_retreat_while_attacking = <float>
The bonus to grant. Optional.
cannot_retreat_while_defending = <float>
The bonus to grant. Optional.
days = <int>
The duration of the buff. Optional.
tooltip = <string>
The tooltip to display for the buff.

add_temporary_buff_to_units = {
    combat_offense = 0.25
    combat_breakthrough = 0.25
    org_damage_multiplier = -1.0
    str_damage_multiplier = 0.25
    war_support_reduction_on_damage = 0.2
    cannot_retreat_while_attacking = 1.0
				
    days = 7
    tooltip = ABILITY_FORCE_ATTACK_TOOLTIP
}
Adds the specified combat buff to the current unit leader.   1.5

Operatives

Name Parameters Examples Description Notes Version Added
add_nationality <tag>
The country to set the nationality to.
add_nationality = GER
Adds the nationality to the current operative.   1.9
capture_operative captured_by = <tag>
By which country to get captured.

ignore_death_chance = <bool>
Whether to ignore the death chance on capture (no by default).

capture_operative = {
    captured_by = POL
    ignore_death_chance = yes
}
Makes the current operative be captured by a specific country. 1.9
force_operative_leader_into_hiding <bool>
force_operative_leader_into_hiding = yes
Forces the current operative into hiding. 1.9
free_operative captured_by = <tag>
The country that captured the operative.
free_operative = { captured_by = POL }
Frees the current operative. 1.9
harm_operative_leader <int>
How much to harm the operative.
harm_operative_leader = 12
Harms the current operative. The value is subject to modifiers. 1.9
kill_operative killed_by = <tag>
The country that'll kill the operative.
kill_operative = { killed_by = POL }
Kills the current operative. 1.9
turn_operative turned_by = <tag>
The country to which the operative defects.
turn_operative = {
    turned_by = PREV
}
Turns the current operative against their own country, transferring them to the specified country. This counts as the operative dying and will trigger the corresponding On action. Logs an error if used against your own operative. 1.9
operative_leader_event id = <event>
The event to fire.

days = <int> / <variable>
Fires the event in the specified number of days. Optional.
hours = <int> / <variable>
Fires the event in the specified number of hours. Optional.
random = <int> / <variable>
Adds a random number (between 0 and random, inclusive) of hours to the scheduled fire time. Optional.
random_days = <int> / <variable>
Adds a random number (between 0 and random_days, inclusive) of days to the scheduled fire time. Optional.
originator = <tag>
The originator of the event. Optional, defaults to owner of operative.
recipient = <tag>
The recipient of the event. Optional, defaults to owner of operative.
set_from = <tag>
Sets the scope of FROM in scripted localization. Optional.
set_from_from = <tag>
Sets the scope of FROM.FROM in scripted localization. Optional.
set_root = <tag>
Sets the scope of ROOT in scripted localization. Optional.

operative_leader_event = {
    id = my_event.1
	originator = POL
	recipient = GER
    days = 10
    random = 50
    random_days = 10
	set_from = ENG
	set_root = SOV
	set_from_from = FRA
}
Fires the specified event for the operative. Uses a special interface displaying the current operative portrait.

Where triggers do not need to be repeatedly checked random can be a performance light alternative to mean_time_to_happen for scheduling events.

1.9

Other Scopes

The effects here must be used within a scope that's specified within the notes.

Name Parameters Examples Description Notes Version Added
execute_operation_coordinated_strike amount = <int>
How many times the operation will get executed within the days set in the operation.
execute_operation_coordinated_strike = {
    amount = 12
}
All prepared Port Strike and Strategic Bombing in the target region will execute multiple times without air defence being able to intercept them. Can only be used within operations. 1.9

Flow Control

These scopes are used within effect scopes to control the execution of effects.

If, Else If and Else

These scopes allow effects to be conditionalized, so they only occur when the requisite triggers are met.

For example, if you only have an effect to occur for Germany, you'd do the following:

if = {
    limit = {
        original_tag = GER
    }   
    add_stability = 0.1
}

If you then wanted England to have a similar effect, and everyone else to have something else, you do the following:

if = {
    limit = {
        original_tag = GER
    }   
    add_stability = 0.1
}
else_if = {
    limit = {
        original_tag = ENG
    }
    add_stability = 0.25
}
else = {
    add_stability = 0.05
}

As you can see, this allows for flexibility in how effects occur and cuts down on duplication.

Hidden Effect

This scope hides the presence of the effects within it in the player's tooltip. This is used to execute effects without the player seeing them. For example, you may want to manipulate some variables in an event. Showing them to the player may confuse them, so it is best to hide the effects within an hidden effect scope, like so:

hidden_effect = {
    set_variable = { my_var = 100 }
}

Random List

This scope allows the creation of a random selection of effects. For example, if you wanted an effect to randomly given the player one out of four bonuses, you'd do the following:

random_list = {
    25 = {
        add_stability = 0.5
    }
    25 = {
        add_manpower = 10000
    }
    25 = {
        add_war_support = 0.5
    }
    25 = {
        army_experience = 100
    }
}

Note that if you want to create a repeatable decision including a random list, by default the same decision will pick the same random result every time it is triggered in a game. You can reverse this behaviour by including the following line in the decision block:

fixed_random_seed = no

Events, focuses, on actions, scripted GUI and et cetera do not have that argument, but it's set to false by default inside of them, so there's no need to put it there, only in decisions.
It is also possible to use modifiers to affect the weight of each possible random effect.

random_list = {
    25 = {
        add_stability = 0.5
        modifier = {
            factor = 1.3
            has_country_flag = inward_perfect_flag
        }
    }
    25 = {
        add_manpower = 10000
    }
    25 = {
        add_war_support = 0.5
    }
    25 = {
        army_experience = 100
    }
}

The above code would multiply the 25 by the factor thereby making it more or less likely to occur if the trigger condition is fulfilled.

Effect Tooltip

This scope will display the tooltip information of the effects within, without actually executing the effects. This is useful when you want to show what the effect may look like to the player. Here is an example:

effect_tooltip = {
    every_owned_state = {
        add_manpower = 10000
    }
}

Meta-Effects

Meta-effects allow you to use non-dynamic effects (the ones that do not accept modifiers and can only use static tokens or constant values) as if they were accepting variables.

add_equipment_to_stockpile = {
    type = infantry_equipment_2
    amount = eq_amount
}

In the effect shown above, amount of equipment added is dynamic and can be set using the variable "eq_amount". However, this effect does not let you use a variable as equipment type. You can not store "infantry_equipment_2" in a variable and use it here.

However, meta-effects will let you use variables and scripted localization within them to build effects as if they were texts and run them. Let's make previous effect accept equipment type and equipment level as variables stored in "eq_type" and "eq_level".

set_variable = { eq_type = 1 } # Sets the equipment type to "1", which determines the equipment given using scripted localisation, included below
set_variable = { eq_amount = 10 } # Sets the amount of equipment given to 10
set_variable = { eq_level = 2 } # Sets the equipment level to 2, which is used directly in the meta-effect, no scripted localisation required

meta_effect = { # The actual meta-effect. This can go anywhere you need it: in a decision, in a scripted effect, in a scripted GUI click effect, etc...
    text = {
        add_equipment_to_stockpile = {
            type = [EQ_TYPE]_[EQ_LEVEL]
            amount = eq_amount
        }
    }
    EQ_LEVEL = "[?eq_level|.0]" # Gets the "eq_level" variable and saves it as "EQ_LEVEL" for the meta-effect to use
    EQ_TYPE = "[This.GetEquipmentName]" # Gets the equipment type from scripted localisation, included below, based on the "eq_type" variable, and saves it as "EQ_TYPE" for the meta-effect to use
}
# The scripted localization for the "eq_type" variable, which goes in a scripted localisation file
defined_text = { # Since the "eq_type" variable in this example is equal to 1, the equipment given by the effect is "artillery_equipment"
    name = GetEquipmentName
    text = {
        trigger = {
            check_variable = { eq_type = 0 }
        }
        localization_key = "infantry_equipment"
    }
    text = {
        trigger = {
            check_variable = { eq_type = 1 }
        }
        localization_key = "artillery_equipment"
    }
}

As you can see, we have created a meta_effect that takes two arguments. These arguments will be used replacing the parameters [EQ_TYPE] and [EQ_LEVEL] inside the meta effect. EQ_LEVEL will be replaced by [?eq_level|.0] which is the integer value of eq_level (in this case 2.000 becomes 2). EQ_TYPE is a bit more complicated, it is being replaced by a scripted localization. This scripted localization will check eq_type variable and depending on its value it will return the key token for the equipment. If it is 0, it will return "infantry_equipment". If it is 1, it will return "artillery_equipment".

So the final result is [EQ_TYPE] is being replaced by "artillery_equipment" and [EQ_LEVEL] is being replaced by "2" and in the end our effect will be built as:

add_equipment_to_stockpile = {
    type = artillery_equipment_2
    amount = eq_amount
}

which will give you 10 artillery_equipment_2.

Scripted effects

Scripted effects serve a similar purpose to functions in that they can be defined in /Hearts of Iron IV/common/scripted_effects/*.txt and then used elsewhere as a shortened version. Alongside that, the game allows the creation of custom console commands, which are scripted effects.

A scripted effect is defined simply as

scripted_effect_name = {
	<effects>
}

This example can be used as an effect in regular code as scripted_effect_name = yes.

To create a custom console command, the scripted effect's name should begin with d_. The console command itself does not include d_, so d_test_command would be run in console as test_command
In custom console commands, the country running the command is FROM, while ROOT is the selected country, state, or unit leader. Anything entered after the console command, separated by spaces like test_command 123 321 GER is added to the 'args' temp array. An example of a scripted effect which will transfer every state entered as an argument to the country that runs the console command is

d_transfer_states = {
	for_each_scope_loop = {
		array = args
		FROM = {
			transfer_state = PREV
		}
	}
}

used like transfer_states 123 321