Commands

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

What is a Command?[edit]

A command is a one time use effect. It does what it specifies, but not over time unlike Modifiers.

Commands are very useful in doing political actions in the focus tree and in events and have a large amount of different effects.

Commands are used in:

  • National focuses - In the "completion_effect" of the focus commands can be added, with a one time effect.
  • Events - In the "options" of events commands are specified, in the same way as "completion_effect" works in the National Focus trees.
  • Decisions - In 1.5 Cornflakes (When released)

Diplomatic and Political Commands[edit]

Effect Description Example Game Version
add_relation_modifier Adds a static modifier between current scope and target add_relation_modifier = { target = GER modifier = ROM_military_modernization } 1.4
remove_relation_modifier Removes a static modifier between current scope and target remove_relation_modifier = ROM_military_modernization 1.4
add_political_power Adds political power to a country. If negative, removes political power. add_political_power = 50 1.0
add_opinion_modifier Adds an opinion modifier to a country add_opinion_modifier = { target = ENG modifier = tizard_refused } 1.0
remove_opinion_modifier Removes an opinion modifer from a country remove_opinion_modifier = { target = ENG modifier = tizard_refused } 1.0
set_political_party Sets the properties of a political party set_political_party = { ideology = democratic popularity = 0.5 } 1.0
set_politics Changes the politics of a country set_politics = { ruling_party = fascism elections_allowed = no } 1.0
set_political_power Sets political power to a certain value set_political_power = 100 1.0
create_faction Creates a faction with a specified name create_faction = "french_entente_alliance" 1.0
annex_country Annexes a specified country annex_country = { target = EST } 1.0
dismantle_faction Dismantles the faction led by the current country dismantle_faction = yes 1.0
add_to_faction Adds a country to a faction add_to_faction = ITA 1.0
remove_from_faction Removes a country from a faction remove_from_faction = ITA 1.0
give_guarantee Guarantees specified country give_guarantee = POL 1.0
give_military_access Specified country gives military access (bugged tooltip) give_military_access = GER 1.0
declare_war_on Declares war on a specified country declare_war_on = { target = POL type = annex_everything } 1.0
add_national_unity Adds national unity add_national_unity = 0.02 1.0
add_scaled_political_power Adds political power scaled by the difference between ICs of receiver and another country Needs to be tested 1.0
hold_election Holds elections hold_election = TAG 1.0
add_popularity Adds popularity to an ideology add_popularity = { ideology = fascism popularity = 0.1 } 1.0
start_civil_war Starts a civil war with the given ideology start_civil_war = { ideology = fascism size = 0.5 } 1.0
create_wargoal Creates a wargoal create_wargoal = { type = annex_everything target = EST } 1.0
set_national_unity Sets the national unity of a country set_national_unity = 0.80 1.0
add_threat Adds country threat (Only useful for the AI, dont use unless you know what you are doing) add_threat = 2 1.0
add_named_threat Adds country threat (^Same) add_named_threat = { threat = 2 name = germany.4.t } 1.0
set_rule Sets a rule to a country set_rule = { can_create_factions = yes } 1.0
diplomatic_relation Set up diplomatic relations between two countries diplomatic_relation = { country = SOV relation = non_aggression_pact } 1.0
create_import Creates trade between countries create_import = { resource = steel amount = 20 exporter = SWE } 1.0
set_major Makes a country a major set_major = yes 1.0
set_party_name Changes a party name of a country set_party_name = { ideology = democratic long_name = USA_republican_party name = USA_republican_party } 1.0
reverse_add_opinion_modifier Add opinion modifiers to target reverse_add_opinion_modifier = { target = BUL modifier = GER_treaty_of_craiova_other } 1.0
add_to_war Adds country to a war add_to_war = { targeted_alliance = CHI enemy = JAP } 1.0
change_tag_from Changes player to other country change_tag_from = GER 1.0
white_peace Creates a white peace between countries white_peace = ETH 1.0

Puppet and Autonomy Commands[edit]

