Autonomy state模组制作
原页面:Autonomy state modding
Different levels of the autonomy system are defined in /Hearts of Iron IV/common/autonomous_states/*.txt, and new ones can be created.
参数
- id is the ID of the autonomy state, unique to each one. It is necessary to define to distinguish it from other autonomy states.
- 默认: 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[1]. 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.
- rule sets the game rules for the subject to either yes or no.
| 游戏规则列表 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
以下游戏规则作为可选项存在:
|
- modifier sets the modifier for the subject. All country 修正 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.
图标
| Sprite 通用概览 |
|---|
| 为了加载 GFX,游戏使用 sprite 系统。sprite 是一种代码定义,它把一个名称附加到一个图像文件上,并且可以选择性地添加额外信息,例如动画、帧数、图像的加载方式等等。这意味着 把图像放进 gfx 文件夹并不足以让它生效,一个 sprite 也必须使用该图像文件。 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 要修改某个 sprite,从来都不是必须复制基础游戏文件。如果在不同文件中对同名 sprite 存在重复定义,游戏将优先使用稍后根据文件名求值的那个,较旧的 sprite 会被完全忽略。可以通过把替换文件名的首字符设为 ASCII 字符表中较靠后的符号来确保这一点。通常为此使用小写字母 'z'。例如,要把 |
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"
}
}
本地化文件
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.
示例
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 定义文件 affect the autonomy system in a certain way. These are:
- RESOURCE_SENT_AUTONOMY_DAILY_BASE (0) Base autonomy gain from the overlord purchasing the subject's resources through trade.
- RESOURCE_SENT_AUTONOMY_DAILY_FACTOR (0.005) Autonomy gain multiplier from the overlord purchasing the subject's resources through trade.
- WAR_SCORE_AUTONOMY_BASE (0) Base autonomy gain from the subject gaining war score in a war.
- WAR_SCORE_AUTONOMY_FACTOR (0.6) Autonomy gain multiplier from the subject gaining war score in a war.
- LL_TO_OVERLORD_AUTONOMY_DAILY_BASE (0) Base autonomy gain from the subject lend-leasing to the overlord.
- LL_TO_OVERLORD_AUTONOMY_DAILY_FACTOR (0.05) Autonomy gain multiplier from the subject lend-leasing to the overlord.
- LL_TO_PUPPET_AUTONOMY_DAILY_BASE (0) Base autonomy gain from the overlord lend-leasing to the subject. Must be negative in order to lose autonomy.
- LL_TO_PUPPET_AUTONOMY_DAILY_FACTOR (-0.01) Autonomy gain multiplier from the overlord lend-leasing to the subject. Must be negative in order to lose autonomy.
- AUTONOMY_FREEDOM_FROM_CAPITULATE (0.5) Upon the overlord capitulating, the subject receives a large gain to the autonomy progress.
- ATTACHE_TO_SUBJECT_EFFECT (-0.05) Base autonomy gain from the overlord sending an attache to the subject. Must be negative in order to lose autonomy.
- ATTACHE_TO_OVERLORD_EFFECT (0.05) Base autonomy gain from the subject sending an attache to the overlord.
- AUTONOMY_LEVEL_CHANGE_PP_COST_BASE (50) The cost in political power to change between autonomy states.
- AUTONOMY_LEVEL_CHANGE_PP_ANNEX (300) The cost in political power to annex a subject.
- AUTONOMY_LEVEL_CHANGE_PP_FREE (300) The cost in political power to gain independence as a subject.
- MAX_SCORE_DIFF_TO_CHANGE_AUTONOMY (10) The maximum difference between the current freedom score and the cap for the next or previous level allowed for changing.
- MASTER_BUILD_AUTONOMY_FACTOR (-0.7) Autonomy gain multiplier from the overlord building in the subject's states. Must be negative in order to lose autonomy.
- AUTONOMOUS_TOTAL_SCORE (5000) The total amount of autonomy points between the country's annexation and independence.
- AUTONOMOUS_SPILLOVER (0.025) The amount that can be saved between levels.
补充说明
For a country to start the game as a subject, this can be done using the set_autonomy effect in the history files. When doing this, it is preferable to do it in the subject's history file scoping to the overlord's tag, as shown below.
TAG = {
set_autonomy = {
target = TAG2
autonomy_state = autonomy_mod_new
}
}
Autonomy effects are known to overwrite the political setup of a country, both in terms of leaders, ruling party and popularities. Therefore it has to be placed in the lines before recruiting characters and defining politics. Setting the autonomy level in the overlord's history file is one of the main sources of issues of ideologies being incorrect, due to the overwriting political definitions for the same reason. This happens due to the loading order, but it is not recommended to make changes to the countries' loading order for this purpose.
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.
参考资料
| 文档 | 效果 • 触发器 • 定义文件 • 修正项 • 修正项列表 • 作用域 • 本地化文件 • 事件钩子 • 数据结构(标记、事件目标、国家标签别名、变量、数组) |
| 脚本 | 成就 • AI • AI 焦点 • 自治领 • 力量均势 • 书签/剧本 (游戏规则) • 建筑 • 角色与特质 • 外观标签 • 国家 • 师 • 决议 • 学说 • 装备 • 事件 • 阵营 • 理念 • 意识形态 • 军事工业组织 • 国策 • 资源 • 脚本化 GUI • 科技与学说 • 单位 |
| 地图 | 地图 • 州 • 补给区域 • 战略区域 |
| 图形 | 界面 • 图形资源 • 实体 • 后期特效 • 粒子 • 字体 |
| 外观 | 肖像 • 名称列表 • 音乐 • 音效 |
| 其他 | 控制台指令 • 疑难排查 • 模组结构 • 模组 • 地图编辑器 |