指令

本页面所适用的版本可能已经过时,最后更新于1.10
Immortalwyy讨论 | 贡献2022年8月29日 (一) 21:10的版本 →‎整体

效果Effects),也叫指令Commands),用于在特定作用域内动态地影响游戏。

效果在整局游戏中作用于不同的作用域,最常见的是国策事件以及决议.

有关变量效果的信息,参见变量

注意某些效果可能会需要变量的值,例如:

add_manpower = var:my_var.

This is noted by <variable> in an effect's parameters.

在博斯普鲁斯之战DLC中添加的新效果

名字 参数 示例 描述 注释 添加

版本

add_victory_points 给一个省份增加胜利点
add_victory_points = {
    province = (省份id)
    value = (数量)    
}
给一个省份增加胜利点 接受负值 1.10
set_victory_points 设置一个省份的胜利点
set_victory_points = {
    province = (省份id)
    value = (数量)    
}
设置一个省份的胜利点 接受负值 1.10

在抵抗组织DLC(La Resistance)中添加的新效果(Effect)

名字 参数 示例 描述 注释 添加

版本

create_intelligence_agency 可以自动建立一个情报机构 create_intelligence_agency = yes 建立一个情报机构   1.9
upgrade_intelligence_agency 可以自动解锁一项情报机构升级 upgrade_intelligence_agency = upgrade_form_department upgrade_intelligence_agency = <情报机构升级名称> 解锁一项情报机构升级 情报机构升级项目可以在目录 common/intelligence_agency_upgrades 中被找到 1.9
kill_ideology_leader 可以杀死一个属于一个准确的意识形态的国家领导人 kill_ideology_leader = communism kill_ideology_leader = <意识形态名称>(democratic,facism,communism) 杀死当前作用域的指定意识形态领导人   1.9
transfer_units_fraction 可以精确地将一个国家的一部分军队和装备转移到任何国家。 transfer_units_fraction= {
    target = SPD(SPD是一个国家的标识tag)
    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
   }
}
将一定的装备、海军、空军和陆军按照特定的比例转移到一个国家。 军队将领可以使用 keep_unit_leaders_trigger = {保留 1.9

在炮手就位DLC(Man the Guns)添加的新效果(Effect)

名字 参数 示例 描述 注释 添加

版本

remove_decision 可以在不使用 remove_effect 语句下移除特定的决议 remove_decision = GER_MEPO 移除一项决议   1.6
swap_ruler_traits 与 swap_ideas 类似. 移除一个技能/特质(trait)然后添加另外一个.(trait指的是国家领导人身上的技能) swap_ruler_traits = { remove = <要移除的技能> add = <要添加的技能> } 更换技能   1.6

remove_exile_tag

移除一个军队将领的流亡标识(tag), 让他不再被判定为流亡将领 remove_exile_tag = { USA = "Arturo Rawson" } 移除一个Leader的流亡标识   1.6
add_legitimacy 给一个流亡政府增加政权合法性 add_legitimacy = 10 增加政权合法性   1.6

set_legitimacy

设定流亡政府政权合法性 set_legitimacy= { POL = 1.0 } 设定政权合法性   1.6
become_exiled_in 使一个国家成为一个在既定国家的流亡政府,具有既定的合法性。 become_exiled_in = { target = <既定国家(在哪里流亡)> legitimacy = <0-1> (预设的合法性) } 创建一个流亡政府 必须在 ROOT(不懂参见作用域)下使用, 需要成为流亡政府的国家,或者一个特定的tag 1.6
end_exile 结束流亡政府 end_exile 结束流亡政府   1.6
add_province_modifier 增加省份修正 add_province_modifier = { 5246 = mud } 增加一个省份修正(天气) 新的省份修正可以在"weather.txt"文件中创建. 1.6
remove_province_modifier 移除一个省份修正(天气) remove_province_modifier = { 5246 = mud } 移除一个省份修正 新的省份修正可以在"weather.txt"文件中创建. 1.6
set_faction_name 设置阵营名字(本地化名字,即需要本地化(localize),写入本地化文件) set_faction_name = SOME_LOC_KEY 改变阵营名字   1.6
add_nuclear_bombs 给一个特定国家增加指定数量的核弹 add_nuclear_bombs = 100 给一个特定国家增加指定数量的核弹 需要事先研究核弹科技 1.6
launch_nuke 核爆一个特定省份

launch_nuke = {
    province = 42
    state = 42
    controller = GER
    use_nuke = yes
}

核爆一个省份

当仅提供地区参数的时候,敌人占领的省份优先核平

需要核弹科技和核弹库存,使用的时候从库存里面删除一个核弹 1.6
inherit_technology 转移一个国家的所有科技到另外一个国家 inherit_technology = CAN 转移科技 在内战的时候很有用. 作用域国家会继承Tag标识国家的所有科技,所以要小心作用域的问题 1.6
set_fuel_ratio 设定一个国家的燃油存量(倍数) set_fuel_ratio 设置国家目前的燃料比。   1.6
add_mines 为当前国家在一个战略区域布雷 add_mines = { region = 42 amount = 100 } 在一个战略区域布雷  

1.6

give_resource_rights 给予资源使用权 give_resource_rights = { receiver = ENG state = 291 } 把一个省份的所有资源给予目标国家使用 参见 04_mtg_on_actions 1.6
remove_resource_rights 剥夺资源使用权 ENG = { remove_resource_rights = 477 } 剥夺先前给予的资源使用权   1.6

任意作用域

能在“国家”、“省份”或者“将领”这些作用域使用

全局

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 定义一个全球Flag 1.0
clr_global_flag <flag>
The unique string of a global flag to clear.
clr_global_flag = my_flag 清除一个全球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
}
修改一个全球Flag 推荐使用 变量 1.0
custom_effect_tooltip <string>
作为提示文字的本地化文本
custom_effect_tooltip = my_tooltip_tt 在效果提示文字内显示本地化文本 1.0
log <string>
显示在game.log里的文本
log = "myVariable: [?myVariable]" 当运行指令时将这行文本写入game.log 允许所有的本地化命令 (比如[Root.GetName]等) 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 停止执行当前作用域内的指令 1.0
sound_effect <string>
A sound reference from an .asset file.
sound_effect = "boom" Plays the specified sound once. 1.0
randomize_weather <int>
一个随机数种子(整数)
randomize_weather = 12345 以特定的随机数种子随机生成天气 1.0
set_province_name id = <id>
要重命名的胜利点ID