Effect Description Example Game Version
add_autonomy_ratio Adds autonomy (with custom name) add_autonomy_ratio = { value = 0.1 localization = LOC_STRING_HERE } 1.3
set_autonomy Sets the autonomy level of a target set_autonomy = { target = RAJ autonomy_state = autonomy_free } 1.3
release Releases a specified country from your country release = CRO 1.0
puppet Puppets the specified country puppet = LIB 1.0
release_puppet Releases a specified country release_puppet = LIB 1.0
end_puppet Ends puppetry over the specified country. Use this if you want to release a already existing puppet. end_puppet = CRO 1.0

Leader Commands[edit]

Effect Description Example Game Version
create_country_leader Creates a country leader (head of state) create_country_leader = { name = "Peter II" desc = "POLITICS_PETER_II_DESC" picture = "Portrait_Yugoslavia_Peter_II.dds" expire = "1965.1.1" ideology = despotism traits = { } } 1.0
set_country_leader_ideology Changes the ideology of the current country leader Needs to be tested 1.0
add_country_leader_trait Add a trait to the current country leader add_country_leader_trait = warmonger 1.0
remove_country_leader_trait Removes a trait from the current country leader remove_country_leader_trait = stout_defender 1.0
create_navy_leader Creates a naval leader for a country create_navy_leader = { name = "Boaty McBoatface" gfx = "GFX_BoatfacesFace" traits = { } skill = 3 } 1.0
create_field_marshal Creates a field marshal create_field_marshal = { name = "Dude McCoolDude" picture = "GFX_CoolDudesFace.dds" traits = { } skill = 3 } 1.0
create_corps_commander Creates a corps commander create_corps_commander = { name = "Dude McCoolDude" picture = "GFX_CoolDudesFace.dds" traits = { } skill = 3 } 1.0
remove_unit_leader_trait Removes a trait from a unit leader Needs to be tested 1.0
add_unit_leader_trait Add a trait to a unit leader Needs to be tested 1.0
keep_unit_leaders Flags unit leaders to be kept during a civil war. keep_unit_leaders = { UNIT_LEADER_ID } 1.0
remove_unit_leader Removes a unit leader remove_unit_leader = leader_id 1.0
retire_country_leader Removes a country leader and replaces him with another candidate from the same party retire_country_leader = yes 1.0
kill_country_leader Removes a country leader completely kill_country_leader = yes 1.0

Army Commands[edit]

Effect Description Example Game Version
add_manpower Adds manpower to a state or country add_manpower = 8000 1.0
create_unit Creates a new unit create_unit = { division = name = "COOL_NAME" division_template = "COOL_TEMPLATE" starting_experience_factor = 1.0 } 1.3
division_template Adds a division template to a country division_template = { name = "Cool Name" regiments = { infantry = { x = 0 y = 0 } infantry = { x = 1 y = 0 } } } 1.0
load_oob Loads an OOB file load_oob = SOV_reinforcements 1.0
army_experience Adds army experience army_experience = 10 1.0
navy_experience Adds navy experience navy_experience = 10 1.0
air_experience Adds air experience air_experience = 10 1.0

Equipment Commands[edit]

