Autonomy State Modding

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

Different levels of the autonomy system are defined in /Hearts of Iron IV/common/autonomous_states/*.txt, and new ones can be created. The autonomy system requires the Together for VictoryTogether for Victory DLC to work in-game.

Arguments[edit]

  • id is the ID of the autonomy state, unique to each one. It is necessary to define to distinguish it from other autonomy states.
  • default If true, the game will attempt to make the 'puppet' option in peace deals as well as the 'puppet' effect use this autonomy state among other default autonomy states. By default, set to no.
  • is_puppet decides whether the subject is a puppet or not, making is_puppet and is_puppet_of triggers true in that case. By default, set to no.
  • use_overlord_color makes the subject have the same country color as the overlord.
  • min_freedom_level decides the order in which autonomy states are placed. The autonomy states with lower freedom levels have less autonomy than those with higher when the game places the autonomy states for the subject to lose or gain a level. This also decides how many autonomy points the subject needs to gain or lose a level.
  • manpower_influence decides how large of a portion of the subject's manpower the overlord can use in colonial divisions. Requires the Together for VictoryTogether for Victory DLC.
  • rule set the rules for the subject. Allowed game rules are can_be_called_to_war, can_boost_other_ideologies, can_create_factions, can_declare_war_on_same_ideology, can_declare_war_without_wargoal_when_in_war, can_decline_call_to_war, can_force_government, can_generate_female_aces, can_guarantee_other_ideologies, can_join_factions, can_join_factions_not_allowed_diplomacy, can_join_opposite_factions, can_lower_tension, can_not_declare_war, can_occupy_non_war, can_only_justify_war_on_threat_country, can_use_kamikaze_pilots, and units_deployed_to_overlord. The rules can be set to either yes or no.
  • modifier sets the modifier for the subject. All country modifiers can apply.
  • ai_subject_wants_higher decides whether or not the AI subject focuses on gaining a higher autonomy. If set to 0, AI will never gain an autonomy level through the autonomy system.
  • ai_overlord_wants_lower decides whether or not the AI overlord focuses on gaining a lower autonomy for the subject. If set to 0, AI will never decrease the autonomy level through the autonomy system.
  • ai_overlord_wants_garrison decides the triggers when the AI overlord garrisons the subject's territory as if it was their own land.
  • allowed are the necessary triggers the subject must meet for the autonomy state to apply. The OVERLORD scope can be used to scope into the overlord.
  • use_for_peace_conference_weight decides the chance for a potential overlord to puppet the country in the peace deal, where ROOT is the subject and FROM is the overlord.
  • can_take_level re the necessary triggers the subject must meet to be able to gain a level through the autonomy system.
  • can_lose_level re the necessary triggers the subject must meet for the overlord to be able to decrease the autonomy level through the autonomy system.

Icon[edit]

The icons are set in the .gfx files in the interface/ folder. Using an autonomy state with the id of autonomy_mod_new as an example, an icon definition will look like

	spriteType = {
		name = "GFX_autonomy_mod_new_icon"
		textureFile = "gfx/interface/autonomy/autonomy_mod_new_icon.dds"
	}

Localisation[edit]

The localisation is set in an .yml file in the localisation/ folder. Using the prior example of autonomy_mod_new, a localisation entry will look like autonomy_mod_new:0 "Mod's new autonomy state"

It is possible to set a country-specific entry. An entry with GER_autonomy_mod_new:0 "New mod Germany" will make Germany have that name if its autonomy level is autonomy_mod_new. Similarly, ENG_FRA_autonomy_mod_new:0 "New mod French UK" will make the United Kingdom have that name if its overlord is France and the autonomy state is autonomy_mod_new.

Example[edit]

autonomy_state = {
	id = autonomy_collaboration_government
	
	default = yes
	is_puppet = yes
	
	use_overlord_color = yes
	
	min_freedom_level = 0.2
	
	manpower_influence = 0.9
	
	rule = {
		can_not_declare_war = yes
		can_decline_call_to_war = no
		units_deployed_to_overlord = yes
		can_be_spymaster = no
		contributes_operatives = no
		can_create_collaboration_government = no
	}
	
	modifier = {
		autonomy_manpower_share = 1.0
		can_master_build_for_us = 1
		extra_trade_to_overlord_factor = 1.0
		overlord_trade_cost_factor = -0.9
		cic_to_overlord_factor = 0.75
		mic_to_overlord_factor = 0.75
		research_sharing_per_country_bonus_factor = -0.5
	}
	
	ai_subject_wants_higher = {
		factor = 0.0
	}
	
	ai_overlord_wants_lower = {
		factor = 0.0
	}

	allowed = {
		has_dlc = "Together for Victory"
		OVERLORD = {
			tag = FRA
		}
	}

	use_for_peace_conference_weight = {
		base = 0
		modifier = {
			add = 10
			FROM = {
				has_wargoal_against = { target = ROOT type = puppet_wargoal_focus }
			}			# Adds 10 to the chance if the overlord has a wargoal to puppet the country.
		}
		modifier = {
			factor = 2
			tag = ENG	# Multiplies the chance by 2 if the subject is UK.	
		}
	}

	can_take_level = {
		OVERLORD = {
			NOT = {
				controls_state = 123
			}	# If the overlord does not control state 123, the subject can gain a level.
		}
	}

	can_lose_level = {
		OVERLORD = {
			controls_state = 123
		}	# If the overlord controls state 123, it can decrease the subject's autonomy level.
	}
}

Related defines[edit]

Certain Defines affect the autonomy system in a certain way. These are:

  • RESOURCE_SENT_AUTONOMY_DAILY_BASE Base autonomy gain from the overlord purchasing the subject's resources through trade.
  • RESOURCE_SENT_AUTONOMY_DAILY_FACTOR Autonomy gain multiplier from the overlord purchasing the subject's resources through trade.
  • WAR_SCORE_AUTONOMY_BASE Base autonomy gain from the subject gaining war score in a war.
  • WAR_SCORE_AUTONOMY_FACTOR Autonomy gain multiplier from the subject gaining war score in a war.
  • LL_TO_OVERLORD_AUTONOMY_DAILY_BASE Base autonomy gain from the subject lend-leasing to the overlord.
  • LL_TO_OVERLORD_AUTONOMY_DAILY_FACTOR Autonomy gain multiplier from the subject lend-leasing to the overlord.
  • LL_TO_PUPPET_AUTONOMY_DAILY_BASE Base autonomy gain from the overlord lend-leasing to the subject. Must be negative in order to lose autonomy.
  • LL_TO_PUPPET_AUTONOMY_DAILY_BASE Autonomy gain multiplier from the overlord lend-leasing to the subject. Must be negative in order to lose autonomy.
  • AUTONOMY_FREEDOM_FROM_CAPITULATE Upon the overlord capitulating, the subject receives a large gain to the autonomy progress.
  • ATTACHE_TO_SUBJECT_EFFECT Base autonomy gain from the overlord sending an attache to the subject. Must be negative in order to lose autonomy.
  • ATTACHE_TO_OVERLORD_EFFECT Base autonomy gain from the subject sending an attache to the overlord.
  • AUTONOMY_LEVEL_CHANGE_PP_COST_BASE The cost in political power to change between autonomy states.
  • AUTONOMY_LEVEL_CHANGE_PP_ANNEX The cost in political power to annex a subject.
  • AUTONOMY_LEVEL_CHANGE_PP_FREE The cost in political power to gain independence as a subject.
  • MAX_SCORE_DIFF_TO_CHANGE_AUTONOMY The maximum difference between the current freedom score and the cap for the next or previous level allowed for changing.
  • MASTER_BUILD_AUTONOMY_FACTOR Autonomy gain multiplier from the overlord building in the subject's states. Must be negative in order to lose autonomy.
  • AUTONOMOUS_TOTAL_SCORE The total amount of autonomy points between the country's annexation and independence.
  • AUTONOMOUS_SPILLOVER The amount that can be saved between levels.

Additional notes[edit]

When setting the autonomy level in the country's history file, it is possible that it will overwrite the party popularities and the ruling party of the subject. In order to prevent that to happening, it is recommended to scope into the overlord as

TAG = {
	if = {
		limit = {
			has_dlc = "Together for Victory"
		}
		set_autonomy = {
			target = TAG2
			autonomy_state = autonomy_mod_new
		}
	}
	else = {
		puppet = TAG2
	}
}

in the subject's history file, also putting it before defining the ruling party and popularities. Alternatively, the order of tags in common/country_tags/ can be changed so that the overlord is defined earlier than the subject.

If deciding to create a new autonomy system similar to Japan's unique autonomies, it is necessary to disable the default autonomy states so that they could not be used via allowed = {}.

When creating autonomy systems, avoid 2 different states having the same min_freedom_level.