name = <string>
胜利点所要改成的名字

set_province_name = {
    id = 325
    name = "Funland"
}
把某个胜利点的名字改为特定名字 1.3
reset_province_name <id>
要复位的胜利点名字
reset_province_name = 325
重设特定胜利点的名字 1.3
goto_province <id>
要移动到的地块
goto_province = 325
把视角移到特定地块 1.0
goto_state <scope> / <variable>
要移动到的省份
goto_state = 1
goto_state = var:some_state
把视角移到特定省份 1.0
change_tag_from <scope> / <variable>
要切换到的国家.
GER = { change_tag_from = ROOT }
GER = { change_tag_from = var:from.country }
从当前国家切换到目标国家游玩 注意:等号后面的是当前国家,指令前的作用域为目标国家 1.0
add_region_efficiency 1.5

边境冲突

Name Parameters Examples Description Notes Version Added
start_border_war(发起边境冲突) change_state_after_war = <bool>
在边境冲突结束后,该省份是否易手

进攻方作用域
state = <id> / <variable>
发起边境冲突的省份 .
num_provinces = <id>
指定进攻方投入当前省份下的多少地块的部队发起边境冲突 .
on_win = <id>
进攻方胜利所触发的事件 .
on_lose = <id>
进攻方失败所触发的事件 .
on_cancel= <id>
进攻方与对方陷入僵持时所触发的事件

