Different levels of the autonomy system are defined in /Hearts of Iron IV/common/autonomous_states/*.txt, and new ones can be created.
Arguments
- 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, calculated by the difference between freedom levels multiplied by 5000. As such, it would take 500 points to go from an autonomous state with the min_freedom_level of 0.1 to being annexed.
- manpower_influence decides how large of a portion of the subject's manpower the overlord can use in colonial divisions. Requires the 共赴胜利 DLC.
- rule sets the game rules for the subject to either yes or no.
Game rule list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The following game rules exist as possible options:
|
- 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 sets the necessary triggers the subject must meet to be able to gain a level through the autonomy system.
- can_lose_level sets the necessary triggers the subject must meet for the overlord to be able to decrease the autonomy level through the autonomy system.
- peace_conference_initial_freedom is the initial freedom level of the country that gets set to this autonomy after a peace conference on a scale from 0 to 1. If not specified, assumed to be 0.5.
- allowed_levels_filter decides which autonomy levels a country with this autonomous state can change to, alongside autonomy_free. If not specified, all levels will be allowed.
Icon
General sprite overview |
---|
For loading GFX, the game uses the sprite system. Sprites are code definitions that attach a name to an image file, as well as optionally adding additional information, such as animation, the amount of frames, the way that the image will be loaded, and so on. This means placing an image into the gfx folder isn't enough for it to work, a sprite has to use that image file as well.
Sprites are defined in any /Hearts of Iron IV/interface/*.gfx file (this is separate from gfx/interface/), opened with a text editor. To create a new .gfx file, a text file can be created and renamed to change the extension (on Windows, the Windows Explorer needs to show the extensions, which it doesn't by default). In particular, sprites are defined within a spriteTypes = { spriteType = { name = GFX_first_sprite # In some cases, beginning with GFX_ is mandatory for it to work. texturefile = gfx/interface/folder/filename.dds # The folder and filename don't matter, as long as they are correct } # Only the forward slash '/' (can be doubled as '//') can be used to separate folders. spriteType = { # The image doesn't have to be .dds, as .tga and .png are acceptable. name = GFX_second_sprite texturefile = gfx/interface/folder2/filename2.dds noOfFrames = 2 # Splits the image into 2 halves, which may be switched between dynamically in GUI } } In this case, this creates a sprite with the name of In order to add animation, a frameAnimatedSpriteType is used. It's never mandatory to copy a base game file to change a sprite. If there are duplicate definitions of a sprite with the same name in different files, the game will prioritise the one that would be evaluated later, based on the filename, and the older sprite will be ignored in entirety. This can be ensured by beginning the replacement file's name with a symbol late in the ASCII character table. Typically the lowercase letter 'z' is used for this purpose. For example, to change the amount of frames in Since most .gfx files define integral parts of the user interface, copying them over can lead to the mod's loaded files missing sprites upon a major game update, which would appear in-game as the default image, which is the error dog by default. As to ease the burden of needing to check the interface files, it's best to never copy over .gfx files, unless more additions would be actively harmful to the mod, such as with interface/subuniticons.gfx |
For the icon, the game will use a sprite named in the format of GFX_<autonomy state>_icon
. An /Hearts of Iron IV/interface/*.gfx file containing such a definition may look like the following:
spriteTypes = { spriteType = { name = "GFX_autonomy_mod_new_icon" textureFile = "gfx/interface/autonomy/autonomy_mod_new_icon.dds" } spriteType = { name = "GFX_example_icon" texturefile = "another_folder/image_name.dds" } }
Localisation
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
autonomy_state = { id = autonomy_example default = yes #Will be a possible option for peace deals is_puppet = yes use_overlord_color = yes min_freedom_level = 0.2 #Puts it as 0.2 on the autonomy level scale, which is the same as an integrated puppet. peace_conference_initial_freedom = 0.9 #Close to independence 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 } } allowed_levels_filter = { autonomy_example autonomy_example_1 autonomy_example_2 } 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
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
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 /Hearts of Iron IV/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 = {}
in them or via allowed_levels_filter = {}
in the new autonomies. Note that if you choose the second option, you would still need to disable the default autonomies so that they do not appear while puppeting.
If a new autonomy level should only be possible to be manually assigned via the set_autonomy
effect, then it's possible to set up allowed as such, using the autonomy state with the id of autonomy_my_state
:
allowed = { OR = { is_subject = no has_autonomy_state = autonomy_my_state } }
That makes the autonomy state impossible to achieve through gaining or losing levels, as the allowed
block is false if the subject has any other autonomy. This will ensure that set_autonomy
will be possible to execute, as long as the target country is independent at the time, and that it wouldn't get cleared after being assigned, while it has that autonomy state.
When creating autonomy systems, avoid 2 different states having the same min_freedom_level.
文件 | 效果 • 条件 • 定义 • 修正 • 修正列表 • 作用域 • 本地化 • on action • 数据结构 (标记, 临时标记, 国家别名, 变量, 数组) |
脚本 | 成就修改 • AI修改 • AI focuses • 自治领修改 • 权力平衡修改 • 剧本/标签 (游戏规则)• 建筑修改 • 人物修改 • 修饰性TAG修改 • 国家创建 • 军队修改 • 决议制作 • 装备修改 • 事件修改 • Idea修改 • 意识形态修改 • 军工商修改 • 国策制作 • 资源修改 • Scripted GUI • 科技制作 • 单位修改 |
地图 | 地图 • 省份 • 补给区域 • 战略区域 |
图形图像 | 界面 • 图形资产 • 实体模型 • 后期特效 • 离子效果 • 字体 |
装饰性 | 肖像 • 命名列表 • 音乐 • 音效 |
其他 | 控制台指令 • 故障排除 • 模组结构 • 成就代码分析 • Mod相关 • Nudger修改 |