Effect Description Example Game Version
create_equipment_variant Creates a new equipment 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 }} 1.0
add_equipment_production Add equipment production add_equipment_production = { equipment = { type = light_cruiser_1 creator = "ITA" version_name = "Montecuccoli Class" } requested_factories = 1 progress = 0.95 amount = 1 } 1.0
add_ace Adds an air ace add_ace = { name = "Amelia" surname = "Earhart" callsign = "Revenant" type = fighter_genius is_female = yes } 1.0
add_equipment_to_stockpile Adds equipment to stockpile of the country in question add_equipment_to_stockpile = { type = convoy_1 amount = 50 producer = <TAG> } 1.0
send_equipment Sends equipment to a country send_equipment = { target = FIN type = infantry_equipment amount = 500 } 1.0
set_equipment_fraction Gives a fraction of your equipment to another country set_equipment_fraction = 0.35 1.0
create_production_license Creates production license create_production_license = { target = HUN cost_factor = 1.0 equipment = { type = light_tank_equipment_2 version = 0 } 1.4
transfer_ship Transfer of the ship to another country ENG = { transfer_ship = { prefer_name = "HMS Achilles" type = light_cruiser target = NZL } 1.4

National Focus Commands[edit]

Effect Description Example Game Version
unlock_national_focus Unlocks a national focus for a country unlock_national_focus = focus_id 1.0
complete_national_focus Completes a national focus complete_national_focus = focus_id 1.0

Ideas Commands[edit]

Effect Description Example Game Version
add_ideas Adds idea(s) to a country add_ideas = ENG_king_edward 1.0
add_timed_idea Adds a time limited idea to a country add_timed_idea = { idea = idea_id days = 50 } 1.0
swap_ideas Swaps two ideas, showing the difference swap_ideas = { remove_idea = REM_IDEA_ID add_idea = ADD_IDEA_ID } 1.3
remove_ideas Removes idea(s) from a country remove_ideas = ENG_king_edward 1.0
remove_ideas_with_trait Removes ideas with specific traits remove_ideas_with_trait = motorized_equipment_manufacturer 1.0

Event Commands[edit]

Effect Description Example Game Version
country_event Fires an event country_event = { days = 1 id = finland.1 } 1.0
state_event Fires a state event state_event = stateevent.1 1.0
news_event Triggers a news event news_event = news_event.251 1.0
save_event_target_as Save an event target as something save_event_target_as = war_target 1.0
save_global_event_target_as Save a global event target as something save_global_event_target_as = war_target 1.0
clear_global_event_target Removes a global event target clear_global_event_target = war_target 1.0
clear_global_event_targets Removes all global event targets clear_global_event_targets = war_target 1.0

Flag Commands[edit]

Effect Description Example Game Version
set_state_flag Sets a state flag 353 = { set_state_flag = test_flag } 1.0
clr_state_flag Removes a state flag 353 = { clr_state_flag = test_flag } 1.0
set_country_flag Sets a country flag set_country_flag = anschluss OR set_country_flag = { flag = GER_drunk_scientists days = 120 value = 1 } 1.0
modify_country_flag Modifies a variable flag modify_country_flag = { flag = GER_drunk_scientists value = 1 } 1.3
clr_country_flag Removes a country flag clr_country_flag = anschluss 1.0
set_global_flag Sets a global flag set_global_flag = spanish_civil_war 1.0
clr_global_flag Removes a global flag clr_global_flag = spanish_civil_war 1.0

State and Province Commands[edit]

Effect Description Example Game Version
set_state_name Changes the name of a state 32 = { set_state_name = "Funland" } 1.3
reset_state_name Resets state name to original 32 = { reset_state_name = yes } 1.3
set_province_name Changes the name of a province set_province_name = { id = 325 name = "Funville" } 1.3
reset_province_name Resets province name to original reset_province_name = 325 1.3
add_state_core Adds cores on a specified state add_state_core = 345 1.0
remove_state_core Removes cores from a state remove_state_core = 345 1.0
set_capital Moves capital to specified state set_capital = 345 1.0
add_state_claim Add claims on a state add_state_claim = 363 1.0
remove_state_claim Removes claims on a state remove_state_claim = 363 1.0
set_state_owner Sets the owner of a state USA = { set_state_owner = 353 } 1.0
set_state_controller Sets the controller of a state USA = { set_state_controller = 353 } 1.0
transfer_state Sets the owner and controller of a state USA = { transfer_state = 353 } 1.0
add_claim_by Add state claim by a country any_owned_state = { add_claim_by = SOV } 1.0
remove_claim_by Removes state claim from a country any_owned_state = { remove_claim_by = SOV } 1.0
add_core_of Adds cores of a country to a state any_owned_state = { add_core_of = SOV } 1.0
remove_core_of Removes cores of a country from a state any_owned_state = { remove_core_of = SOV } 1.0
set_demilitarized_zone Sets a state as a demilitarized zone any_owned_state = { set_demilitarized_zone = yes } 1.0
set_border_war Starts a border war (Do not use unless you know exactly how, works bad. Check China in vanilla.) 605 = { set_border_war = yes } 1.0
set_province_controller Set controller of a province TAG = { set_province_controller = province_id } 1.0
goto_province Goes to specified province goto_province = 11302 1.0
goto_state Goes to specified state goto_state = 150 1.0
add_extra_state_shared_building_slots Add extra building slots to a state random_owned_state = { add_extra_state_shared_building_slots = 2 } 1.0

Buildings and Industrial Commands[edit]

Effect Description Example Game Version
set_building_level Sets specific level of a building construction for amount of levels in specified state or province 69 = { set_building_level = { type = bunker level = 3 province = { all_provinces = yes limit_to_border = yes level < 3 } } 1.4
damage_building Damages a building in state damage_building = { type = industrial_complex damage = 0.6 } 1.3
remove_building Removes a specified building from a specified state or province 219 = { remove_building = { type = arms_factory level = 5 } } 1.0
add_building_construction Starts a building construction within a state or a province 18 = { add_building_construction = { type = bunker province = 5291 level = 2 instant_build = yes } } 1.0
add_resource Adds resource production to a state add_resource = { type = oil amount = 8 state = 662 } 1.0

Research Commands[edit]

Effect Description Example Game Version
add_research_slot Adds set number of research slots add_research_slot = 2 1.0
set_research_slots Sets the number of research slots set_research_slots = 4 1.0
add_tech_bonus Adds a limited tech bonus add_tech_bonus = { bonus = 0.5 uses = 2 category = radar_tech } 1.0
add_to_tech_sharing_group Adds a country to a tech sharing group add_to_tech_sharing_group = tizard_mission 1.3
remove_from_tech_sharing_group Removes a country from a tech sharing group remove_from_tech_sharing_group = tizard_mission 1.3
set_technology Set technology level of a country set_technology = { suicide_craft = 1 } 1.0

Miscellaneous Commands[edit]

Effect Description Example Game Version
set_cosmetic_tag Sets a cosmetic TAG for a country set_cosmetic_tag = SAF_SOV_communism 1.3
drop_cosmetic_tag Removes a cosmetic TAG for a country drop_cosmetic_tag = yes 1.3
random Random effect with a probability random = { 50 = { add_political_power = 50 } } 1.0
random_list Chooses an effect randomly from a list based on their probabilities random_list = { 70 = { add_political_power = 200 } 30 = { add_political_power = -100 } } 1.0
sound_effect Plays a sound effect sound_effect = sound_effect_name 1.0
randomize_weather Randomizes weather Needs to be tested 1.0
break Break execution of effects Needs to be tested 1.0
tdebug Adds additional information to tooltips for states and provinces, such as the state ID and province ID. tdebug 1.0

Additional Commands[edit]

Additional commands that can be used with events and national focuses

Command Description Example
limit Defines the limits of a scope any_neighbor_country = { limit = { has_war = yes } }
hidden_trigger Any triggers inside will not be shown as a tooltip hidden_trigger = { ... }
custom_trigger_tooltip Works as a trigger with a custom tooltip custom_trigger_tooltip = { tooltip = my_tooltip ...LIST OF TRIGGERS... }
custom_effect_tooltip Shows a custom tooltip custom_effect_tooltip = nationalists_chosen
hidden_effect Effects not shown in the tooltip hidden_effect = { USA = { country_event = USA.10 } }
if Effects that happen only if conditions defined by limit are met if = { limit = { tag = GER } }
effect_tooltip Shows just the tooltip of the effects effect_tooltip = { ... }
show_ideas_tooltip Show what an idea does show_ideas_tooltip = idea_id

Diplomatic Relations[edit]

Many of these commands have additional options that may not be so obvious. An example is the diplomatic_relations command.

diplomatic_relation = { country = SOV relation = guarantee active = no }

This command, for example, cancels an existing guarantee. It works similarly for most (all?) diplomatic relations defined in the game.

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