防守方作用域
state = <id> / <variable>
因边境冲突而受到攻击的省份.
num_provinces = <id>
指定防守方投入当前省份下的多少地块的部队发起边境冲突.
on_win = <id>
防守方胜利所触发的事件
on_lose = <id>
防守方失败所触发的事件.
on_cancel= <id>
防守方与对方陷入僵持时所触发的事件
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
    }
}
指定一场边境冲突中的进攻方和防御方,且双方都是冲突区域省份的拥有者   1.5
set_border_war_data attacker = <id> / <variable>
攻击方发起进攻的省份

defender = <id> / <variable>
防守方进行防御的省份
attacker_modifier = <id> / <variable>
应用于进攻方军队的修正
defender_modifier = <id> / <variable>
应用于防守方军队的修正
combat_width = <id> / <variable>
边境冲突的战场宽度

set_border_war_data = {
    attacker = 527
    defender = 408
    defender_modifier = 0.15
    combat_width = 100
}
设置双方的攻守加成或惩罚修正,在发起边境冲突后使用。   1.5
cancel_border_war attacker = <id> / <variable>
攻击方发起进攻的省份

defender = <id> / <variable>
防守方进行防御的省份
dont_fire_events = <bool>
不触发start_border_war中有关的事件

cancel_border_war = {
    dont_fire_events = yes
    defender = 408
    attacker = 527
}
取消当前的边境冲突而且没有胜者   1.5
finalize_border_war attacker = <id> / <variable>
攻击方发起进攻的省份

defender = <id> / <variable>
防守方进行防御的省份
attacker_win = <bool>
让进攻方获胜
defender_win = <bool>
让防守方获胜

finalize_border_war = {
    attacker_win = yes
    attacker = 527
    defender = 408
}
结束一场边境冲突   1.5

国家作用域

下列的指令必须在“国家”作用域使用

整体

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 定义一个国家Flag   1.0
clr_country_flag <flag>
The unique string of a country flag to clear.
clr_country_flag = my_flag 清除一个国家Flag   1.0
modify_country_flag flag = <flag>
要修改的国家Flag

value = <value>
要设置的值,只能是0或1

modify_country_flag = {
    flag = my_flag
    value = 1
}
修改一个国家Flag 推荐使用 变量 1.3
country_event id = <event>
要触发的事件

days = <event> / <variable>
在特定的天数内触发事件(可选)
hours = <event> / <variable>
在特定的小时内触发事件(可选)
random = <event>
Adds a random number (between 0 and random, inclusive) of hours to the scheduled fire time. Optional.

country_event = {
    id = my_event.1
    days = 10
    random = 50
}
对特定国家触发事件 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>
要触发的新闻事件

days = <event> / <variable>
在特定的天数内触发事件(可选)
hours = <event> / <variable>
在特定的天数内触发事件(可选)
random = <event>
Adds a random number (between 0 and random, inclusive) of hours to the scheduled fire time. Optional.

news_event = {
    id = my_event.1
    days = 10
    random = 50
}
对特定国家触发新闻事件 新闻事件和普通事件所显示的界面不同

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(设置显示动态Tag) <string>
设置一个动态Tag以更改旗帜、国名(注意:此代码无法改变国家初始tag,只会更改其显示)
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
}
为当前作用域应用特定的游戏规则 Possible rules:
  • 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
  • units_deployed_to_overlord (subjects only)
1.0
add_dynamic_modifier modifier = <modifier_string>
The name of the Modifier.

scope = <scope>

#optional, specify if it is specified while adding the modifier

add_dynamic_modifier = { modifier = my_modifier } 添加dynamic modifier
remove_dynamic_modifier modifier = <modifier_string>
The name of the Modifier.

scope = <scope>

#optional, specify if it is specified while adding the modifier

remove_dynamic_modifier = { modifier = my_modifier } 移除dynamic modifier
force_update_dynamic_modifier <bool>
Boolean.
force_update_dynamic_modifier = yes 强制刷新dynamic modifier

地区

Name Parameters Examples Description Notes Version Added
add_state_core <scope> / <variable>
添加省份核心
add_state_core = 345
为当前作用域添加省份核心   1.0
remove_state_core <scope> / <variable>
移除省份核心
remove_state_core = 345
移除当前作用域的省份核心   1.0
set_capital <scope> / <variable>
将指定省份设置为首都
set_capital = { state = 562 }
将特定的省份设置为当前作用域的首都   1.0
add_state_claim <scope> / <variable>
对当前省份添加领土宣称
add_state_claim = 345
添加当前作用域对省份的领土宣称   1.0
remove_state_claim <scope> / <variable>
移除当前省份的领土宣称
remove_state_claim = 345
移除当前作用域对省份的领土宣称   1.0
set_state_owner <scope> / <variable>
设置省份的拥有者
set_state_owner = 345
将当前作用域设置为省份的拥有者   1.0
set_state_controller <scope> / <variable>
设置省份的实际控制者
set_state_controller = 345
将当前作用域设置为省份的实际控制者   1.0
transfer_state <scope> / <variable>
改变省份的拥有者和实际控制者
transfer_state = 345
将当前作用域设置为省份的拥有者和实际控制者   1.0
set_province_controller <id>
设置地块的实际控制者
set_province_controller = 2999
将当前作用域设置为地块的实际控制者(仅在战时可用)   1.0

政治力量

Name Parameters Examples Description Notes Version Added
add_political_power <int> / <variable>
数量
add_political_power = 100
add_political_power = var:my_var
为当前作用域增加特定数量的政治点数   1.0
set_political_power <int> / <variable>
数量
set_political_power = 100
为当前作用域设定特定数量的政治点数   1.0
add_stability <int> / <variable>
数量
add_stability = 0.1
为当前作用域增加特定数量的稳定度 稳定度的值在0到1之间 1.5
set_stability <int> / <variable>
The amount to add.
set_stability = 0.5
为当前作用域设定特定数量的稳定度 稳定度的值在0到1之间 1.5
add_war_support <int> / <variable>
The amount to add.
add_war_support = 0.1
为当前作用域增加特定数量的战争支持度 战争支持度的值在0到1之间 1.5
set_war_support <int> / <variable>
The amount to set.
set_war_support = 0.5
为当前作用域设定特定数量的战争支持度 战争支持度的值在0到1之间 1.5
add_command_power <int> / <variable>
The amount to add.
add_command_power = 100
为当前作用域增加特定数量的指挥点数   1.5

政治

Name Parameters Examples Description Notes Version Added
kill_ideology_leader <ideology>
意识形态
kill_ideology_leader = communism
杀死当前作用域下特定意识形态的领袖   1.9
retire_ideology_leader <ideology>
意识形态
retire_ideology_leader = fascism
移除当前作用域下特定意识形态的领袖并使其退休   1.9
kill_country_leader <bool>
Boolean.
kill_country_leader = yes
杀死当前作用域的国家元首   1.0
retire_country_leader <bool>
Boolean.
retire_country_leader = yes
移除当前作用域的国家元首并使其退休   1.0
set_country_leader_ideology <government>
The government to set.
set_country_leader_ideology = socialism
改变国家元首所属的党派(实际上是更改意识形态)   1.0
add_country_leader_trait <trait>
The trait to add.
add_country_leader_trait = nationalist_symbol
为当前作用域的国家元首添加特性 特性参见 /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
移除当前作用域的国家元首的特性 特性参见 /Hearts of Iron IV/common/country_leader/*.txt. 1.0
hold_election <scope>
The country to hold an election for.
hold_election = ROOT
为当前作用域执行在on_new_term_election内的事件(在On Actions文件里)   1.0
add_popularity(更改支持率) ideology = <ideology>
指定需更改支持率的党派意识形态

popularity = <int> / <variable>
该党派支持率变更的具体数值

add_popularity = {
    ideology = fascism
    popularity = -0.5
}
在当前作用域里修改党派的支持率 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 = neutrality
}
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>
指定更改名称的党派

long_name = <string>
指定党派更改名称的全名
name = <string>
指定党派更改名称的简称

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 ideology government the leader belongs to.
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.

1.0

外交

Name Parameters Examples Description Notes Version Added
set_major <bool>
Boolean.
set_major = yes
使当前作用域成为主要国家   1.0
create_faction <string>
派系名称。
create_faction = MY_FACTION_NAME
创建一个在当前作用域的有指定名称的派系(MY_FACTION_NAME)。该作用域范围内及其附属国将自动加入派系。   1.0
add_to_faction <TAG>
国家tag标签。
FACTION_LEADER_TAG = { add_to_faction = TAG_TO_ADD }
FACITON_LEADER_TAG(派系领导者的国家tag标签)

TAG_TO_ADD(需要加入该派系的国家tag标签)

将特定国家(TAG_TO_ADD)加入该派系领导人(FACTION_LEADER_TAG)领导的的派系。   1.0
leave_faction <bool>
Boolean.
leave_faction = yes
离开当前派系。   1.5
remove_from_faction <string>
The name of the faction.
remove_from_faction = MY_FACTION_NAME
Removes the current scope from the specified faction.   1.0
dismantle_faction <bool>
Boolean.
dismantle_faction = yes
Dismantles the faction of the current scope.   1.0
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
release <scope>
The target country.
release = GER
Releases the specified subject or core-only country as a free nation.   1.0
release_puppet <scope>
The target country.
release_puppet = GER
Releases the specified subject or core-only country as a puppet for the current scope.   1.0
give_guarantee <scope>
The target country.
give_guarantee = GER
Makes the current scope guarantee the specified country.   1.0
give_military_access <scope>
The target country.
give_military_access = GER
Makes the specified country grant the current scope military access to their country.   1.0
recall_attache <scope>
The target country with an attache.
recall_attache = GER
Recalls the current scope's attache 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
}
Adds the specified opinion modifier for the current scope towards the specified scope. 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
}
Removes the specified opinion modifier for the current scope towards the specified 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
}
Adds the specified opinion modifier for the specified scope towards the current scope. Opinion modifiers are found in /Hearts of Iron IV/common/opinion_modifiers/*.txt. 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
}
Adds the specified relation modifier for the current scope towards the specified 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
}
Removes the specified relation modifier for the current scope towards the specified scope. Relation modifiers are found in /Hearts of Iron IV/common/modifiers/*.txt. 1.4

附属国

Name Parameters Examples Description Notes Version Added
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_ratio = {
    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 states are found in /Hearts of Iron IV/common/autonomous_states/*.txt. 1.3
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 country and sets the autonomy level for the specified country. The autonomy states are found in /Hearts of Iron IV/common/autonomous_states/*.txt. 1.3

战争

Name Parameters Examples Description Notes Version Added
add_threat <int>
The amount to change by.
add_threat = 10
调整全球紧张度   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.   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.

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>
指定被制造宣战借口的国家

type = <wargoal>
指定制造的宣战借口类型,宣战借口类型在Hearts of Iron IV\common\wargoals\中(可通过该方式自定义宣战借口)
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
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.

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
    }
}
Starts a civil war for the current scope with the specified parameters.   1.0

资源

名字 参数 示例 描述 注释 添加

版本

add_resource type = <resource>
要添加的资源

amount = <int>
要添加资源的数量
state = <id>要添加资源的地区。 可以使用变量

add_resource = {
    type = oil
    amount = 50
    state = 88
}
在特定地区添加特定数量的特定资源   1.0
destroy_resource type = <resource>
要添加的资源

amount = <int>
要添加资源的数量
state = <id>要添加资源的地区。 可以使用变量

destroy_resource = {
    type = oil
    amount = 50
    state = 88
}
在特定地区摧毁特定数量的特定资源   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

建筑

名字 参数 示例 描述 注释 添加

版本

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

国策

名字 参数 示例 描述 注释 添加

版本

load_focus_tree <string>
加载某个指定国策树.
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

决议

名字 参数 示例 描述 注释 添加

版本

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

任务

名字 参数 示例 描述 注释 添加

版本

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_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.   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 to research isn't reset, meaning it can be researched in 1 day. 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

民族精神/内阁

名字 参数 示例 描述 注释 添加

版本

add_ideas <idea>
需添加的民族精神/内阁成员
add_ideas = my_idea
add_ideas = {
    my_idea_1
    my_idea_2
}
将指定民族精神添加到当前作用域。 可以在同效果内添加多个民族精神。 1.0
add_timed_idea idea = <idea>
需添加的民族精神

days = <int> / <variable>
限时存在的天数

add_timed_idea = {
    idea = my_idea
    days = 180
}
在指定作用域添加限时民族精神。   1.0
modify_timed_idea idea = <idea>
需要修改的民族精神

days = <int> / <variable>
需要添加的时间量(天数)

modify_timed_idea = {
    idea = my_idea
    days = 60
}
将限时民族精神的持续时间延长指定量。   1.0
swap_ideas add_idea = <idea>
需添加的民族精神

remove_idea = <idea>
需移除的民族精神

swap_ideas = {
    remove_idea = my_idea_1
    add_idea = my_idea_2
}
在被添加和移除的民族精神之间显示效果的更改内容和差异。   1.3
remove_ideas <idea>
需移除的民族精神
remove_ideas = my_idea
remove_ideas = {
    my_idea_1
    my_idea_2
}
将指定民族精神移除出当前作用域。 可以在同效果内移除多个民族精神。. 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>
需要展示的民族精神
show_ideas_tooltip = my_idea
在当前作用域中显示指定的民族精神,注意,这个效果并不添加民族精神。   1.0

单位

Name Parameters Examples Description Notes Version Added
load_oob(生成单位) <oob>
引入生成单位的指定文件,并通过该文件生成单位(生成单位的指定文件应放置于history\units文件夹中)
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_template = {
    name = "Test"
    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
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.
 ENG = { delete_unit = { 
            state = 787             
             disband = yes #will refund equipment and manpower
              }}
Deletes all units within the specified state using the country scope.   1.5

装备

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 now 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>
The amount to add.
producer = <scope>
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
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.

create_production_license = {
    target = HUN
    equipment = {
        type = fighter_equipment_1
    }
    cost_factor = 0
}
Grants the specified country a licensed 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

陆军

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

海军

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.<br target = <scope>
The target country.

prefer_name = <string>
The new name for the ships in the target country. 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

空军

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
}
为当前范围设置 AI 策略. 有关更多详细信息,请参阅 AI Modding 1.0

地区作用域

The effects here must be used within a state scope.

整体

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

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

state_event = {
    id = my_event.1
    days = 10
    random = 50
    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.   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. 1.3
add_dynamic_modifier modifier = <modifier_string>
The name of the Modifier.
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

建筑

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

部队将领作用域

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

整体

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

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

unit_leader_event = {
    id = my_event.1
    days = 10
    random = 50
}
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 <id>
The id of the unit leader.
remove_unit_leader = 70
Removes the specified unit leader by their id.   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_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

战斗

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>
The skill to add.
add_logistics = 1
Adds logistics skill to the current unit leader.   1.5
add_planning <int>
The skill to add.
add_planning = 1
Adds planning skill to the current unit leader.   1.5
add_defense <int>
The skill to add.
add_defense = 1
Adds defense skill to the current unit leader.   1.5
add_attack <int>
The skill to add.
add_attack = 1
Adds attack skill to the current unit 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
boost_planning <float>
The amount to add.
boost_planning = 1
Improves the planning of units controlled by the current unit leader.   1.5

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.

隐藏效果

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

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
    }
}