指令:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.13
→‎陆军
无编辑摘要
 
(未显示4个用户的4个中间版本)
第1行: 第1行:
{{Version|1.10}}
{{Version|1.13}}
'''效果'''('''Effects'''),也叫'''指令'''('''Commands'''),用于在特定作用域内动态地影响游戏。
{{需要翻译|译者=霜泽图书馆}}
{{Version|1.13}}


效果(也称为命令)用于从特定作用域内动态效果游戏。它们是对游戏当前状态的一次性更改,没有产生持久效果的能力。相反,修正用于对游戏的条件产生连续的、永恒的效果,可以用数字表示。效果块不能用于直接应用修正,但是它们可以添加可以应用修正的内容,最常见的是add_ideas。
Effects (also known as Commands) are used in order to affect the game dynamically from within a specific scope. They are a one-time change to the current condition of the game, '''without the ability to have a lasting effect'''. Instead, [[modifiers]] are used to have a continuous, everlasting effect on the game's condition that can be represented with a number. Effect blocks cannot be used to apply modifiers directly, however they can add something that can apply modifiers, most commonly with [[#add_ideas|add_ideas]].


效果在整个游戏中用于多种作用域,最常见的是国策、事件和决议。
Effects are used throughout the game in numerous scopes, most commonly edited effect blocks are [[National focus modding|national focus rewards]], [[Event modding|event options]] and [[Decision modding|decision effects]].


请注意,某些效果可能会从变量中获取值,即 这在效果参数中由< 变量> 表示。有关变量效应的信息,有关变量效果的信息,参见[[ 变量]]
Note that certain effects may take a value from a variable, i.e. <code>add_manpower = var:my_var</code> This is noted by '''<variable>''' in an effect's parameters. See [[Variables|Variables]] for information on the variable effects.


注意某些效果可能会需要变量的值,例如:
The list of effects may be outdated. A complete, but unsorted, list of effects can be found in {{path|documentation/effects_documentation.html}} or {{path|documentation/effects_documentation.md}}.


<code>add_manpower = var:my_var</code>.
==Scopes==
{{Main|Scopes}}
Scopes serve as special effect types that modify the entity that serves as the context for the effects being executed, such as <code>GER = { add_political_power = 150 }</code> adding 150 political power to {{Flag|Germany}}.
===Effect scopes===
{{#lsth:Scopes|Effect scopes}}
===Dual scopes===
{{#lsth:Scopes|Dual scopes}}


这在效果的参数中用变量的值表示。
==Any scope==


效果列表可能已过时。完整但未排序的效果列表可以在/Hearts of Iron IV/documentation/effects_documentation.html 或/Hearts of Iron IV/document/effects_documentation.md中找到。
Can be used in '''country''', '''state''' or '''character''' scopes.


== 作用域 ==
===General===
这些不用作效果,而是作为作用域,用于更改正在为其执行效果的对象。
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
{| class="wikitable"
|+ class="nowrap" | General any-scoped effects:<br/>
|+ 效果作用域
! width="10%" |Name
! 名称
! width="25%" |Parameters
! 用法
! width="25%" |Examples
! 目标类型
! width="20%" |Description
! 例子
! width="15%" |Notes
! 描述
! width="5%" |Version Added
! 添加的版本
|-id="add_dynamic_modifier"
|-
|add_dynamic_modifier
|every_possible_country
|<code>modifier = <modifier_string></code><br/>The name of the Modifier.<br/><code>scope = <country></code><br/>If you specify it, your dynamic modifier will be scoped to this scope. Optional.<br/><code>days = x</code> <br/>The modifiers will be removed after x days have passed. Optional.
| 始终可用
|<pre>add_dynamic_modifier = {
| 国家
   modifier = example_dynamic_modifier
|every_possible_country = { ... }
   scope = GER
| 对每个达到限制的国家/ 地区(包括不存在的国家/ 地区)执行子项效果。
   days = 14
|1.11
}
|-
</pre>
|every_country
|Adds a dynamic modifier to the specified scope (the default scope is ROOT).<br>It will be updated daily, unless forced to update early by force_update_dynamic_modifier effect.
| 始终可用
|Examples can be found in {{path|common/dynamic_modifiers/*.txt}}. Any modifiers that use variables within of the dynamic modifier will not show up in the tooltip of this effect, while those that are set to a static value will.
| 国家
|1.6
|every_country = { }
|-id="remove_dynamic_modifier"
| 对达到限制的每个国家/地区执行包含效果。
|remove_dynamic_modifier
|<code>modifier = <modifier_string></code><br/>The name of the Modifier.
|<pre>remove_dynamic_modifier = { modifier = sabotaged_ressources }</pre>
|Removes a dynamic modifier from the current scope
|Examples can be found in {{path|common/dynamic_modifiers/*.txt}}
|1.6
|-id="force_update_dynamic_modifier"
|force_update_dynamic_modifier
|<code><bool></code><br/>Boolean.
|<pre>force_update_dynamic_modifier = yes</pre>
|Forces an update to the effects given by variables within dynamic modifiers.
|An update is done daily by default; this can be used if the applied values need to be changed urgently, such as if modifiers are checked or used later in the effect block.
|1.6
|-id="set_global_flag"
|set_global_flag
|<code><flag></code><br/>An unique string to identify the global flag with.<br/>
'''OR'''<br/>
<code>flag = <flag></code><br/>The flag to set.<br/>
<code>days = <int></code><br/>Sets the flag to last for the specified amount of days. Optional.<br/>
<code>value = <int></code><br/>The new value of the flag on the scale from -2 147 483 648 to 2 147 483 647.
|<pre>set_global_flag = my_flag</pre>
<pre>set_global_flag = {
   flag = my_flag
   days = 123
   value = 1
}</pre>
|Defines a global flag.
|No tooltip is shown. [[Data structures#Flags|The flag in this effect is used in the meaning of 'boolean flag', used to store information.]]
|1.0
|1.0
|-
|-id="play_song"
|random_country
|play_song
| 始终可用
|<code><song title from .asset></code><br>A music file located in the music folder and .asset
| 国家
|<pre>play_song = "general_peace_1"</pre>
|random_country = { … }
|Plays an audio track
| 对满足限制的随机国家/ 地区执行包含的效果。
|The song must be defined in a music station in order to work. More information can be found in the [[Music modding]] page. If you wish to simply play a sound, the [[#sound_effect|sound_effect]] effect should be used instead.
 
The song will start playing for every country if the effect is executed. See [[#scoped_play_song|scoped_play_song]] if only one country should have the song.
|1.9.3
|-id="clr_global_flag"
|clr_global_flag
|<code><flag></code><br>The unique string of a global flag to clear.
|<pre>clr_global_flag = my_flag</pre>
|Clears a defined global flag.
|No tooltip is shown
|1.0
|1.0
|-
|-id="modify_global_flag"
|every_other_country
|modify_global_flag
| 仅在国家作用域内
|<code>flag = <flag></code><br>The flag to modify.<br>
|国家
<code>value = <value></code><br>The value to add to the flag. Defaults to 0.<br>
|every_other_country = { … }
<code>days = <int></code><br/>The amount of days that the flag should last for before being cleared. Optional, defaults to permanent.<br/>
|对满足限制且与包含限制的国家/地区不同的国家/ 地区执行包含效果。
|<pre>
|1.0
modify_global_flag = {
|-
   flag = my_flag
|random_other_country
   value = 3
|仅在国家作用域内
}</pre>
|国家
|Adds an integer value to a flag.
|random_other_country = { … }
|The flag must be already set.
|对满足限制且与包含该国家/ 地区不同的随机国家/ 地区执行包含效果。
|1.3
|1.0
|-id="custom_effect_tooltip"
|-
|custom_effect_tooltip
|every_country_with_original_tag
|<code><string></code><br>A localized string to display in the tooltip.
|始终可用
|<pre>custom_effect_tooltip = my_tooltip_tt</pre>
|国家
|Displays a localized key in the effect tooltip.
|every_country_with_original_tag = {
|
 
    original_tag_to_check = TAG  #required
 
    …                  #运行的效果
 
}
|对满足限制并具有指定原始标签的每个国家/ 地区执行包含的效果。
|1.9
|-
|random_country_with_original_tag
|始终可用
|国家
|random_country_with_original_tag = {
 
    original_tag_to_check = TAG  #required
 
    …                  #运行的效果
 
}
|对满足限制并具有指定原始标签的随机国家/地区执行包含的效果。
|1.9
|-
|every_neighbor_country
| 仅在国家作用域内
| 国家
|every_neighbor_country = { … }
| 对满足限制并与所包含的国家/地区接壤的每个国家/地区执行包含效果。
|1.0
|1.0
|-
|-id="effect_tooltip"
|random_neighbor_country
|effect_tooltip
| 仅在国家作用域内
|<code><string></code><br>
| 国家
|<pre>
|random_neighbor_country = { }
effect_tooltip = {
| 对符合限制并与包含该国家/ 地区接壤的随机国家/ 地区执行包含效果。
   declare_war_on = {
     target = FRA
   }
}</pre>
|Displays the effects in the tooltip without executing them.
|
|
|-id="log"
|log
|<code><string></code><br>An string to in the game.log
|<pre>log = "myVariable: [?myVariable]"</pre>
|Displays a string in the [[Modding|user directory's]] {{path|logs/game.log}} file when executed, as well as showing up in the console if it is open when the logging effect was executed.
|Accepts all localisation commands (e.g. <code>[Root.GetName]</code>, <code>[GetDateText]</code>, etc)
|1.5
|-id="save_event_target_as"
|save_event_target_as
|<code><string></code><br>An unique string to identify the event target with.
|<pre>
capital_scope = {
   save_event_target_as = my_state
}
</pre>
|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.<br>Do not use in Scripted GUIs.
|1.0
|1.0
|-
|-id="save_global_event_target_as"
|every_occupied_country
|save_global_event_target_as
| 仅在国家作用域内
|<code><string></code><br>An unique string to identify the global event target with.
| 国家
|<pre>random_other_country = {
|every_occupied_country = { … }
   save_global_event_target_as = my_country
| 对达到限制的每个国家/地区执行包含效果,并且其任何核心状态都由该限制所在的国家/地区控制。
}
</pre>
|Saves the current scope as a key. Persists after execution until cleared via effect.
|Use event_target:<key> to access the scope.<br>Do not use in Scripted GUIs.
|1.0
|1.0
|-
|-id="clear_global_event_target"
|random_occupied_country
|clear_global_event_target
| 仅在国家作用域内
|<code><string></code><br>The unique string of the global event target to clear.
| 国家
|<pre>clear_global_event_target = my_country</pre>
|random_occupied_country = { … }
|Clears a specific global event target.
| 对满足限制的随机国家/地区执行包含效果,并且其任何核心状态都由该国家/地区控制。
|
|1.0
|1.0
|-
|-id="clear_global_event_targets"
|every_enemy_country
|clear_global_event_targets
| 仅在国家作用域内
|<code>yes</code><br>Boolean.
| 国家
|<pre>clear_global_event_targets = yes</pre>
|every_enemy_country = { … }
|Clears all global event targets.
| 对每个达到限制的国家/地区执行包含效果,并与其中包含的国家/地区交战
|
|1.0
|1.0
|-
|-id="sound_effect"
|random_enemy_country
|sound_effect
| 仅在国家作用域内
|<code><string></code><br>A sound reference from an .asset file.
| 国家
|<pre>sound_effect = "boom"</pre>
|random_enemy_country = { }
|Plays the specified sound once.
| 对满足限制的随机国家/地区执行包含效果,并与其中包含的国家/地区交战。
|The sound effect must be properly defined in {{path|sound/}} See also: [[Sound modding]].
The sound will play for every country if the effect is executed. See [[#scoped_sound_effect|scoped_sound_effect]] if only one country should hear it.
|1.0
|1.0
|-
|-id="randomize_weather"
|every_subject_country
|randomize_weather
| 仅在国家作用域内
|<code><int></code><br>A seed integer.
|国家
|<pre>randomize_weather = 12345</pre>
|every_subject_country = { … }
|Randomizes the weather with the specified seed.
|对满足限制的每个国家/ 地区执行包含效果,并且是其中包含该限制的国家/地区的附庸。
|
|1.11
|-
|random_subject_country
|仅在国家作用域内
| 国家
|random_subject_country = { … }
|对符合限制的随机国家/地区执行包含效果,并且是其中包含该国家/ 地区的附庸政权。
|1.11
|-
|every_state
|始终可用
|state
|every_state = { … }
| 对满足限制的每个state执行包含的效果。
|1.0
|1.0
|-
|-id="set_province_name"
|random_state
|set_province_name
| 始终可用
|<code>id = <id></code><br>The id of the province to be changed.
|state
<code>name = <string></code><br>The name to change the province to.
|random_state = {
|<pre>
 
set_province_name = {
    limit = { 123 321 } #可选
   id = 325
 
   name = LOC_KEY
    …    #运行的效果
 
}
}
| 对满足限制的随机state执行包含的效果。
</pre>
|1.0
<pre>
|-
set_province_name = { id = 325 name = "New Name" }
|every_neighbor_state
</pre>
| 仅在state作用域内
|Changes the specified province/victory point's name to the specified name.
|state
|Localisation keys are to be defined in {{path|localisation/*_l_<language>.yml}}
|every_neighbor_state = { }
|1.3
| 对满足限制的每个state执行包含的效果,并与包含该限制的状态相邻。
|-id="reset_province_name"
|1.0
|reset_province_name
|-
|<code><id></code><br>The id of the province to reset.
|random_neighbor_state
|<pre>
| 仅在state作用域内
reset_province_name = 325
|state
</pre>
|random_neighbor_state = { }
|Resets the specified province's name.
| 对满足限制的随机state执行包含效果,并与该状态所包含的状态相邻。不支持优先级排序。
|
|1.0
|1.3
|-
|-id="damage_units"
|every_owned_state
|damage_units
| 仅在国家作用域内
|<code>province = <id></code><br/>Province where to damage units.<br/>
|state
<code>state = <id></code><br/>State where to damage units.<br/>
|every_owned_state = { }
<code>region = <id></code><br/>Strategic region where to damage units.<br/>
|对满足限制且归其所在国家/ 地区所有的每个state执行包含效果。
<code>limit = { <triggers> }</code><br/>Will only delete units if the triggers within are met for the country that owns the units.<br/>
|1.0
<code>damage = <fraction></code><br/>The percentage of damage done to units.<br/>
|-
<code>org_damage = <fraction></code><br/>The percentage of damage done to units to organisation in particular.<br/>
|random_owned_state
<code>str_damage = <fraction></code><br/>The percentage of damage done to units to strength in particular.<br/>
| 仅在国家作用域内
<code>ratio = <yes></code><br/>Will damage a ratio damage to total organisation/strength of unit if set.<br/>
|state
<code>template = <string></code><br/>If specified, requires the template name to match.<br/>
|random_owned_state = {
<code>army = <bool></code><br/>Will damage the army units.<br/>
 
<code>navy = <bool></code><br/>Will damage the navy units.
    limit = { 123 321 } # 可选
|<pre>damage_units = {
 
   province = 42
    …    #运行的效果
   state = 5
 
   region = 5
}
   limit = { has_country_flag = TAG_test }
| 对满足限制的随机state执行包含效果,并且该状态归其中包含该状态的国家/地区所有。
   damage = 0.5
|1.0
   org_damage = 0.5
|-
   str_damage = 0.5
|every_core_state
   ratio = yes
| 仅在国家作用域内
   template = "template_name"
|state
   army = no
|every_core_state = { }
   navy = yes
| 对满足限制的每个state执行包含效果,并且是其中包含的国家/地区的核心。
}</pre>
|Damages units in the specified area.
|
|1.11
|-id="create_entity"
|create_entity
|<code>entity = <gfx_entry></code><br/>The entity to spawn, defined within {{path|gfx/entities/*.asset}} files.<br/>
<code>id = int</code><br>A number ID which can be referred to by other effects. Optional.<br/>
<code>var = <variable></code><br>If provided, the id of the entity will be stored using this variable. Optional.<br/>
<code>x = <int></code><br/>The X position of the entity.<br/>
<code>y = <int></code><br/>The Y position of the entity.<br/>
<code>z = <int></code><br/>The Z position of the entity.<br/>
<code>province = <int></code><br/>The province the middle of which to use as the entity's position.<br/>
<code>state = <int></code><br/>The state the middle of which to use as the entity's position.<br/>
<code>rotation = <decimal></code><br/>The rotation of the entity in radians.<br>
<code>scale = <decimal></code><br/>The size of the entity.<br/>
<code>min_zoom = <decimal></code><br/>Minimum zoom level needed to be able to see the entity.<br/>
<code>visible = <scripted_trigger></code><br>The scripted trigger that must be met for a country for it to see the entity.
|<pre>create_entity = {
   entity = entity_name
   id = 123
   var = var_name
   x = 42
   y = 21
   z = 3
   province = 123
   state = 42
   rotation = 1.2
   scale = 10.0
   min_zoom = 100.0
   visible = scripted_trigger_name
}</pre>
|Creates an entity.
|Uses the [[Map modding#Coordinate system|the same coordinate system that the map uses.]] A positive change in rotation results in counter-clockwise rotation, a full 360 degrees rotation is approximately 6.28 radians. For comparison, default minimum zoom level (closest to the map) is 50 units, while default maximum zoom level is 3000 units.
|1.11
|-id="destroy_entity"
|destroy_entity
|<code><id></code><br/>The ID of the entity to destroy.
|<pre>destroy_entity = 123</pre>
|Deletes an entity
|IDs are set by the [[#create_entity|create_entity effect]].
|1.11
|-id="set_entity_movement"
|set_entity_movement
|<code>id = <ID></code><br/>The ID of the entity to modify.<br/>
<code>ratio = <int></code><br>Distance between starting position and target position where the entity is to be placed.<br>
<code>rotation = <int></code><br/>The rotation to apply ''after'' the positioning.<br/>
'''start''' and '''target''' arguments:<br/>
:<code>x = <int></code><br>
:The X position of the point.<br/>
:<code>y = <int></code><br>
:The Y position of the point.<br/>
:<code>z = <int></code><br>
:The Z position of the point.<br/>
:<code>province = <int></code><br>
:The province the middle of which to use as the point.<br/>
:<code>state = <int></code><br>
:The state the middle of which to use as the point.
|<pre>set_entity_movement = {
   id = 123
   start = {
     x = 42
     y = 21
     z = 3
   }
   target = {
     province = 124
   }
   ratio = 0.5
   rotation = 1.2
}</pre>
|Sets the position and rotation of an entity using two coordinates.
|IDs are set by the [[#create_entity|create_entity effect]]. Uses the [[Map modding#Coordinate system|the same coordinate system that the map uses.]] A positive change in rotation results in counter-clockwise rotation, a full 360 degrees rotation is approximately 6.28 radians.
|1.11
|-id="set_entity_position"
|set_entity_position
|<code>id = <id></code><br><code>x = <int></code><br><code>y = <int></code><br><code>z = <int></code><br><code>province = <int></code><br><code>state = <int></code>
|<pre>set_entity_position = {
  id = 123
  x = 42
  y = 21
  z = 3
  province = 123
  state = 42
}</pre>
|Sets the position of an existing entity
|IDs are set by the [[#create_entity|create_entity effect]]. Uses the [[Map modding#Coordinate system|the same coordinate system that the map uses.]]
|1.11
|-id="set_entity_rotation"
|set_entity_rotation
|<code>id = <ID></code><br/>The ID of the entity to modify.<br/>
<code>rotation = <decimal></code><br/>The new angle in radians.
|<pre>set_entity_rotation = {
   id = 123
   rotation = 0.23
}</pre>
|Sets the currently-facing angle of an existing entity.
|IDs are set by the [[#create_entity|create_entity effect]]. A positive change results in counter-clockwise rotation, a full 360 degrees rotation is approximately 6.28 radians.
|1.11
|-id="set_entity_scale"
|set_entity_scale
|<code>id = <ID></code><br/>The ID of the entity to modify.<br/>
<code>scale = <decimal></code><br/>The scale to change the entity to.
|<pre>set_entity_scale = {
  id = 123
  scale = 5.0
}</pre>
|Sets the size of an existing entity.
|IDs are set by the [[#create_entity|create_entity effect]].
|1.11
|1.11
|-
|-id="set_entity_animation"
|random_core_state
|set_entity_animation
| 仅在国家作用域内
|<code>id = <int></code><br/>The ID of the entity to modify.<br/>
|state
<code>animation = <animation_type></code><br/>The animation entry to apply.
|random_core_state = {
|<pre>set_entity_animation = {
 
   id = 123
    limit = { 123 321 } #可选
   animation = "shoot_lasers"
 
}</pre>
    …    # 运行的效果
|Sets the animation of a specified entity.
 
|IDs are set by the [[#create_entity|create_entity effect]]. Animations are defined within the {{path|gfx/models/**/*.asset}} files.
}
| 对满足限制的随机state执行包含的效果,并且是包含该状态的国家/ 地区的核心。
|1.11
|1.11
|-
|-id="build_railway"
|every_controlled_state
|build_railway
| 仅在国家作用域内
|<code>level = <int></code><br>Defaults to 1<br>
|state
<code>build_only_on_allied = <bool></code><br>No by default, if yes and in a country scope, it will only build on allied territories for the country scoped.<br>
|every_controlled_state = { }
<code>fallback = <bool></code><br>Defaults to no, if yes each option will try to fallback to the next available one.<br>
|对满足限制的每个state执行包含效果,并受其包含的国家/ 地区控制。
<code>path = { <list of provinces> }</code><br>
|1.9
<code>start_province = <int></code><br>
|-
<code>target_province = <int></code><br>
|random_controlled_state
<code>start_state = <int></code><br>
|仅在国家作用域内
<code>target_state = <int></code><br>If using start state/target state, the game will pick the provinces with the best supply available. If using state province/target province, the game will link those two provinces.
|state
|<pre>build_railway = {
|random_controlled_state = {
   level = 1
 
   build_only_on_allied = yes
    limit = { 123 321 } #可选
   controller_priority = {
 
     base = 1
    …    #运行的效果
     modifier = {
 
       tag = MAN
       add = 2
     }
   }
   fallback = yes
   path = { 42 10 20 30 40 84 }
   start_province = 42
   target_province = 84
}
}
|对满足限制的随机state执行包含效果,并由其中包含该状态的国家/ 地区控制。
</pre>
1.9
<pre>build_railway = {
|-
   level = 1
|random_owned_controlled_state
   build_only_on_allied = yes
|仅在国家作用域内
   controller_priority = {
|state
     base = 1
|random_owned_controlled_state = {
     modifier = {
 
       tag = MAN
    limit = { 123 321 } #可选
       add = 2
 
     }
    …    #运行的效果
   }
 
   fallback = yes
   path = { 50 10 20 30 40 100 }
   start_state = 50
   target_state = 100
}
}
|对满足限制的随机state执行包含效果,并且由其中包含该状态的国家/地区拥有和控制。
</pre>
|  1.9
|Adds a railway level between two provinces or along a predefined path.
|-
|
|every_unit_leader
|仅在国家作用域内
|人物
|every_unit_leader = { … }
|对每个符合限制的将领人(元帅、元帅、海军上将)执行包含效果,并由其中包含的国家招募。
|1.5
|-
|random_unit_leader
|仅在国家作用域内
|人物
|random_unit_leader = { … }
|对符合限制的随机将领人(元帅、陆军元帅、海军上将)执行包含效果,并由其中包含的国家
|1.5
|-
|every_army_leader
|仅在国家作用域内
|人物
|every_army_leader = { ... }
|对每个达到限制的军队领导人执行包含效果,并由其中包含的国家招募。
|1.5
|-
|random_army_leader
|仅在国家作用域内
|人物
|random_army_leader = { … }
|对达到限制的随机军队首领执行包含效果,并被包含该国家/ 地区招募。
|1.5
|-
|global_every_army_leader
|始终可用
|人物
|global_every_army_leader = { … }
|对每个达到限制的军队首领执行包含效果。最好使用every_army_leader除非有必要使用global_every_army_leader。
|1.5
|-
|every_navy_leader
|仅在国家作用域内
|人物
|every_navy_leader = { … }
|对每个达到限制的海军将领执行包含效果,并被其中包含的国家招募。
|1.5
|-
|random_navy_leader
|仅在国家作用域内
|人物
|random_navy_leader = { … }
|对达到限制的随机海军将领执行包含效果,并由其中包含的国家/地区招募。
|1.5
|-
|every_operative
|仅在国家/地区作用域内或业务作用域内
|特工
|every_operative = { … }
|对每个达到限制的特工执行包含效果,并由其中包含的国家招募。
|1.9
|-
|random_operative
|仅在国家/地区作用域内或业务作用域内
|特工
|random_operative = { … }
|对符合限制的随机特工执行包含的效果,并由其中包含的国家/地区招募。
|1.9
|-
|every_character
|仅在国家作用域内
|人物
|every_character = { … }
|对每个符合限制的角色执行包含效果,并由其中包含的国家/地区招募。
|1.11
|1.11
|-
|-id="event_option_tooltip"
|random_character
|event_option_tooltip
| 仅在国家作用域内
|<code><option></code><br/>The name of the option.
| 人物
|<pre>event_option_tooltip = mtg_usa_civil_war_fascists.1.a</pre>
|random_character = { … }
|Shows the tooltip usually received for hovering over an event option with the specified name.
| 对符合限制的随机字符执行包含效果,并由其中包含该字符的国家/地区招募。
|ROOT and FROM scopes are swapped.
|1.11
|1.13
|-
|-id="create_purchase_contract"
|every_country_division
|create_purchase_contract
| 仅在国家作用域内
|<code>seller = <country></code><br/>The seller in the contract.<br/>
|师旅
<code>buyer = <country></code><br/>The buyer in the contract.<br/>
|every_country_division = { … }
<code>civilian_factories = <int></code><br/>The amount of civilian factories required by the contract.<br/>
|对满足限制且归当前国家/ 地区所有的每个部队执行包含效果。
<code>equipment = { ... }</code><br/>The equipment that the contract is for. In particular, contains these attributes:
|1.12
: <code>type = <archetype></code><br/>The archetype of the equipment.<br/>
|-
: <code>amount = <int></code><br/>The amount of the specified equipment.<br/>
|random_country_division
|<pre>create_purchase_contract = {
|仅在国家作用域内
   seller = ROOT
|师旅
   buyer = FROM
|random_country_division = { }
   civilian_factories = 2
|对满足限制且归当前国家/ 地区拥有的随机部队执行包含的效果。
   equipment = {
|1.12
     type = artillery_equipment
|-
     amount = 300
|every_state_division
   }
|仅在state作用域内
}</pre>
|师旅
|Creates a purchase contract with the specified parameters.
|every_state_division = { … }
|Allows using <code>equipment = { ... }</code> several times.
|对满足限制且位于当前状态中的每个部队执行包含的效果。
|1.13
|1.12
|-
|random_state_division
| 仅在state作用域内
|师旅
|random_state_division = { }
|对满足限制且位于当前状态内的随机部队执行包含的效果。
|1.12
|}
|}


== 在博斯普鲁斯之战DLC中添加的新效果==
===Border wars===
{| class="wikitable sortable" width="100%"
These effects refer to the border wars that simulate combat on a border between two countries, with provinces where it takes place being highlighted in white. For the state-based border wars represented with orange stripes on states, see [[Effect#set_border_war|set_border_war]] in the state scope.
|-
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
! style="width: 157px" width="10%" | 名字
|+ class="nowrap" | Border war-related any-scoped effects:<br/>
! style="width: 395px" width="25%" | 参数
! width="10%" |Name
! width="25%" | 示例
! width="25%" |Parameters
! width="20%" | 描述
! width="25%" |Examples
! width="15%" | 注释
! width="20%" |Description
! width="5%" | 添加
! width="15%" |Notes
版本
! width="5%" |Version Added
|-
|-id="start_border_war"
| style="width: 157px" |add_victory_points
|start_border_war
| style="width: 395px" |给一个省份增加胜利点
|<code>change_state_after_war = <bool></code><br/>Whether the state changes hands after the war.
|<pre>add_victory_points = {
'''Attacker or Defender scope'''<br/>
   province = (省份id)
<code>state = <id> / <variable></code><br/>The state the side is fighting on.<br/>
   value = (数量)  
<code>num_provinces = <id></code><br/>The number of provinces used in the state.<br/>
}</pre>
<code>on_win = <id></code><br/>The event to fire for the side on a win.<br/>
|给一个省份增加胜利点
<code>on_lose = <id></code><br/>The event to fire for the side on a loss.<br/>
|接受负值
<code>on_cancel = <id></code><br/>The event to fire for the side on a draw.<br/>
|1.10
<code>modifier = <decimal></code><br/>The modifier on combat. Defaults to 0.<br/>
|-
<code>dig_in_factor = <decimal></code><br/>The modifier applied to dig-in bonuses. Defaults to 1.<br/>
| style="width: 157px" |set_victory_points
<code>terrain_factor = <decimal></code><br/>The modifier applied to terrain bonuses. Defaults to 1.<br/>
| style="width: 395px" |设置一个省份的胜利点
|<pre>start_border_war = {
|<pre>set_victory_points = {
    change_state_after_war = no
    province = (省份id)
    attacker = {
    value = (数量)  
     state = 527
}</pre>
     num_provinces = 4
|设置一个省份的胜利点
     on_win = japan_border_conflict.2
|接受负值
     on_lose = japan_border_conflict.3
|1.10
     on_cancel = japan_border_conflict.4
|}
     modifier = 0.1
== 在抵抗组织DLC(La Resistance)中添加的新效果(Effect)==
     dig_in_factor = 0
{| class="wikitable sortable" width="100%"
     terrain_factor = 0
|-
   }
! style="width: 157px" width="10%" |名字
   defender = {
! style="width: 395px" width="25%" |参数
     state = 408
! width="25%" |示例
     num_provinces = 4
! width="20%" |描述
     on_win = japan_border_conflict.3
! width="15%" |注释
     on_lose = japan_border_conflict.2
! width="5%" |添加
     on_cancel = japan_border_conflict.4
版本
   }
|-
}
| style="width: 157px" |create_intelligence_agency
</pre>
| style="width: 395px" |可以自动建立一个情报机构
|Starts a border war for the specified attacker and defender. The participating countries are the owners of the specified states.
|<code>create_intelligence_agency = yes</code>
| 建立一个情报机构
|&nbsp;
|&nbsp;
|1.9
|1.5
|-
|-id="set_border_war_data"
| style="width: 157px" |upgrade_intelligence_agency
|set_border_war_data
| style="width: 395px" |可以自动解锁一项情报机构升级
|<code>attacker = <id> / <variable></code><br/>The attacker state.
|<code>upgrade_intelligence_agency = upgrade_form_department</code> <code>upgrade_intelligence_agency = < 情报机构升级名称></code>
<code>defender = <id> / <variable></code><br/>The defender state.<br/><code>attacker_modifier = <id> / <variable></code><br/>The modifier applied to attacker strength.<br/><code>defender_modifier = <id> / <variable></code><br/>The modifier applied to attacker strength.<br/><code>combat_width = <id> / <variable></code><br/>The combat width used in the border war battle.
|解锁一项情报机构升级
|<pre>set_border_war_data = {
|情报机构升级项目可以在目录 common/intelligence_agency_upgrades 中被找到
   attacker = 527
|1.9
   defender = 408
|-
   defender_modifier = 0.15
| style="width: 157px" |kill_ideology_leader
   combat_width = 100
| style="width: 395px" |可以杀死一个属于一个准确的意识形态的国家领导人
}
|<code>kill_ideology_leader = communism</code> <code>kill_ideology_leader = < 意识形态名称>(democratic,facism,communism)</code>
</pre>
| 杀死当前作用域的指定意识形态领导人
|Sets the bonuses or penalties for the attacker and defender in an on-going border war. Used after '''start_border_war'''.
|&nbsp;
|&nbsp;
|1.9
|1.5
|-
|-id="cancel_border_war"
| style="width: 157px" |transfer_units_fraction
|cancel_border_war
| style="width: 395px" |可以精确地将一个国家的一部分军队和装备转移到任何国家。
|<code>attacker = <id> / <variable></code><br/>The attacker state.
|<code>transfer_units_fraction= {<br />&nbsp;&nbsp;&nbsp; target = SPD(SPD是一个国家的标识tag)<br /> &nbsp;&nbsp;&nbsp; size = 0.5<br />&nbsp;&nbsp;&nbsp; stockpile_ratio = 0.8<br /> &nbsp;&nbsp;&nbsp; army_ratio = 0.8<br /> &nbsp;&nbsp;&nbsp; navy_ratio = 0.5<br /> &nbsp;&nbsp;&nbsp; air_ratio = 0.5<br /> &nbsp;&nbsp;&nbsp; keep_unit_leaders_trigger = {<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;has_trait = trait_SPA_nationalist_sympathies<br /> &nbsp;&nbsp;&nbsp;}<br /> }<code>
<code>defender = <id> / <variable></code><br/>The defender state.<br/><code>dont_fire_events = <bool></code><br/>Stops the events from '''start_border_war''' from firing.
|将一定的装备、海军、空军和陆军按照特定的比例转移到一个国家。
|<pre>cancel_border_war = {
|军队将领可以使用 <code>keep_unit_leaders_trigger = {</code> 保留
   dont_fire_events = yes
|1.9
   defender = 408
|-
   attacker = 527
|}
}
 
</pre>
== 在炮手就位DLC(Man the Guns)添加的新效果(Effect)==
|Cancels an on-going border war without a winner.
 
{| class="wikitable sortable" width="100%"
|-
! style="width: 157px" width="10%" |名字
! style="width: 395px" width="25%" |参数
! width="25%" |示例
! width="20%" |描述
! width="15%" |注释
! width="5%" |添加
版本
|-
| style="width: 157px" |remove_decision
| style="width: 395px" |可以在不使用 remove_effect 语句下移除特定的决议
|<code>remove_decision = GER_MEPO</code>
| 移除一项决议
|&nbsp;
|&nbsp;
|1.6
|1.5
|-
|-id="finalize_border_war"
| style="width: 157px" |swap_ruler_traits
|finalize_border_war
| style="width: 395px" |与 swap_ideas 类似. 移除一个技能/ 特质(trait)然后添加另外一个.(trait指的是国家领导人身上的技能)
|<code>attacker = <id> / <variable></code><br/>The attacker state.
|<code>swap_ruler_traits = { remove = < 要移除的技能> add = < 要添加的技能> }</code>
<code>defender = <id> / <variable></code><br/>The defender state.<br/><code>attacker_win = <bool></code><br/>Makes the attacker the winner.<br/><code>defender_win = <bool></code><br/>Makes the defender the winner.
| 更换技能
|<pre>finalize_border_war = {
   attacker_win = yes
   attacker = 527
   defender = 408
}
</pre>
|Ends an on-going border war.
|&nbsp;
|&nbsp;
|1.6
|1.5
|-
|}
 
===Variables===
| style="width: 157px" |
{{Hatnote|This section is transcluded from {{Section link|Data structures|Operators}}}}
remove_exile_tag
{{#lsth:Data structures|Operators}}
=== Arrays ===
{{See also|Arrays}}
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Effects for modifying arrays:}}
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="20%" |Notes
|-id="add_to_array"
|add_to_array
|<code>array = <array></code><br/>The array to modify.<br/>
<code>value = <decimal>/<variable></code><br/>The variable to add.<br/>
<code>index = <integer></code><br/>The index to place the variable on in the array. Optional, defaults to the end of the array.
|<pre>add_to_array = {
   array = global.my_countries
   value = THIS.id
}</pre>
<pre>add_to_temp_array = { temp_states = THIS }</pre>
|Adds an element to the array either at the specified index, defaulting to the end otherwise.
|Shortened version exists with <code>add_to_array = { <array> = <value> }</code>.
|-id="remove_from_array"
|remove_from_array
|<code>array = <array></code><br/>The array to modify.<br/>
<code>value = <decimal>/<variable></code><br/>The variable to remove. Optional.<br/>
<code>index = <integer></code><br/>The index to remove the variable from in the array. Optional.
|<pre>remove_from_array = {
   array = global.my_countries
   index = 0
}</pre>
<pre>remove_from_temp_array = { temp_states = THIS }</pre>
|Removes an element from the array with the specified value or index.
|Shortened version exists with <code>remove_from_array = { <array> = <value> }</code>. If neither value nor index are specified, then the last element is deleted.
|-id="clear_array"
|clear_array
|<code><array></code><br/>The array to clear.
|<pre>clear_array = global.my_countries</pre>
<pre>clear_temp_array = temp_states</pre>
|Clears the array, removing every element inside.
|
|-id="resize_array"
|resize_array
|<code>array = <array></code><br/>The array to modify.<br/>
<code>value = <decimal>/<variable></code><br/>The variable to add to the array if the size is larger than the array's current size. Optional, defaults to 0.<br/>
<code>size = <integer></code><br/>The amount of elements inside of the array after the resizing.
|<pre>resize_array = {
   array = global.countries_by_states
   value = 10
   size = global.countries^num
}</pre>
<pre>resize_temp_array = { temp_states = 20 }</pre>
|Resizes the array, removing or adding elements in the end if necessary.
|Shortened version exists with <code>resize_array = { <array> = <size> }</code>.
|-id="find_highest_in_array"
|find_highest_in_array
|<code>array = <array></code><br/>The array to modify.<br/>
<code>value = <variable></code><br/>The temporary variable where the largest value will get stored.<br/>
<code>index = <variable></code><br/>The temporary variable where the index of the largest value will get stored.
|<pre>find_highest_in_array = {
   array = global.countries_by_states
   value = temp_largest_country
   index = temp_country_index
}</pre>
|Finds the largest value in the array and assigns its value and index to a temporary variable.
|Either value or index are optional to specify.
|-id="find_lowest_in_array"
|find_lowest_in_array
|<code>array = <array></code><br/>The array to modify.<br/>
<code>value = <variable></code><br/>The temporary variable where the smallest value will get stored.<br/>
<code>index = <variable></code><br/>The temporary variable where the index of the smallest value will get stored.
|<pre>find_lowest_in_array = {
   array = global.countries_by_states
   value = temp_largest_country
   index = temp_country_index
}</pre>
|Finds the smallest value in the array and assigns its value and index to a temporary variable.
|Either value or index are optional to specify.
|}
 
==Country scope==


| style="width: 395px" |移除一个军队将领的流亡标识(tag), 让他不再被判定为流亡将领
The effects here must be used within a '''country''' scope.
|<code>remove_exile_tag = { USA = "Arturo Rawson" }</code>
===General===
|移除一个Leader的流亡标识
|&nbsp;
|1.6
|-
| style="width: 157px" |add_legitimacy
| style="width: 395px" |给一个流亡政府增加政权合法性
|<code>add_legitimacy = 10</code>
|增加政权合法性
|&nbsp;
|1.6
|-
| style="width: 157px" |
set_legitimacy


| style="width: 395px" | 设定流亡政府政权合法性
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|<code>set_legitimacy= { POL = 1.0 }</code>
|+ class="nowrap" | General country-scoped effects:<br/>
| 设定政权合法性
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="set_country_flag"
|set_country_flag
|<code><flag></code><br/>An unique string to identify the country flag with.<br/>
'''OR'''<br/>
<code>flag = <flag></code><br/>The flag to set.<br/>
<code>days = <int></code><br/>Sets the flag to last for the specified amount of days. Optional.<br/>
<code>value = <int></code><br/>The new value of the flag on the scale from -2 147 483 648 to 2 147 483 647.
|<pre>set_country_flag = my_flag</pre>
<pre>set_country_flag = {
   flag = my_flag
   days = 123
   value = 1
}</pre>
|Defines a country flag.
|No tooltip is shown. [[Data structures#Flags|The flag in this effect is used in the meaning of 'boolean flag', used to store information.]] '''In order to change the flag that represents the country, see [[Cosmetic tag modding|cosmetic tags.]]'''
|1.0
|-id="clr_country_flag"
|clr_country_flag
|<code><flag></code><br/>The unique string of a country flag to clear.
|<pre>clr_country_flag = my_flag</pre>
|Clears a defined country flag.
|&nbsp;
|&nbsp;
|1.6
|1.0
|-
|-id="modify_country_flag"
| style="width: 157px" |become_exiled_in
|modify_country_flag
| style="width: 395px" | 使一个国家成为一个在既定国家的流亡政府,具有既定的合法性。
|<code>flag = <flag></code><br>The flag to modify.<br>
|<code>become_exiled_in = { target = < 既定国家( 在哪里流亡)> legitimacy = <0-1> ( 预设的合法性) }</code>
<code>value = <value></code><br>The value to add to the flag. Defaults to 0.<br>
| 创建一个流亡政府
<code>days = <int></code><br/>The amount of days that the flag should last for before being cleared. Optional, defaults to permanent.<br/>
| 必须在 ROOT( 不懂参见[[Scopes|作用域]]) 下使用, 需要成为流亡政府的国家,或者一个特定的tag
|<pre>
|1.6
modify_country_flag = {
|-
   flag = my_flag
| style="width: 157px" |end_exile
   value = 3
| style="width: 395px" | 结束流亡政府
}</pre>
|<code>end_exile</code>
|Adds an integer value to a flag.
| 结束流亡政府
|The flag must be already set.
|1.3
|-id="country_event"
|country_event
|<code>id = <event></code><br/>The event to fire.
<code>days = <int> / <variable></code><br/>Fires the event in the specified number of days. Optional.<br/><code>hours = <int> / <variable></code><br/>Fires the event in the specified number of hours. Optional.<br/><code>random_hours = <int> / <variable></code><br/>Adds a random number (between ''0'' and ''random_hours'', inclusive) of '''hours''' to the scheduled fire time. Optional.<br/><code>random_days = <int> / <variable></code><br/>Adds a random number (between ''0'' and ''random_days'', inclusive) of days to the scheduled fire time. Optional.
|<pre>country_event = {
   id = my_event.1
   days = 10
   random_hours = 12
   random_days = 10
}
</pre>
<pre>country_event = my_event.1</pre>
|Fires the specified event for the current country.
|Where triggers do not need to be repeatedly checked <code>random</code> can be a performance light alternative to <code>mean_time_to_happen</code> for scheduling events. Shortened variant exists if the event's ID is used instead of arguments.
|1.0
|-id="news_event"
|news_event
|<code>id = <event></code><br/>The event to fire.
<code>days = <int> / <variable></code><br/>Fires the event in the specified number of days. Optional.<br/><code>hours = <int> / <variable></code><br/>Fires the event in the specified number of hours. Optional.<br/><code>random_hours = <int> / <variable></code><br/>Adds a random number (between ''0'' and ''random_hours'', inclusive) of '''hours''' to the scheduled fire time. Optional.<br/><code>random_days = <int> / <variable></code><br/>Adds a random number (between ''0'' and ''random_days'', inclusive) of days to the scheduled fire time. Optional.
|<pre>news_event = {
   id = my_event.1
   days = 10
   random_hours = 12
   random_days = 10
}
</pre>
<pre>news_event = my_event.1</pre>
|Fires the specified news event for the current country.
|The news event uses a different interface to the country event.<br/>
Where triggers do not need to be repeatedly checked <code>random</code> can be a performance light alternative to <code>mean_time_to_happen</code> for scheduling events. Shortened variant exists if the event's ID is used instead of arguments.
|1.0
|-id="set_cosmetic_tag"
|set_cosmetic_tag
|<code><string></code><br/>The cosmetic tag to switch to.
|<pre>set_cosmetic_tag = SAF_SOV_communism</pre>
|Makes the current scope use the specified cosmetic tag, changing name and flag.
|&nbsp;
|&nbsp;
|1.6
|1.3
|-
|-id="drop_cosmetic_tag"
| style="width: 157px" |add_province_modifier
|drop_cosmetic_tag
| style="width: 395px" |增加省份修正
|<code><bool></code><br/>Boolean.
|<code>add_province_modifier = { 5246 = mud }</code>
|<pre>drop_cosmetic_tag = yes</pre>
|增加一个省份修正(天气)
|Makes the current scope drop the current cosmetic tag they are using.
|新的省份修正可以在"weather.txt"文件中创建.
|1.6
|-
| style="width: 157px" |remove_province_modifier
| style="width: 395px" |移除一个省份修正(天气)
|<code>remove_province_modifier = { 5246 = mud }</code>
|移除一个省份修正
|新的省份修正可以在"weather.txt"文件中创建.
|1.6
|-
| style="width: 157px" |set_faction_name
| style="width: 395px" |设置阵营名字(本地化名字,即需要本地化(localize),写入本地化文件)
|<code>set_faction_name = SOME_LOC_KEY</code>
| 改变阵营名字
|&nbsp;
|&nbsp;
|1.6
|1.3
|-
|-id="set_rule"
| style="width: 157px" |add_nuclear_bombs
|set_rule
| style="width: 395px" | 给一个特定国家增加指定数量的核弹
|<code><rule></code><br/>Boolean.<br/>
|<code>add_nuclear_bombs = 100</code>
<code>desc = <localisation key></code><br/>The localisation used as the description for why the rule is set.
| 给一个特定国家增加指定数量的核弹
|<pre>set_rule = {
| 需要事先研究核弹科技
   desc = TAG_my_rule_description
|1.6
   can_create_factions = yes
|-
}
| style="width: 157px" |launch_nuke
</pre>
| style="width: 395px" | 核爆一个特定省份
|Toggles the special game rules for the current scope. Note: each rule can only be toggled a few times before a reload is required.
|{{Game rule list}}
|1.0
|-id="set_party_rule"
|set_party_rule
|<code>ideology = <ideology group></code><br/>Ideology group of the party.<br/>
<code>desc = <localisation key></code><br/>A description used for the rule. Optional, defaults to being the same as default.<br/>
<code><rule> = <bool></code><br/>Rule's new value.
|<pre>set_party_rule = {
   ideology = democratic
   desc = TAG_my_rule_description
   can_create_factions = yes
}
</pre>
|Toggles the special game rules for the current scope's political party.
|
|1.12
|-id="add_relation_rule_override"
|add_relation_rule_override
|<code>target = <country></code><br/>Target of the rule.<br/>
<code>usage_desc = <localisation key></code><br/>A description used as the reason for the rule applying. Optional.<br/>
<code>trigger = <scripted trigger></code><br/>A [[scripted trigger]] deciding when the override should be active. Optional, defaults to always true.<br/>
<code><rule> = <bool></code><br/>Rule's new value.
|<pre>add_relation_rule_override = {
   target = SOV
   usage_desc = TAG_my_rule_description
   trigger = my_scripted_trigger
   can_access_market = yes
}
</pre>
|Toggles the special game rules for the current scope in diplomacy towards the specified country only, if the trigger is met.
|Currently <code>can_access_market</code> and <code>can_send_volunteers</code> are supported. In case of overlap, restricting actions is preferred (e.g. <code>can_send_volunteers = no</code> or <code>can_not_declare_war = yes</code> are preferred over the alternatives). In the scripted trigger, <code>ROOT</code> is the country with the override and <code>FROM</code> is the target.
|1.13
|-id="remove_relation_rule_override"
|remove_relation_rule_override
|<code>target = <country></code><br/>Target of the rule.<br/>
<code>usage_desc = <localisation key></code><br/>A description used as the reason for the rule applying. Optional.<br/>
<code>trigger = <scripted trigger></code><br/>A [[scripted trigger]] for identifying the relation rule.<br/>
<code><rule> = <bool></code><br/>Rule's new value.
|<pre>remove_relation_rule_override = {
   target = SOV
   usage_desc = TAG_my_rule_description
   can_access_market = yes
}
</pre>
|Removes the toggle added with [[#add_relation_rule_override|add_relation_rule_override]].
|
|1.13
<!-- Deprecated in 1.13:
|-id="set_relation_rule"
|set_relation_rule
|<code>target = <country></code><br/>Target of the rule.<br/>
<code>desc = <localisation key></code><br/>A description used for the rule. Optional, defaults to being the same as default.<br/>
<code><rule> = <bool></code><br/>Rule's new value.
|<pre>set_relation_rule = {
   target = SOV
   desc = TAG_my_rule_description
   can_not_declare_war = yes
}
</pre>
|Toggles the special game rules for the current scope in diplomacy towards the specified country only.
|
|
<code>launch_nuke = {<br />&nbsp;&nbsp;&nbsp; province = 42<br /> &nbsp;&nbsp;&nbsp; state = 42<br />&nbsp;&nbsp;&nbsp; controller = GER<br /> &nbsp;&nbsp;&nbsp; use_nuke = yes<br /> }</code>
|1.12
 
!-->
| 核爆一个省份
|-id="scoped_sound_effect"
 
|scoped_sound_effect
当仅提供地区参数的时候,敌人占领的省份优先核平
|<code><string></code><br>A sound reference from an .asset file.
 
|<pre>scoped_sound_effect = "boom"</pre>
| 需要核弹科技和核弹库存,使用的时候从库存里面删除一个核弹
|Plays the specified sound once only for the current country.
|The sound effect must be properly defined in {{path|sound/}} More info can be found in the [[Sound modding]] article.
|1.6
|1.6
|-
|-id="scoped_play_song"
| style="width: 157px" |inherit_technology
|scoped_play_song
| style="width: 395px" |转移一个国家的所有科技到另外一个国家
|<code><song title from .asset></code><br>A music file located in the music folder and .asset
|<code>inherit_technology = CAN</code>
|<pre>scoped_play_song = "general_peace_1"</pre>
|转移科技
|Plays an audio track for the specified country only.
|在内战的时候很有用. 作用域国家会继承Tag标识国家的所有科技,所以要小心作用域的问题
|The song must be defined in a music station in order to work. More information can be found in the [[Music modding]] page. If you wish to simply play a sound, the scoped_sound_effect effect should be used instead.
|1.6
|1.9.3
|-
|-id="goto_province"
| style="width: 157px" |set_fuel_ratio
|goto_province
| style="width: 395px" |设定一个国家的燃油存量(倍数)
|<code><id></code><br>The id of the province go to.
|<code>set_fuel_ratio</code>
|<pre>
|设置国家目前的燃料比。
goto_province = 325
|&nbsp;
</pre>
|1.6
|Moves the camera position over the specified province.
|-
| style="width: 157px" |add_mines
| style="width: 395px" |为当前国家在一个战略区域布雷
|<code>add_mines = { region = 42 amount = 100 }</code>
|在一个战略区域布雷
|&nbsp;
|
1.6
 
|-
| style="width: 157px" |give_resource_rights
| style="width: 395px" |给予资源使用权
|<code>give_resource_rights = { receiver = ENG state = 291 }</code>
|把一个省份的所有资源给予目标国家使用
|参见 04_mtg_on_actions
|1.6
|-
| style="width: 157px" |remove_resource_rights
| style="width: 395px" |剥夺资源使用权
|<code>ENG = { remove_resource_rights = 477 }</code>
| 剥夺先前给予的资源使用权
|&nbsp;
|1.6
|}
 
==任意作用域==
 
能在“国家”、“省份”或者“将领”这些作用域使用
 
===全局===
{{SVersion|1.5}}
 
{| class="wikitable sortable" width="100%"
! width="10%" |名字
! width="25%" | 参数
! width="25%" |示例
! width="20%" |描述
! width="15%" |注释
! width="5%" |添加
版本
|-
|set_global_flag
|<code><flag></code><br> 用于标识全局标志的唯一字符串
|<code>set_global_flag = my_flag</code>
| 定义一个全球Flag
|
|
|1.0
|1.0
|-
|-id="goto_state"
|clr_global_flag
|goto_state
|<code><flag></code><br>要清除的全局标志的唯一字符串
|<code><state> / <variable></code><br>The id of the state go to.
|<code>clr_global_flag = my_flag</code>
|<pre>
|清除一个全球Flag
goto_state = 1
|
</pre>
|1.0
|-
|modify_global_flag
|<code>flag = <flag></code><br>The global flag to modify.<br>
<code>value = <value></code><br>The value to set it to: 0 or 1<br>
|
<pre>
<pre>
modify_global_flag = {
goto_state = var:some_state
   flag = my_flag
   value = 1
}
</pre>
</pre>
| 修改一个全球Flag
|Moves the camera position over the specified state.
|推荐使用 [[Variables|变量]]
|1.0
|-
|custom_effect_tooltip
|<code><string></code><br>作为提示文字的本地化文本
|<code>custom_effect_tooltip = my_tooltip_tt</code>
|在效果提示文字内显示本地化文本
|
|
|1.0
|1.0
|-
|-id="change_tag_from"
|log
|change_tag_from
|<code><string></code><br> 显示在game.log里的文本
|<code><country> / <variable></code><br>The country to change from.<br>
|<code>log = "myVariable: [?myVariable]"</code>
|<pre>change_tag_from = ROOT</pre>
|当运行指令时将这行文本写入game.log
<pre>change_tag_from = var:from.country</pre>
|允许所有的本地化命令 (比如[Root.GetName]等)
|Switches the player to the current scope from the target scope. Nothing happens if the target scope is controlled by AI.
|1.5
|'''The country the player becomes needs to be the scope in which the command is used.''' For example, <code>ABC = { change_tag_from = XYZ }</code> will make the player controlling XYZ play as ABC instead.
|-
|save_event_target_as
|<code><string></code><br> 用于标识事件目标的唯一字符串
|<pre>
capital_scope = {
   save_event_target_as = my_state
}
</pre>
|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.<br>Do not use in Scripted GUIs.
|1.0
|1.0
|-
|-id="reserve_dynamic_country"
|save_global_event_target_as
|reserve_dynamic_country
|<code><string></code><br> 用于标识全局事件目标的唯一字符串
|<code><bool></code>
|<pre>random_other_country = {
|<pre>reserve_dynamic_country = yes</pre>
    save_global_event_target_as = my_country
|Reserves the dynamic country, making sure that it does not get recycled for civil war even if it does not exist.
|Usually used in combination with [[#create_dynamic_country|create_dynamic_country]].
|1.9
|-id="force_update_map_mode"
|force_update_map_mode
|<code>limit = { ... }</code><br/>Triggers required for the map mode to refresh. Optional.<br/>
<code>mapmode = <id></code><br/>The ID of the custom map mode.
|<pre>force_update_map_mode = {
   limit = {
     is_ai = no
   }
   mapmode = my_map_mode
}</pre>
|Forcefully refreshes the specified mapmode for the player, rather than waiting for a daily update.
|Map modes are defined in {{path|common/map_modes/*.txt}}
|1.11
|-id="add_ai_strategy"
|add_ai_strategy
|<code>type = <type></code><br/>The type of strategy.<br/>
<code>id = <country></code><br/>What country the strategy is against.<br/>
<code>value = <int></code><br/>The weighting added by the strategy.
|<pre>add_ai_strategy = {
   type = alliance
   id = GER
    value = 200
}
}
</pre>
</pre>
|Saves the current scope as a key. Persists after execution until cleared via effect.
|Sets an AI strategy for the current scope.
|Use event_target:<key> to access the scope.<br>Do not use in Scripted GUIs.
|See [[AI_modding|AI Modding]] for more details.
|1.0
|1.0
|-
|-id="create_dynamic_country"
|clear_global_event_target
|create_dynamic_country
|<code><string></code><br> 要清除的全局事件目标的唯一字符串
|<code>original_tag = <tag></code><br/>The original tag to be used by the country.<br/>
|<code>clear_global_event_target = my_country</code>
<code>copy_tag = <tag></code><br/>If specified, copies stuff from this tag rather than the original tag.<br/>
|Clears a specific global event target.
<code><effects></code><br/>Effects that will be executed on the new dynamic country.<br/>
|
|<pre>
create_dynamic_country = {
   original_tag = POL
   copy_tag = SOV
   add_political_power = 100
   transfer_state = 123
}
</pre>
|Creates a new dynamic country, akin to ones used in civil wars.
|The [[#reserve_dynamic_country|reserve_dynamic_country]] effect can be used if the dynamic country does not yet exist in order to ensure that it does not get overwritten by other creations of dynamic countries. If this is not done, the dynamic country will immediately stop existing if no states are transferred in the same scope.<br/>
Every state of the original country immediately gets set as a dynamic country's core: if that's unneeded, the cores would need to be removed after creation.
|1.9
|}
 
===States===
These effects in particular are country-scoped effects that are related to states rather than effects within the state scope.
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ class="nowrap" | State-related country-scoped effects:<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="add_state_core"
|add_state_core
|<code><state> / <variable></code><br/>The state to add core to.
|<pre>add_state_core = 345</pre>
|Adds a core for the current scope to the specified state.
|&nbsp;
|1.0
|1.0
|-
|-id="remove_state_core"
|clear_global_event_targets
|remove_state_core
|<code>yes</code><br>Boolean.
|<code><state> / <variable></code><br/>The state to remove core from.
|<code>clear_global_event_targets = yes</code>
|<pre>remove_state_core = 345</pre>
|Clears all global event targets.
|Removes the core of the current scope from the specified state.
|
|&nbsp;
|1.0
|-id="set_capital"
|set_capital
|<code>state = <state> / <variable></code><br/>The state to make capital.<br/>
<code>remember_old_capital = no</code><br/>Whether the old capital gets "remembered", making the country change to it in case the current capital is lost.
|<pre>set_capital = {state = 345}
 
 
set_capital = {
  state = 345
  remember_old_capital = no
}</pre>
|Makes the specified state the current scope's capital state.
|Syntax has been changed in 1.11.
It was "set_capital = 345"
 
 
Old capital is remembered, if not specified otherwise.
|1.0
|-id="add_state_claim"
|add_state_claim
|<code><state> / <variable></code><br/>The state to add a claim to.
|<pre>add_state_claim = 345</pre>
|Adds a claim for the current scope on the specified state.
|&nbsp;
|1.0
|1.0
|-
|-id="remove_state_claim"
|break
|remove_state_claim
|<code>None</code>
|<code><state> / <variable></code><br/>The state to remove the claim from.
|<code>break</code>
|<pre>remove_state_claim = 345</pre>
| 停止执行当前作用域内的指令
|Removes a claim of the current scope from the specified state.
|
|&nbsp;
|1.0
|1.0
|-
|-id="set_state_owner"
|sound_effect
|set_state_owner
|<code><string></code><br> 要播放的音频名字,要事先定义在sound.asset和soundeffects.asset中
|<code><state> / <variable></code><br/>The state to change ownership of.
|<code>sound_effect = "boom"</code>
|<pre>set_state_owner = 345</pre>
| 播放一段音效
|Makes the current scope the owner of the specified state.
| 不能被作用域限制,一旦播放,其他国家也能听到(偶然发现的,版本1.8.1,单人模式)
|This can fail to carry over the control, so it's recommended to instead use [[#transfer_state|transfer_state]] unless transferring the ownership without transferring over the control.
|1.0
|1.0
|-
|-id="set_state_controller"
|randomize_weather
|set_state_controller
|<code><int></code><br> 一个随机数种子(整数)
|<code><state> / <variable></code><br/>The state to change controller of.
|<code>randomize_weather = 12345</code>
|<pre>set_state_controller = 345</pre>
| 以特定的随机数种子随机生成天气
|Makes the current scope the controller of the specified state.
|
|
|1.0
|1.0
|-
|-id="transfer_state"
|set_province_name
|transfer_state
|<code>id = <id></code><br>要重命名的胜利点ID
|<code><state> / <variable></code><br/>The state to change owner and controller of.
<code>name = <string></code><br> 胜利点所要改成的名字
|<pre>transfer_state = 345</pre>
|<pre>
|Makes the current scope the owner and controller of the specified state.
set_province_name = {
|[[#transfer_state_to|transfer_state_to]] exists as a state-scoped variant.
   id = 325
|1.0
   name = "Funland"
|-id="set_province_controller"
}
|set_province_controller
</pre>
|<code><id></code><br/>The province to change controller of.
| 把某个胜利点的名字改为特定名字
|<pre>set_province_controller = 2999</pre>
|
|Changes the controller of the specified province to the current scope.
|1.3
|A peace conference or the controller being at peace will reset the control of the province to the owner unless the controller is at war with the owner.
|-
|reset_province_name
|<code><id></code><br>要复位的胜利点名字
|<pre>
reset_province_name = 325
</pre>
|重设特定胜利点的名字
|
|1.3
|-
|goto_province
|<code><id></code><br>要移动到的地块
|<pre>
goto_province = 325
</pre>
| 把视角移到特定地块
|
|1.0
|1.0
|-
|}
|goto_state
|<code><scope> / <variable></code><br>要移动到的省份
|<pre>
goto_state = 1
</pre>
<pre>
goto_state = var:some_state
</pre>
|把视角移到特定省份
|
|1.0
|-
|change_tag_from
|<code><scope> / <variable></code><br>要切换到的国家.<br>
|<pre>
GER = { change_tag_from = ROOT }
</pre>
<pre>
GER = { change_tag_from = var:from.country }
</pre>
|从当前国家切换到目标国家游玩
|注意:等号后面的是当前国家,指令前的作用域为目标国家
|1.0
|-
|add_region_efficiency
|
|
|
|
|1.5
|}
 
===边境冲突===


{| class="wikitable sortable" width="100%"
===Mana===
|-
Mana in this usage means political power, stability, war support, and other values in the topbar. Fuel is, instead, in the [[#Resources|resources section]], while convoys can be added/removed with [[#add_equipment_to_stockpile|add_equipment_to_stockpile]].
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ class="nowrap" | Mana-related country-scoped effects:<br/>
! width="10%" |Name
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Parameters
第759行: 第951行:
! width="20%" |Description
! width="20%" |Description
! width="15%" |Notes
! width="15%" |Notes
! width="5%" |Version Added
! width="5%" | Version Added
|-
|-id="add_political_power"
|start_border_war(发起边境冲突)
|add_political_power
|<code>change_state_after_war = <bool></code><br /> 在边境冲突结束后,该省份是否易手<br /><br>'''进攻方作用域'''<br /> <code>state = <id> / <variable></code><br /> 发起边境冲突的省份 .<br /> <code>num_provinces = <id></code><br /> 指定进攻方投入当前省份下的多少地块的部队发起边境冲突 .<br /> <code>on_win = <id></code><br /> 进攻方胜利所触发的事件 .<br /> <code>on_lose = <id></code><br /> 进攻方失败所触发的事件 .<br /> <code>on_cancel= <id></code><br /> 进攻方与对方陷入僵持时所触发的事件<br /><br> '''防守方作用域'''<br /> <code>state = <id> / <variable></code><br /> 因边境冲突而受到攻击的省份.<br /> <code>num_provinces = <id></code><br /> 指定防守方投入当前省份下的多少地块的部队发起边境冲突.<br /> <code>on_win = <id></code><br /> 防守方胜利所触发的事件<br /> <code>on_lose = <id></code><br /> 防守方失败所触发的事件.<br /> <code>on_cancel= <id></code><br /> 防守方与对方陷入僵持时所触发的事件
|<code><int> / <variable></code><br/>The amount to add.
|<pre>start_border_war = {
|<pre>add_political_power = 100</pre>
   change_state_after_war = no
<pre>add_political_power = var:my_var</pre>
   attacker = {
|Adds the specified amount of political power to the current scope.
     state = 527
|&nbsp;
     num_provinces = 4
|1.0
     on_win = japan_border_conflict.2
|-id="set_political_power"
     on_lose = japan_border_conflict.3
|set_political_power
     on_cancel = japan_border_conflict.4
|<code><int> / <variable></code><br/>The amount to add.
   }
|<pre>set_political_power = 100</pre>
|Sets the specified amount of political power for the current scope.
   defender = {
     state = 408
     num_provinces = 4
     on_win = japan_border_conflict.3
     on_lose = japan_border_conflict.2
     on_cancel = japan_border_conflict.4
   }
}
</pre>
 
| 指定一场边境冲突中的进攻方和防御方,且双方都是冲突区域省份的拥有者
|&nbsp;
|&nbsp;
|1.0
|-id="add_stability"
|add_stability
|<code><int> / <variable></code><br/>The amount to add.
|<pre>add_stability = 0.1</pre>
|Adds to the current stability value for the current scope.
|Stability values are between 0 and 1.
|1.5
|1.5
|-
|-id="set_stability"
|set_border_war_data
|set_stability
|<code>attacker = <id> / <variable></code><br /> 攻击方发起进攻的省份
|<code><int> / <variable></code><br/>The amount to add.
<code>defender = <id> / <variable></code><br />防守方进行防御的省份<br /> <code>attacker_modifier = <id> / <variable></code><br /> 应用于进攻方军队的修正<br /> <code>defender_modifier = <id> / <variable></code><br />  应用于防守方军队的修正<br /> <code>combat_width = <id> / <variable></code><br /> 边境冲突的战场宽度
|<pre>set_stability = 0.5</pre>
|<pre>set_border_war_data = {
|Sets the current stability value for the current scope.
   attacker = 527
|Stability values are between 0 and 1.
   defender = 408
|1.5
   defender_modifier = 0.15
|-id="add_war_support"
   combat_width = 100
|add_war_support
}
|<code><int> / <variable></code><br/>The amount to add.
</pre>
|<pre>add_war_support = 0.1</pre>
 
|Adds to the current war support value for the current scope.
| 设置双方的攻守加成或惩罚修正,在发起边境冲突后使用。
|War Support values are between 0 and 1.
|1.5
|-id="set_war_support"
|set_war_support
|<code><int> / <variable></code><br/>The amount to set.
|<pre>set_war_support = 0.5</pre>
|Sets the current war support value for the current scope.
|War Support values are between 0 and 1.
|1.5
|-id="add_command_power"
|add_command_power
|<code><int> / <variable></code><br/>The amount to add.
|<pre>add_command_power = 100</pre>
|Adds the specified amount of command power to the current scope.
|&nbsp;
|&nbsp;
|1.5
|1.5
|-
|-id="add_manpower"
|cancel_border_war
|add_manpower
|<code>attacker = <id> / <variable></code><br /> 攻击方发起进攻的省份
|<code><int> / <variable></code><br/>The amount to add.
<code>defender = <id> / <variable></code><br /> 防守方进行防御的省份<br /> <code>dont_fire_events = <bool></code><br />不触发'''start_border_war'''中有关的事件
|<pre>add_manpower = 100000</pre>
 
<pre>add_manpower = var:my_var</pre>
|<pre>cancel_border_war = {
|Adds the specified amount of manpower to the current scope.
   dont_fire_events = yes
   defender = 408
   attacker = 527
}
</pre>
 
| 取消当前的边境冲突而且没有胜者
|&nbsp;
|&nbsp;
|1.5
|1.0
|-
|-id="army_experience"
|finalize_border_war
|army_experience
|<code>attacker = <id> / <variable></code><br /> 攻击方发起进攻的省份
|<code><float> / <variable></code><br/>The amount to add.
<code>defender = <id> / <variable></code><br /> 防守方进行防御的省份<br /> <code>attacker_win = <bool></code><br /> 让进攻方获胜<br /> <code>defender_win = <bool></code><br /> 让防守方获胜
|<pre>army_experience = 10</pre>
 
|Adds the specified amount of army experience to the current scope.
|<pre>finalize_border_war = {
|&nbsp;
   attacker_win = yes
|1.0
   attacker = 527
|-id="navy_experience"
   defender = 408
|navy_experience
}
|<code><float> / <variable></code><br/>The amount to add.
</pre>
|<pre>navy_experience = 10</pre>
 
|Adds the specified amount of navy experience to the current scope.
| 结束一场边境冲突
|&nbsp;
|1.0
|-id="air_experience"
|air_experience
|<code><float> / <variable></code><br/>The amount to add.
|<pre>air_experience = 10</pre>
|Adds the specified amount of air experience to the current scope.
|&nbsp;
|&nbsp;
|1.5
|1.0
|}
|}
===Politics===


==国家作用域==
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
 
|+ class="nowrap" | Political country-scoped effects:<br/>
下列的指令必须在“国家”作用域使用
 
===整体===
 
{| class="wikitable sortable" width="100%"
|-
! width="10%" |Name
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Parameters
第847行: 第1,042行:
! width="15%" |Notes
! width="15%" |Notes
! width="5%" |Version Added
! width="5%" |Version Added
|-
|-id="set_politics"
|set_country_flag
|set_politics
|<code><flag></code><br /> An unique string to identify the country flag with.
|<code>ruling_party = <ideology></code><br/>The party to set.
|<code>set_country_flag = my_flag</code>
<code>elections_allowed = <bool></code><br/>Whether elections are allowed. Optional.<br/>
| 定义一个国家Flag
<code>last_election = <date></code><br/>When the last election was. Optional.<br/>
<code>election_frequency = <int></code><br/>How often in months an election occurs. Optional.<br/>
<code>long_name = <string></code><br/>The long name of the country's new ruling party, appearing when hovering over it. Optional.<br/>
<code>name = <string></code><br/>The name of the country's new ruling party. Optional.<br/>
|<pre>set_politics = {
   ruling_party = democratic
   elections_allowed = no
   last_election = "1935.12.17"
   election_frequency = 48
   long_name = TAG_party_long
   name = TAG_party
}
</pre>
|Sets the political status of the country, including the ruling party and elections.
|Before 1.7, included <code>parties = { ... }</code> for assigning party popularities, which has been moved to [[#set_popularities|set_popularities]]
|1.0 (updated 1.7)
|-id="set_popularities"
|set_popularities
|<code><ideology> = <int>/<variable></code><br/>The popularity to set.
|<pre>set_popularities = {
democratic = 50
neutrality = 15
fascism = 30
communism = 5
}
</pre>
|Sets the political party popularities for the current scope.
|&nbsp;
|&nbsp;
|1.0
The popularities must add up to 100, otherwise the command will have no effect.
|-
|1.7
|clr_country_flag
|-id="add_popularity"
|<code><flag></code><br /> The unique string of a country flag to clear.
|add_popularity
|<code>clr_country_flag = my_flag</code>
|<code>ideology = <ideology/tag></code><br/>The party to change. If using a tag, uses that tag's ruling party.
|清除一个国家Flag
<code>popularity = <int> / <variable></code><br/>The amount of popularity to change.
|&nbsp;
|<pre>add_popularity = {
|1.0
    ideology = fascism
|-
    popularity = -0.5
|modify_country_flag
|<code>flag = <flag></code><br /> 要修改的国家Flag
<code>value = <value></code><br /> 要设置的值,只能是0或1
 
|<pre>modify_country_flag = {
    flag = my_flag
    value = 1
}
}
</pre>
</pre>
|Adjusts the popularity for the specified party in the current scope.
|Values used are 0 to 1.


|修改一个国家Flag
|推荐使用 [[Variables|变量]]
|1.3
|-
|country_event
|<code>id = <event></code><br /> 要触发的事件
<code>days = <event> / <variable></code><br />在特定的天数内触发事件(可选)<br /> <code>hours = <event> / <variable></code><br /> 在特定的小时内触发事件(可选)<br /> <code>random = <event></code><br /> Adds a random number (between ''0'' and ''random'', inclusive) of '''hours''' to the scheduled fire time. Optional.


|<pre>country_event = {
You can use ideology = ROOT to increase the popularity of the currently ruling party.
   id = my_event.1
|1.0
    days = 10
|-id="set_political_party"
    random = 50
|set_political_party
|<code>ideology = <ideology></code><br/>The party to change.
<code>popularity = <int></code><br/>The amount of popularity to set.
|<pre>set_political_party = {
    ideology = fascism
    popularity = 50
}
}
</pre>
</pre>
 
|Sets the popularity for the specified political party in the current scope.
| 对特定国家触发事件
|&nbsp;
|Where triggers do not need to be repeatedly checked <code>random</code> can be a performance light alternative to <code>mean_time_to_happen</code> for scheduling events.
|1.0
|1.0
|-
|-id="set_party_name"
|news_event
|set_party_name
|<code>id = <event></code><br /> 要触发的新闻事件
|<code>ideology = <ideology></code><br/>The party to change.
<code>days = <event> / <variable></code><br /> 在特定的天数内触发事件(可选)<br /> <code>hours = <event> / <variable></code><br /> 在特定的天数内触发事件(可选)<br /> <code>random = <event></code><br /> Adds a random number (between ''0'' and ''random'', inclusive) of '''hours''' to the scheduled fire time. Optional.
<code>long_name = <string></code><br/>The new full name for the party.<br/><code>name = <string></code><br/>The new short name for the party.
 
|<pre>set_party_name = {
|<pre>news_event = {
    ideology = neutrality
    id = my_event.1
    long_name = GER_neutrality_party_kaiserreich_long
    days = 10
    name = GER_neutrality_party_kaiserreich
    random = 50
}
}
</pre>
</pre>
 
|Changes the name of the specified political party for the current scope.
| 对特定国家触发新闻事件
|The name appears in the country politics/diplomacy view, the long name appears in the tooltip when hovering over the party.
| 新闻事件和普通事件所显示的界面不同
|1.0
Where triggers do not need to be repeatedly checked <code>random</code> can be a performance light alternative to <code>mean_time_to_happen</code> for scheduling events.
|-id="hold_election"
 
|hold_election
|<code><country></code><br/>The country to hold an election for.
|<pre>hold_election = ROOT</pre>
|Executes the events in the '''on_new_term_election''' on action for the current scope.
|
|1.0
|1.0
|-
|}
|set_cosmetic_tag(设置显示动态Tag)
|<code><string></code><br /> 设置一个动态Tag以更改旗帜、国名(注意:此代码无法改变国家初始tag,只会更改其显示)
|<pre>set_cosmetic_tag = SAF_SOV_communism</pre>


|Makes the current scope use the specified cosmetic tag, changing name and flag.
===Balance of power===
|&nbsp;
<noinclude>Balance of power is defined in {{path|common/bop/*.txt}} files.
|1.3
</noinclude>
|-
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|drop_cosmetic_tag
|+ class="nowrap" | Balance of power-related country-scoped effects:<br/>
|<code><bool></code><br /> Boolean.
! width="10%" |Name
|<pre>drop_cosmetic_tag = yes</pre>
! width="25%" |Parameters
 
! width="25%" |Examples
|Makes the current scope drop the current cosmetic tag they are using.
! width="20%" |Description
|&nbsp;
! width="15%" |Notes
|1.3
! width="5%" |Version Added
|-
<noinclude>
|set_rule
|-id="set_power_balance"
|<code><rule></code><br /> Boolean.
|set_power_balance
|<pre>set_rule = {
|<code>id = <BoP ID></code><br/>Balance of power to set/modify.<br/>
    can_create_factions = yes
<code>left_side = <BoP side ID></code><br/>The left side of the BoP.<br/>
}
<code>right_side = <BoP side ID></code><br/>The right side of the BoP.<br/>
</pre>
<code>set_default = <bool></code><br/>Resets the BoP to the initial state defined in the file. Optional, defaults to false.<br/>
 
<code>set_value = <decimal></code><br/>The new value of the BoP. Optional, defaults to not changing the value.
| 为当前作用域应用特定的游戏规则
|<pre>set_power_balance = {
|Possible rules:
    id = my_bop
 
   left_side = my_bop_left_side
*can_be_called_to_war
   right_side = my_bop_right_side
*can_boost_other_ideologies
}</pre>
*can_create_factions
|Sets a new balance of power or edits the existing one.
*can_declare_war_on_same_ideology
|Necessary for a balance of power to appear. For the default state, <code>initial_value</code>, <code>left_side</code>, and <code>right_side</code> directly inside of the BoP are read.
*can_declare_war_without_wargoal_when_in_war
|1.12</noinclude>
*can_decline_call_to_war
|-id="remove_power_balance"
*can_force_government
|remove_power_balance
*can_generate_female_aces
|<code>id = <BoP ID></code><br/>Balance of power to modify.
*can_guarantee_other_ideologies
|<pre>remove_power_balance = {
*can_join_factions
   id = my_bop
*can_join_factions_not_allowed_diplomacy
}</pre>
*can_join_opposite_factions
|Removes the balance of power in entirety.
*can_lower_tension
*can_not_declare_war
*can_occupy_non_war
*can_puppet
*can_send_volunteers
*can_only_justify_war_on_threat_country
*can_use_kamikaze_pilots
*units_deployed_to_overlord (subjects only)
 
|1.0
|-
|add_dynamic_modifier
|<code>modifier = <modifier_string></code><br /> The name of the Modifier.
<code>scope = <scope></code>
 
<nowiki>#</nowiki>optional, specify if it is specified while adding the modifier
|add_dynamic_modifier = { modifier = my_modifier }
|添加dynamic modifier
|
|
|1.12
|-id="add_power_balance_value"
|add_power_balance_value
|<code>id = <BoP ID></code><br/>Balance of power to modify.<br/>
<code>value = <decimal></code><br/>The value to add.<br/>
<code>tooltip_side = <BoP side ID></code><br/>The side to show in the tooltip. Optional.<br/>
|<pre>add_power_balance_value = {
   id = my_bop
   value = -0.1
   tooltip_side = my_bop_side
}</pre>
|Pushes the balance of power towards one side.
|
|
|-
|1.12
|remove_dynamic_modifier
|-id="add_power_balance_modifier"
|<code>modifier = <modifier_string></code><br /> The name of the Modifier.
|add_power_balance_modifier
<code>scope = <scope></code>
|<code>id = <BoP ID></code><br/>Balance of power to modify.<br/>
 
<code>modifier = <static modifier></code><br/>The [[Static modifiers|static modifier]] to apply.
<nowiki>#</nowiki>optional, specify if it is specified while adding the modifier
|<pre>add_power_balance_modifier = {
|remove_dynamic_modifier = { modifier = my_modifier }
   id = my_bop
| 移除dynamic modifier
   modifier = my_static_modifier
}</pre>
|Applies a balance of power modifier.
|
|
|1.12
|-id="remove_power_balance_modifier"
|remove_power_balance_modifier
|<code>id = <BoP ID></code><br/>Balance of power to modify.<br/>
<code>modifier = <static modifier></code><br/>The [[Static modifiers|static modifier]] to apply.
|<pre>remove_power_balance_modifier = {
   id = my_bop
   modifier = my_static_modifier
}</pre>
|Cancels a balance of power modifier.
|
|
|-
|1.12
|force_update_dynamic_modifier
|-id="remove_all_power_balance_modifiers"
|<code><bool></code><br /> Boolean.
|remove_all_power_balance_modifiers
|force_update_dynamic_modifier = yes
|<code>id = <BoP ID></code><br/>Balance of power to modify.
|强制刷新dynamic modifier
|<pre>remove_all_power_balance_modifiers = {
|
   id = my_bop
}</pre>
|Cancels all balance of power modifiers.
|
|
|1.12
|-id="set_power_balance_gfx"
|set_power_balance_gfx
|<code>id = <BoP ID></code><br/>Balance of power to modify.<br/>
<code>side = <BoP side ID></code><br/>The side whose GFX to change.<br/>
<code>gfx = <sprite></code><br/>The sprite to change the GFX to.
|<pre>set_power_balance_gfx = {
   id = my_bop
   side = my_bop_side
   gfx = GFX_my_bop_side_new
}</pre>
|Changes the appearance of one of the sides within the balance of power.
|Sprites are defined within {{path|interface/*.gfx}} files.
|1.12
|}
|}


=== 地区===
===Diplomacy===


{| class="wikitable sortable" width="100%"
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|-
|+ class="nowrap" |{{nowrap|Diplomatic country-scoped effects:<br/>}}
! width="10%" |Name
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Parameters
第995行: 第1,230行:
! width="15%" |Notes
! width="15%" |Notes
! width="5%" |Version Added
! width="5%" |Version Added
|-
|-id="set_major"
|add_state_core
|set_major
|<code><scope> / <variable></code><br /> 添加省份核心
|<code><bool></code><br/>Boolean.
|<pre>add_state_core = 345</pre>
|<pre>set_major = yes</pre>
 
|Makes the current scope a major country.
| 为当前作用域添加省份核心
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|-id="create_faction"
|remove_state_core
|create_faction
|<code><scope> / <variable></code><br /> 移除省份核心
|<code><string></code><br/>The name of the faction.
|<pre>remove_state_core = 345</pre>
|<pre>create_faction = MY_FACTION_NAME</pre>
 
|Creates a faction with the specified name for the current scope. The current scope and any subjects automatically join the faction.
| 移除当前作用域的省份核心
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|-id="add_to_faction"
|set_capital
|add_to_faction
|<code><scope> / <variable></code><br /> 将指定省份设置为首都
|<code><TAG></code><br/>The TAG of the nation to add to the faction of the current scope.
|<pre>set_capital = { state = 562 }</pre>
|<pre>FACTION_LEADER_TAG = { add_to_faction = TAG_TO_ADD }</pre>
 
|Adds the TAG_TO_ADD to the faction of the FACTION_LEADER_TAG.
| 将特定的省份设置为当前作用域的首都
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|-id="leave_faction"
|add_state_claim
|leave_faction
|<code><scope> / <variable></code><br /> 对当前省份添加领土宣称
|<code><bool></code><br/>Boolean.
|<pre>add_state_claim = 345</pre>
|<pre>leave_faction = yes</pre>
 
|Removes the current scope from the faction they are part of.
| 添加当前作用域对省份的领土宣称
|&nbsp;
|&nbsp;
|1.0
|1.5
|-
|-id="remove_from_faction"
|remove_state_claim
|remove_from_faction
|<code><scope> / <variable></code><br /> 移除当前省份的领土宣称
|<code><TAG></code><br/>The target country.
|<pre>remove_state_claim = 345</pre>
|<pre>remove_from_faction = TAG_TO_REMOVE</pre>
 
|Removes the specified scope from the faction led by the current scope.
| 移除当前作用域对省份的领土宣称
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|-id="dismantle_faction"
|set_state_owner
|dismantle_faction
|<code><scope> / <variable></code><br /> 设置省份的拥有者
|<code><bool></code><br/>Boolean.
|<pre>set_state_owner = 345</pre>
|<pre>dismantle_faction = yes</pre>
 
|Dismantles the faction of the current scope.
| 将当前作用域设置为省份的拥有者
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|-id="set_faction_name"
|set_state_controller
|set_faction_name
|<code><scope> / <variable></code><br /> 设置省份的实际控制者
|Sets a faction name as the loc name.
|<pre>set_state_controller = 345</pre>
|<pre>set_faction_name = SOME_LOC_KEY</pre>
 
|Changes faction names.
| 将当前作用域设置为省份的实际控制者
|&nbsp;
|&nbsp;
|1.6
|-id="set_faction_leader"
|set_faction_leader
|<code><bool></code>
|<pre>set_faction_leader = yes</pre>
|Sets the current country as the faction leader.
|
|1.0
|1.0
|-
|-id="set_faction_spymaster"
|transfer_state
|set_faction_spymaster
|<code><scope> / <variable></code><br /> 改变省份的拥有者和实际控制者
|<code><bool></code>
|<pre>transfer_state = 345</pre>
|<pre>set_faction_spymaster = yes</pre>
 
|Sets the current country as the faction spymaster.
| 将当前作用域设置为省份的拥有者和实际控制者
|
|&nbsp;
|1.9
|-id="release"
|release
|<code><country></code><br/>The target country.
|<pre>release = GER</pre>
|Releases the specified non-existent country as a free nation within the current country's owned states.
|The effect does nothing if the country exists. All states that are cored by the specified country will be given to it. If the current country has a core on a state transferred to the released country, the core will be lost. If looking to make a subject into an independent nation, use set_autonomy. States that are owned but not controlled will be transferred to the released country, but won't be controlled by it.
|1.0
|1.0
|-
|-id="release_on_controlled"
|set_province_controller
|release_on_controlled
|<code><id></code><br /> 设置地块的实际控制者
|<code><country></code><br/>The target country.
|<pre>set_province_controller = 2999</pre>
|<pre>release_on_controlled = GER</pre>
 
|Releases the specified non-existent country as a free nation within the current country's controlled states.
| 将当前作用域设置为地块的实际控制者(仅在战时可用)
|The effect does nothing if the country exists. All states that are cored by the specified country will be given to it. If the current country has a core on a state transferred to the released country, the core will be lost.
|&nbsp;
|1.9.1
|-id="release_puppet"
|release_puppet
|<code><country></code><br/>The target country.
|<pre>release_puppet = GER</pre>
|Releases the specified non-existent country as a puppet of the current scope within the current country's owned states.
|The effect does nothing if the country exists. All states that are cored by the specified country will be given to it. If the current country has a core on a state transferred to the released country, the core will be lost. States that are owned but not controlled will be transferred to the released country, but won't be controlled by it.
|1.0
|1.0
|}
|-id="release_puppet_on_controlled"
 
|release_puppet_on_controlled
===政治力量===
|<code><country></code><br/>The target country.
 
|<pre>release_puppet_on_controlled = GER</pre>
{| class="wikitable sortable" width="100%"
|Releases the specified non-existent country as a puppet of the current scope within the current country's controlled states.
|-
|The effect does nothing if the country exists. All states that are cored by the specified country will be given to it. If the current country has a core on a state transferred to the released country, the core will be lost.
! width="10%" |Name
|1.9.1
! width="25%" |Parameters
|-id="release_autonomy"
! width="25%" |Examples
|release_autonomy
! width="20%" |Description
|<code>target = <country> / <variable></code><br/>The subject country.
! width="15%" |Notes
<code>autonomy_state = <type></code><br/>The type of autonomy state to set.<br/><code>freedom_level = <float></code><br/>The new freedom level value. Optional.
! width="5%" |Version Added
|<pre>release_autonomy = {
|-
   target = VIN
|add_political_power
   autonomy_state = autonomy_puppet
|<code><int> / <variable></code><br /> 数量
   freedom_level = 0.5
|<pre>add_political_power = 100</pre>
}
<pre>add_political_power = var:my_var</pre>
</pre>
 
|Releases the specified non-existent country as a subject of the specified autonomy of the current scope within the current country's owned states.
| 为当前作用域增加特定数量的政治点数
|The effect does nothing if the country exists. All states that are cored by the specified country will be given to it. If the current country has a core on a state transferred to the released country, the core will be lost. States that are owned but not controlled will be transferred to the released country, but won't be controlled by it. The autonomy states are found in {{path|common/autonomous_states/*.txt}}.
|&nbsp;
|1.3
|-id="give_guarantee"
|give_guarantee
|<code><country></code><br/>The target country.
|<pre>give_guarantee = GER</pre>
|The current scope guarantees the target country.
|[[#diplomatic_relation|diplomatic_relation]] effect can be used to remove it.
|1.0
|-id="give_military_access"
|give_military_access
|<code><country></code><br/>The target country.
|<pre>give_military_access = GER</pre>
|The current scope grants military access to the target country.
|[[#diplomatic_relation|diplomatic_relation]] effect can be used to remove it.
|1.0
|1.0
|-
|-id="recall_attache"
|set_political_power
|recall_attache
|<code><int> / <variable></code><br /> 数量
|<code><country></code><br/>The target country with an attache.
|<pre>set_political_power = 100</pre>
|<pre>recall_attache = GER</pre>
 
|Recalls the current scope's attaché from the specified country.
| 为当前作用域设定特定数量的政治点数
|&nbsp;
|&nbsp;
|1.0
|-
|add_stability
|<code><int> / <variable></code><br /> 数量
|<pre>add_stability = 0.1</pre>
|为当前作用域增加特定数量的稳定度
|稳定度的值在0到1之间
|1.5
|1.5
|-
|-id="diplomatic_relation"
|set_stability
|diplomatic_relation
|<code><int> / <variable></code><br /> The amount to add.
|<code>country = <country></code><br/>The target country to alter the relationship with ROOT.
|<pre>set_stability = 0.5</pre>
<code>relation = <type></code><br/>The relation to change.<br/><code>active = <bool></code><br/>Whether the relation is started or broken.
 
|<pre>diplomatic_relation = {
|为当前作用域设定特定数量的稳定度
   country = SOV
|稳定度的值在0到1之间
   relation = guarantee
|1.5
   active = no
|-
}
|add_war_support
</pre>
|<code><int> / <variable></code><br /> The amount to add.
|Used to define a diplomatic relation between the current scope and target scope country.
|<pre>add_war_support = 0.1</pre>
|Possible relations:
 
*non_aggression_pact
|为当前作用域增加特定数量的战争支持度
*guarantee
|战争支持度的值在0到1之间
*puppet
|1.5
*military_access
|-
*docking_rights
|set_war_support
*embargo
|<code><int> / <variable></code><br /> The amount to set.
|1.0
|<pre>set_war_support = 0.5</pre>
|-id="add_opinion_modifier"
 
|add_opinion_modifier
|为当前作用域设定特定数量的战争支持度
|<code>target = <country></code><br/>The target country.
|战争支持度的值在0到1之间
<code>modifier = <modifier></code><br/>The opinion modifier to add.
|1.5
|<pre>add_opinion_modifier = {
|-
   target = GER
|add_command_power
   modifier = faction_traitor
|<code><int> / <variable></code><br /> The amount to add.
}
|<pre>add_command_power = 100</pre>
</pre>
 
|The current scope gains the specified opinion modifier '''towards the target scope'''. Can also be used to modify trade relations by adding 'trade = yes' in the opinion <modifier> in {{path|common/opinion_modifiers/*.txt}}. If used with a trade opinion_modifier the behaviour is reversed, meaning that the target gains the trade opinion towards the '''current scope'''.
| 为当前作用域增加特定数量的指挥点数
|Opinion modifiers are found in {{path|common/opinion_modifiers/*.txt}}.
|&nbsp;
|1.5
|}
 
===政治===
 
{| class="wikitable sortable" width="100%"
|-
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-
|kill_ideology_leader
|<code><ideology></code><br /> 意识形态
|<pre>kill_ideology_leader = communism</pre>
 
|杀死当前作用域下特定意识形态的领袖
|&nbsp;
|1.9
|-
|retire_ideology_leader
|<code><ideology></code><br /> 意识形态
|<pre>retire_ideology_leader = fascism</pre>
 
|移除当前作用域下特定意识形态的领袖并使其退休
|&nbsp;
|1.9
|-
|kill_country_leader
|<code><bool></code><br /> Boolean.
|<pre>kill_country_leader = yes</pre>
 
| 杀死当前作用域的国家元首
|&nbsp;
|1.0
|1.0
|-
|-id="remove_opinion_modifier"
|retire_country_leader
|remove_opinion_modifier
|<code><bool></code><br /> Boolean.
|<code>target = <country></code><br/>The target country.
|<pre>retire_country_leader = yes</pre>
<code>modifier = <modifier></code><br/>The opinion modifier to remove.
 
|<pre>remove_opinion_modifier = {
| 移除当前作用域的国家元首并使其退休
   target = GER
|&nbsp;
   modifier = faction_traitor
}
</pre>
|The current scope loses the specified opinion modifier '''towards the target scope'''.
|Opinion modifiers are found in {{path|common/opinion_modifiers/*.txt}}.
|1.0
|1.0
|-
|-id="reverse_add_opinion_modifier"
|set_country_leader_ideology
|reverse_add_opinion_modifier
|<code><government></code><br /> The government to set.
|<code>target = <country></code><br/>The target country.
|<pre>set_country_leader_ideology = socialism</pre>
<code>modifier = <modifier></code><br/>The opinion modifier to add.
 
|
| 改变国家元首所属的党派(实际上是更改意识形态)
<pre>reverse_add_opinion_modifier = {
|&nbsp;
   target = GER
   modifier = faction_traitor
}
</pre>
|The target scope gains the specified opinion modifier '''towards the current scope'''.
|Opinion modifiers are found in {{path|common/opinion_modifiers/*.txt}}.<br>Useful for when you don't know what the current scope will be.
|1.0
|1.0
|-
|-id="add_relation_modifier"
|add_country_leader_trait
|add_relation_modifier
|<code><trait></code><br /> The trait to add.
|<code>target = <country></code><br/>The target country.
|<pre>add_country_leader_trait = nationalist_symbol</pre>
<code>modifier = <modifier></code><br/>The relation modifier to add.
 
|<pre>add_relation_modifier = {
|为当前作用域的国家元首添加特性
    target = SWE
| '''特性'''参见 {{path|common/country_leader/*.txt}}.
    modifier = HUN_dynastic_ties_license
|1.0
}
|-
|remove_country_leader_trait
|<code><trait></code><br /> The trait to remove.
|<pre>remove_country_leader_trait = nationalist_symbol</pre>
 
|移除当前作用域的国家元首的特性
| '''特性'''参见 {{path|common/country_leader/*.txt}}.
|1.0
|-
|hold_election
|<code><scope></code><br /> The country to hold an election for.
|<pre>hold_election = ROOT</pre>
 
|为当前作用域执行在'''on_new_term_election'''内的事件(在On Actions文件里)
|&nbsp;
|1.0
|-
|add_popularity(更改支持率)
|<code>ideology = <ideology></code><br /> 指定需更改支持率的党派意识形态
<code>popularity = <int> / <variable></code><br /> 该党派支持率变更的具体数值
 
|<pre>add_popularity = {
    ideology = fascism
    popularity = -0.5
}
</pre>
</pre>
 
|The current scope gains the specified relation modifier '''towards the target scope'''.
| 在当前作用域里修改党派的支持率
|Relation modifiers are found in {{path|common/modifiers/*.txt}} files, used to apply a [[Modifiers#Targeted modifiers|targeted modifier]] with a non-static target. To change the diplomatic opinion of a country, see [[#add_opinion_modifier|add_opinion_modifier]].
|Values used are 0 to 1.
|1.4
|1.0
|-id="remove_relation_modifier"
|-
|remove_relation_modifier
|set_politics
|<code>target = <country></code><br/>The target country.
|<code>ruling_party = <ideology></code><br /> The party to set
<code>modifier = <modifier></code><br/>The relation modifier to remove.
<code>elections_allowed = <bool></code><br /> Whether elections are allowed. Optional.<br /> <code>last_election = <date></code><br /> When the last election was. Optional.<br /> <code>election_frequency = <int></code><br /> How often in months an election occurs. Optional.<br />
|<pre>remove_relation_modifier = {
 
   target = SWE
|<pre>set_politics = {
   modifier = HUN_dynastic_ties_license
ruling_party = neutrality
}
}
</pre>
</pre>
 
|The current scope loses the specified relation modifier for '''towards the target scope'''.
|Sets the political party setup for the current scope.
|Relation modifiers are found in {{path|common/modifiers/*.txt}}, used to apply a [[Modifiers#Targeted modifiers|targeted modifier]] with a non-static target. To change the diplomatic opinion of a country, see [[#remove_opinion_modifier|remove_opinion_modifier]].
|&nbsp;
|1.4
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
|-id="add_collaboration"
|1.0 (Updated 1.7)
|add_collaboration
|<code>target = <country></code><br/>The target country.
<code>value = <0-1></code><br/>How much collaboration to add.
|<pre>add_collaboration = {
   target = TAG
   value = 0.3
}</pre>
|Adds collaboration in TAG with the scoped country.
|
|1.9
|-id="set_collaboration"
|set_collaboration
|<code>target = <country></code><br/>The target country.
<code>value = <0-1></code><br/>How much collaboration will be set.
|<pre>set_collaboration = {
   target = TAG
   value = 0.3
}</pre>
|Sets the collaboration in TAG with the scoped country.
|
|1.9
|-id="recall_volunteers_from"
|recall_volunteers_from
|<code><tag></code><br/>The target country.
|<pre>recall_volunteers_from = SPR</pre>
|Recalls volunteers sent to the specified country back to the current country.
|
|1.9
|-id="set_occupation_law"
|set_occupation_law
|<code><law ID></code><br/>The new occupation law enacted by the previous scope or <code>default_law</code>.
|<pre>USA = { GER = { set_occupation_law = foreign_civilian_oversight } } # Changes USA's occupation law for GER.</pre>
<pre>USA = { USA = { set_occupation_law = default_law } } # Changes the USA's default occupation law to the default.</pre>
|Sets the occupation law of the country.
|[[Scopes#PREV usage|PREV]] will be the country for whom the occupation law will be changed. If PREV is not a country, nothing changes. If PREV is the same country, changes the default occupation law. If PREV is different, default_law resets the country-specific law to the global default, otherwise it resets the default law to the occupation law with <code>starting_law = yes</code> in definition.
|1.12
|-id="set_occupation_law_where_available"
|set_occupation_law_where_available
|<code><law ID></code><br/>The new occupation law enacted by the previous scope or <code>default_law</code>.
|<pre>USA = { GER = { set_occupation_law_where_available = foreign_civilian_oversight } } # Changes USA's occupation law for GER where possible.</pre>
<pre>USA = { USA = { set_occupation_law_where_available = default_law } } # Changes the USA's default occupation law to the default where possible.</pre>
|Sets the occupation law of the country.
|Identical to [[#set_occupation_law|set_occupation_law]], except if the law is impossible to set, tries again at every smaller sub-set: if default is impossible, tries every single individual occupied country; if the country's law is impossible to change, tries every single state within the country.
|1.12
|-
|-
|<ideology>_drift(每日增长多少支持率)
|send_embargo
|<code><ideology>_drift = <int> / <variable></code><br /> 意识形态支持度每日增长
|<code><tag></code><br/>The target country.
 
|<pre>send_embargo = ITA</pre>
|<pre>fascism_drift = 0.01
|Embargos the target country.
</pre>
 
| 在当前作用域里每日修改的党派支持度
|
|
|1.0
|1.12
|-
|break_embargo
|<code><tag></code><br/>The target country.
|<pre>break_embargo = ITA</pre>
|Stops embargoing the target country.
|As of 1.14.7, this effect ignores country scoping and always applies to the ROOT, instead the [[#diplomatic_relation|diplomatic_relation]] effect can be used to break the embargoes of other countries.
|1.12
|-
|-
|set_politics
|give_market_access
|<code>ruling_party = <ideology></code><br /> The party to set
|<code><tag></code><br/>The target country.
<code>elections_allowed = <bool></code><br /> Whether elections are allowed. Optional.<br /> <code>last_election = <date></code><br /> When the last election was. Optional.<br /> <code>election_frequency = <int></code><br /> How often in months an election occurs. Optional.<br />
|<pre>give_market_access = ITA</pre>
|Opens market access between the two countries.
|
|1.13
|}


|<pre>set_politics = {
===Autonomy===
ruling_party = neutrality
{{anchor|Subjects}}
}
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
</pre>
|+ class="nowrap" | Autonomy-related country-scoped effects:<br/>
 
! width="10%" |Name
|Sets the political party setup for the current scope.
! width="25%" |Parameters
|&nbsp;
! width="25%" |Examples
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
! width="20%" |Description
|1.0 (Updated 1.7)
! width="15%" |Notes
|-
! width="5%" |Version Added
|set_popularities
|-id="puppet"
|<code><ideology> = <int>/<variable></code><br /> The popularity to set.
|puppet
|<pre>set_popularities = {
|<code><country></code><br/>The target country.<br/>
democratic = 50
'''OR'''<br/>
neutrality = 15
<code>target = <country></code><br/>The target country.<br/>
fascism = 30
<code>end_wars = <bool></code><br/>Whether the target country will peace out in all of its non-civil wars it's participating in. Defaults to true.<br/>
communism = 5
<code>end_civil_wars = <bool></code><br/>Whether the target country will peace out in all of its civil wars it's participating in. Defaults to true.<br/>
|<pre>puppet = GER</pre>
<pre>puppet = {
   target = ITA
   end_wars = no
}</pre>
|Makes the specified country a subject of the current scope.
|The autonomous state picked is one which contains <code>default = yes</code> and where <code>allowed = { ... }</code> is fulfilled within the {{path|commmon/autonomous_states/}} definition, rather than necessarily being autonomy_puppet. '''Results in a crash-to-desktop if the game is unable to find any such autonomous states.'''
|1.0
|-id="end_puppet"
|end_puppet
|<code><country></code><br/>The target country.
|<pre>end_puppet = GER</pre>
|Removes the subject status between the target and the current scope.
|Must be used within the overlord's scope.
|1.0
|-id="add_autonomy_ratio"
|add_autonomy_ratio
|<code>value = <float></code><br/>The freedom score to add.
<code>localization = <string></code><br/>The localization key for the modifier.
|<pre>add_autonomy_ratio = {
   value = 0.1
   localization = AST_adopt_westminster
}
}
</pre>
</pre>
 
|Adds a freedom score ratio modifier to the current scope.
|Sets the political party popularities for the current scope.
|Used in the subject's scope.
|&nbsp;
|1.3
The popularities must add up to 100, otherwise the command will have no effect.
|-id="add_autonomy_score"
|1.7
|add_autonomy_score
|-
|<code>value = <float></code><br/>The freedom score to add.
|set_political_party
<code>localization = <string></code><br/>The localization key for the modifier.
|<code>ideology = <ideology></code><br /> The party to change
|<pre>add_autonomy_score = {
<code>popularity = <int></code><br /> The amount of popularity to set.
   value = 10
 
   localization = EXAMPLE
|<pre>set_political_party = {
}
    ideology = fascism
</pre>
    popularity = 50
|Adds an exact freedom score modifier to the current scope.
|Used in the subject's scope.
|1.3
|-id="set_autonomy"
|set_autonomy
|<code>target = <country> / <variable></code><br/>The subject country.
<code>autonomous_state = <type></code><br/>The type of autonomy state to set.<br/>
<code>freedom_level = <float></code><br/>The new freedom level value. Optional.<br/>
<code>end_wars = <yes/no></code><br/>Will end any wars the subject is involved in.<br/>
<code>end_civil_wars = <yes/no></code><br/>Will end any civil wars the subject is subject to<br/>
|<pre>set_autonomy = {
    target = AST
   autonomous_state = autonomy_free
    end_wars = no
   end_civil_wars = no
}
}
</pre>
</pre>
|Sets the autonomy level for the specified country, '''including independence'''.
|The autonomy_free state will free the subject, '''however this effect has to be executed within the scope of the target country's current overlord''' for this to have effect. The autonomy states are found in {{path|common/autonomous_states/*.txt}} files. Although end_wars is an optional argument defaulting to no, omitting it results in the country's occupied states returning to its control, stranding enemy units.
|1.3
|}


|Sets the popularity for the specified political party in the current scope.
===Governments in exile===
|&nbsp;
|1.0
|-
|set_party_name(设置党派名称)
|<code>ideology = <ideology></code><br /> 指定更改名称的党派
<code>long_name = <string></code><br /> 指定党派更改名称的全名 <br /> <code>name = <string></code><br /> 指定党派更改名称的简称


|<pre>set_party_name = {
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
   ideology = neutrality
|+ class="nowrap" | Government in exile-related country-scoped effects:<br/>
   long_name = GER_neutrality_party_kaiserreich_long
! width="10%" |Name
   name = GER_neutrality_party_kaiserreich
! width="25%" |Parameters
}
! width="25%" |Examples
</pre>
! width="20%" |Description
 
! width="15%" |Notes
|Changes the name of the specified political party for the current scope.
! width="5%" | Version Added
|-id="add_legitimacy"
|add_legitimacy
|Adds legitimacy to a government in exile.
|<pre>add_legitimacy = 10</pre>
|Adds legitimacy.
|&nbsp;
|&nbsp;
|1.0
|1.6
|-
|-id="set_legitimacy"
|create_country_leader
|set_legitimacy
|<code>name = <string></code><br /> The name of the leader
|Sets the legitimacy of governments in exile.
<code>desc = <string></code><br /> The description of the leader.<br /> <code>picture = <string></code><br /> The graphical reference to the leader portrait.<br /> <code>expire = <string></code><br /> When the leader dies in history.<br /> <code>ideology = <string></code><br /> The ideology government the leader belongs to.<br /> '''Traits scope'''<br /> <code><trait></code><br /> The trait to add. Can add multiple.
|<pre>set_legitimacy = 10</pre>
 
|Sets legitimacy.
|<pre>create_country_leader = {
|&nbsp;
name = "Mohammed Zahir Shah"
|1.6
desc = "POLITICS_MOHAMMED_ZAHIR_SHAH_DESC"
|-id="become_exiled_in"
picture = "Portrait_Afghanistan_Mohammed_Zahir_Shah.dds"
|become_exiled_in
expire = "1965.1.1"
|Makes a country a government in exile in a set country, with a set starting legitimacy.
ideology = despotism
|<pre>become_exiled_in = { target = <Host tag> legitimacy = <0-100> (starting legitimacy, optional) }</pre>
traits = {
|Creates a government in exile.
|Must be fired from ROOT, the country that should be exiled, or a TAG specification must be used.
}
|1.6
}
|-id="end_exile"
</pre>
|end_exile
 
|Ends a government in exile.
|<pre>end_exile = yes</pre>
|Ends a government in exile.
|&nbsp;
|&nbsp;
|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).
|1.6
With just the name, the image must be in a folder that matches the tag of the current scope, for example {{path|gfx/leaders/GER/custom_pic.dds}}.
 
|1.0
|}
|}
===War===


===外交===
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
 
|+ class="nowrap" | War-related country-scoped effects:<br/>
{| class="wikitable sortable" width="100%"
|-
! width="10%" |Name
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Parameters
第1,342行: 第1,627行:
! width="15%" |Notes
! width="15%" |Notes
! width="5%" |Version Added
! width="5%" |Version Added
|-
|-id="add_threat"
|set_major
|add_threat
|<code><bool></code><br /> 布尔值
|<code><int></code><br/>The amount to change by.
|<pre>set_major = yes</pre>
|<pre>add_threat = 10</pre>
 
|Adjusts the level of World Tension.
| 使当前作用域成为主要国家
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|-id="add_named_threat"
|create_faction
|add_named_threat
|<code><string></code><br /> 派系名称。
|<code>threat = <int></code><br/>The amount to change by.
|<pre>create_faction = MY_FACTION_NAME</pre>
<code>name = <string></code><br/>The localization string.
 
|<pre>add_named_threat = {
| 创建一个在当前作用域的有指定名称的派系(MY_FACTION_NAME)。该作用域范围内及其附属国将自动加入派系。
   threat = 5
   name = GER_rhineland
}
</pre>
|Adjusts the level of World Tension and adds an entry in the World Tension tooltip.
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|-id="annex_country"
|add_to_faction
|annex_country
|<code><TAG></code><br /> 国家tag标签。
|<code>target = <country></code><br/>Which country to annex.
|<pre>FACTION_LEADER_TAG = { add_to_faction = TAG_TO_ADD }</pre>FACITON_LEADER_TAG(派系领导者的国家tag标签)
<code>transfer_troops = yes</code><br/>Whether to transfer the troops of the annexed country.
 
|<pre>annex_country = {
TAG_TO_ADD(需要加入该派系的国家tag标签)
   target = GER
 
   transfer_troops = yes
| 将特定国家(TAG_TO_ADD)加入该派系领导人(FACTION_LEADER_TAG)领导的的派系。
}
|&nbsp;
</pre>
|Annex the specified country for the current scope.
|Without transfering troops, the annexed country's divisions' equipment is lost.
|1.0
|1.0
|-
|-id="add_to_war"
|leave_faction
|add_to_war
|<code><bool></code><br /> Boolean.
|<code>targeted_alliance = <country></code><br/>The country to assist.
|<pre>leave_faction = yes</pre>
<code>enemy = <country></code><br/>The country attacking the ally.<br/><code>hostility_reason = <string></code><br/>Localization for the reason for joining. Optional.
 
|<pre>add_to_war = {
|离开当前派系。
   targeted_alliance = PREV
|&nbsp;
   enemy = HUN
|1.5
   hostility_reason = asked_to_join
|-
}
|remove_from_faction
</pre>
|<code><string></code><br /> The name of the faction.
|Forces the current scope to join the war of the specified ally against the specified enemy.
|<pre>remove_from_faction = MY_FACTION_NAME</pre>
 
|Removes the current scope from the specified faction.
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|-id="declare_war_on"
|dismantle_faction
|declare_war_on
|<code><bool></code><br /> Boolean.
|<code>target = <country> / <variable></code><br/>The country to attack.
|<pre>dismantle_faction = yes</pre>
<code>type = <wargoal></code><br/>The wargoal to declare with.<br/><code>generator = { <state id> }</code><br/>The states to supply the wargoal (i.e. take_state_focus).
 
|<pre>declare_war_on = {
|Dismantles the faction of the current scope.
   target = GER
   type = annex_everything
}
</pre>
|Makes the current scope declare war on the specified country with the specified wargoal.
|Wargoals are found in {{path|common/wargoals/*.txt}}. See also [[#add_civil_war_target|add_civil_war_target]] in order to assign a war between different countries to be a civil war.
|1.0
|-id="white_peace"
|white_peace
|<code><country> / <variable></code><br/>The scope to white peace.<br/>
'''OR'''<br/>
<code>tag = <country> / <variable></code><br/>The scope to white peace.<br/>
<code>message = <localisation key></code><br/>The reason for peace showing up in the pop-up.
|<pre>white_peace = GER
</pre>
<pre>white_peace = {
   tag = GER
   message = my_peace_tt
}
</pre>
|Makes the current scope white peace the specified scope.
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|-id="start_peace_conference"
|puppet
|start_peace_conference
|<code><scope></code><br /> 被傀儡国家
|<code>tag = <country> / <variable></code><br/>The scope to peace with.<br/>
|<pre>puppet = GER</pre>
<code>score_factor = <decimal> / <variable></code><br/>The fraction of the total score awarded to the winners compared to regular victory.<br/>
 
<code>message = <localisation key></code><br/>The reason for peace showing up in the pop-up. Optional.<br/>
| 傀儡某个国家
<code>winner_scope = <scope type></code><br/>Which countries should be present in the conference on the winner side alongside the current scope. Optional, defaults to LIMITED_FACTION.<br/>
<code>loser_scope = <scope type></code><br/>Which countries should be present in the conference on the loser side alongside the target country. Optional, defaults to LIMITED_FACTION.
|<pre>start_peace_conference = {
   tag = GER
   score_factor = 0.4
   message = my_peace_tt
}
</pre>
|Makes the current scope start a peace conference with the specified scope on the other side.
|Current scope is the winner, target and its subjects are the losers. Can only be used if at war with the target. A score_factor of 0.0 is equivalent to a whitepeace. <code>winner_scope</code> and <code>loser_scope</code> have the following possible values:
* <code>ALL</code>: all countries at war with the other side.
* <code>FACTION</code>: all countries in the same faction as the current scope or under its overlordship.
* <code>LIMITED_FACTION</code>: includes faction members if and only if the country is a faction leader, and includes subjects of the country.
* <code>LIMITED</code>: includes only subjects of the country.
|1.12
|-id="set_truce"
|set_truce
|<code>target = <country></code><br/>The scope to truce with.
<code>days = <int></code><br/>The duration of the truce.
|<pre>set_truce = {
   target = GER
   days = 90
}
</pre>
|Makes the current scope truce with the specified scope.
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|-id="create_wargoal"
|end_puppet
|create_wargoal
|<code><scope></code><br /> The target country.
|<code>target = <country> / <variable></code><br/>The country to target.
|<pre>end_puppet = GER</pre>
<code>type = <wargoal></code><br/>The wargoal to generate.<br/>
 
<code>generator = { <state id> }</code><br/>The states to supply the wargoal (i.e. take_state_focus).<br/>
|Removes the puppet status between the target and the current scope.
<code>expire = 365</code><br/>The amount of days that the wargoal will last before expiring. If unset or set to 0, will never expire
|<pre>create_wargoal = {
   type = puppet_wargoal_focus
   target = ROOT
}</pre>
<pre>create_wargoal = {
   type = take_state_focus
   target = PREV
   generator = { 123 321 }
   expire = 90
}</pre>
|Grants the current scope a wargoal against the specified country.
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|-id="remove_wargoal"
|release
|remove_wargoal
|<code><scope></code><br /> The target country.
|<code>target = <country> / <variable></code><br/>The country to target.
|<pre>release = GER</pre>
<code>type = <wargoal></code><br/>The wargoal to remove. "all" will remove all wargoals.<br/>
 
|<pre>remove_wargoal = {
|Releases the specified subject or core-only country as a free nation.
   type = all
   target = ROOT
}
</pre>
|Removes wargoals from the current scope to the specified country.
|&nbsp;
|&nbsp;
|1.0
|1.10.2
|-
|-id="start_civil_war"
|release_puppet
|start_civil_war
|<code><scope></code><br /> The target country.
|<code>ideology = <ideology></code><br/>The ideology of the breakaway country.
|<pre>release_puppet = GER</pre>
<code>ruling_party = <ideology></code><br/>Changes the ideology of the '''original, player-led''' country, if set. Optional.<br/>
 
<code>size = <float></code><br/>The size of the breakaway country and the fraction of the original stockpile and military units it will receive by default. Optional, defaults to 0.5.<br/>
|Releases the specified subject or core-only country as a puppet for the current scope.
<code>army_ratio = <float></code><br/>The size of the land army that the breakaway country gets. Optional, defaults to being the same as size.<br/>
|&nbsp;
<code>navy_ratio = <float></code><br/>The size of the naval forces that the breakaway country gets. Optional, defaults to being the same as size.<br/>
|1.0
<code>air_ratio = <float></code><br/>The size of the airforce that the breakaway country gets. Optional, defaults to being the same as size.<br/>
|-
<code>capital = <state></code><br/>The capital state of the breakaway country. Optional.<br/>
|give_guarantee
<code>states = { <state> }</code><br/>The states included in the breakway country. Optional, defaults to random states based off size. <code>all</code> will result in all states that meet the filter going to the breakaway.<br/>
|<code><scope></code><br /> The target country.
<code>states_filter = { <triggers> }</code><br/>A trigger block checked for the state that must be met to be transferred to the breakaway. Optional.<br/>
|<pre>give_guarantee = GER</pre>
<code>keep_unit_leaders = { <unit leader id> }</code><br/>List of unit leaders to be kept by their legacy_id. Optional.<br/>
<code>keep_unit_leaders_trigger = { <triggers> }</code><br/>Trigger block checked for every unit leader that forces them to be kept if they meet the triggers. The default scope is the unit leader, ROOT is the country receiving the unit leader, while FROM is the original owner of the unit leader. Optional.<br/>
<code>keep_political_leader = <bool></code><br/>Controls if the promoted party leader (i.e. the one that'd take power if the country were to be switched to that ideology group) of the revolting ideology group will be kept by the country or join the revolt, yes resulting in the former. Optional, defaults to false.<br/>
<code>keep_political_party_members = <bool></code><br>Controls if non-promoted party leaders of the revolting ideology group will be kept by the country or join the revolt, yes resulting in the former. Optional, defaults to false.<br/>
<code>keep_all_characters = yes</code><br/>If true, the revolter will have no characters from the original country transferred to them. Optional, defaults to false.<br/>
<code><effects></code><br/>An effect block executed for the breakaway country.
|<pre>start_civil_war = {
   ruling_party = communism
   # Original country's ideology changes to communism
   ideology = ROOT
   # Breakaway gets old ideology of ROOT
   size = 0.8
   capital = 282
   states = {
     282 533 536 555 529 530 528
   }
   keep_unit_leaders = {
     750 751 752
   }
   keep_political_leader = yes
   keep_political_party_members = yes
}
</pre>
<pre>start_civil_war = {
   ideology = democratic
   size = 0.1
   states = all
   states_filter = {
     is_on_continent = europe
     is_capital = no
   }
   set_country_flag = TAG_my_country_tag_alias_trigger
   # Sets a country flag that gets used in a country tag alias.
}</pre>
([[Country tag aliases|See country tag aliases]])
<pre>start_civil_war = {
   ideology = neutrality
   size = 0.1
   army_ratio = 0.5
   navy_ratio = 0
   air_ratio = 1
   keep_unit_leaders_trigger = {
     has_trait = my_trait_name
   }
   keep_all_characters = yes
   PREV = {  # Original country
     TAG_airforce_leader = { # Character
       set_nationality = PREV.PREV
       # Transfers to breakaway
     }
   }
   promote_character = TAG_airforce_leader
}</pre>
([[Scopes#PREV usage|See usage for PREV and PREV.PREV]])
|Starts a civil war for the current scope with the specified parameters.
|<code>states = all</code> would include every single state controlled by the country. '''If the country's current capital state is set as one of the states that the revolt can gain, it won't fire'''. [[#set_capital|set_capital]] can be used to change the capital beforehand, with [[On_actions#on_civil_war_end|on_civil_war_end]] being used to set it back to the default after the civil war ends.


|Makes the current scope guarantee the specified country.
Elections will always be disallowed for the breakaway. If the <code>ruling_party</code> attribute is used, the original country will have its elections disallowed. In the base game files, an [[on action]] is set up to ensure that elections get allowed if the democratic side wins the civil war.
|&nbsp;
|1.0
|-
|give_military_access
|<code><scope></code><br /> The target country.
|<pre>give_military_access = GER</pre>


|Makes the specified country grant the current scope military access to their country.
A civil war started via this effect cannot have more than two sides and the effect cannot be used in [[Country creation#Country history|history]] or [[Bookmark modding|bookmark's effect = { ... }]]. For adding more sides or starting one before the game's start, this can be simulated by setting an existing war (typically originating from a dynamic country created via [[#create_dynamic_country|create_dynamic_country]]) as a civil war via [[#add_civil_war_target|add_civil_war_target]].
|&nbsp;
|1.0
|1.0
|-
|-id="add_civil_war_target"
|recall_attache
|add_civil_war_target
|<code><scope></code><br /> The target country with an attache.
|<code><country></code> - The country to set as the target.
|<pre>recall_attache = GER</pre>
|<pre>add_civil_war_target = TAG</pre>
|Sets that the war between ROOT and TAG is a civil war, resulting in the victory being the annexation of the other side and setting world tension limits on intervention.
|ROOT and TAG must already be at war with each other for the effect to take place.
|1.9
|-id="remove_civil_war_target"
|remove_civil_war_target
|<code><country></code> - The country to set as the target.
|<pre>remove_civil_war_target = TAG</pre>
|Removes the status of the war as a civil war between the pair of countries.
|The ongoing war must already be marked as a civil war, whether it was initiated by [[#start_civil_war|start_civil_war]] or [[#add_civil_war_target|add_civil_war_target]] was used to mark it as one.
|1.12.13
|-id="transfer_units_fraction"
|transfer_units_fraction
|<code>target = <country></code><br/>The country which should receive the units from the current scope.
<code>size = <float></code><br/>The size of the breakaway country and the fraction of the original stockpile and military units it will receive by default. Optional, defaults to 0.5.<br/>
<code>army_ratio = <float></code><br/>The size of the land army that the breakaway country gets. Optional, defaults to being the same as size.<br/>
<code>navy_ratio = <float></code><br/>The size of the naval forces that the breakaway country gets. Optional, defaults to being the same as size.<br/>
<code>air_ratio = <float></code><br/>The size of the airforce that the breakaway country gets. Optional, defaults to being the same as size.<br/>
<code>keep_unit_leaders = { <unit leader id> }</code><br/>List of unit leaders to be kept by their legacy_id. Optional.<br/>
<code>keep_unit_leaders_trigger = { <triggers> }</code><br/>Trigger block checked for every unit leader that forces them to be kept if they meet the triggers. The default scope is the unit leader, ROOT is the country receiving the unit leader, while FROM is the original owner of the unit leader. Optional.<br/>
|<pre>transfer_units_fraction= {
target = SPD
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
}
}</pre>
|Transfers a fraction of the military to a target, including units (either type: land, navy, or air), equipment, and unit leaders.
|
|1.9
|-id="add_nuclear_bombs"
|add_nuclear_bombs
|Adds nuclear bomb to TAG's stockpile.
|<pre>add_nuclear_bombs = 100</pre>
|Adds specified number of nukes to the country's stockpile
|Needs the Nuke tech to use.
|1.6
|-id="launch_nuke"
|launch_nuke
|<code>province = <ID></code><br/>The specific province to nuke.<br/>
<code>state = <ID></code><br/>The state to nuke.<br/>
<code>controller = <TAG></code><br/>Prioritises provinces controlled by this country.<br/>
<code>use_nuke = <boolean></code><br/>Whether a nuke should be deducted from the country's stockpile. Defaults to false.
|<pre>launch_nuke = {
   province = 1234
}</pre>
<pre>launch_nuke = {
   state = 42
   controller = GER
   use_nuke = yes
}</pre>
|Nukes the specified province or a province in the needed state. If a state is set rather than the specific province, first prioritises the country set in <code>controller</code>, then prioritises the countries at war with the current scope, and then countries that are neutral.
|If set to use a nuke, then requires at least one nuclear bomb in the stockpile.
|1.6
|}


|Recalls the current scope's attache from the specified country.
===Resources===
|&nbsp;
|1.5
|-
|diplomatic_relation
|<code>country = <scope></code><br /> The target country to alter the relationship with ROOT.
<code>relation = <type></code><br /> The relation to change.<br /> <code>active = <bool></code><br /> Whether the relation is started or broken.


|<pre>diplomatic_relation = {
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
    country = SOV
|+ class="nowrap" | Resource-related country-scoped effects:<br/>
    relation = guarantee
! width="10%" |Name
    active = no
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" | Notes
! width="5%" |Version Added
|-id="country_add_resource"
|add_resource
|<code>type = <resource></code><br/>The resource to add.
<code>amount = <int></code><br/>The amount of resource to add.<br/>
<code>state = <id></code>Which state to add the resource to. Variables can be used.<br/>
<code>show_state_in_tooltip = <bool></code><br/>Whether the state should be shown in the tooltip. Defaults to true.
|<pre>add_resource = {
    type = oil
    amount = 50
    state = 88
}
}
</pre>
</pre>
 
|Adds the specified resource in the specified amount to the specified state.
|Used to define a diplomatic relation between the current scope and target scope country.
|[[#add_resource|Can also be used in state scope.]]
|Possible relations:
 
*non_aggression_pact
*guarantee
*puppet
*military_access
*docking_rights
 
|1.0
|1.0
|-
<!-- The following effect was removed. Return the entry if the effect returns.
|add_opinion_modifier
|-id="destroy_resource"
|<code>target = <scope></code><br /> The target country
|destroy_resource
<code>modifier = <modifier></code><br /> The opinion modifier to add.
|<code>type = <resource></code><br/>The resource to add.
 
<code>amount = <int></code><br/>The amount of resource to add.<br/><code>state = <id></code>Which state to add the resource to. Variables can be used.
|<pre>add_opinion_modifier = {
|<pre>destroy_resource = {
    target = GER
    type = oil
    modifier = faction_traitor
   amount = 50
    state = 88
}
}
</pre>
</pre>
 
|Destroys specified resource in the specified amount to the specified state.
|Adds the specified opinion modifier for the current scope '''towards''' the specified scope.
|Was removed in 1.11. Use a negative value in add_resource for the same result
|Opinion modifiers are found in {{path|common/opinion_modifiers/*.txt}}.
|1.9
|1.0
!-->
|-
|-id="create_import"
|remove_opinion_modifier
|create_import
|<code>target = <scope></code><br /> The target country
|<code>resource = <resource></code><br/>The resource to import.
<code>modifier = <modifier></code><br /> The opinion modifier to remove.
<code>amount = <int></code><br/>The amount of resource to import.<br/><code>exporter = <id></code>Which country exports the resource.
 
|<pre>create_import = {
|<pre>remove_opinion_modifier = {
    resource = steel
    target = GER
   amount = 100
    modifier = faction_traitor
    exporter = GER
}
}
</pre>
</pre>
 
|Creates an import for the current scope with the specified resource and from the specified exporter.
|Removes the specified opinion modifier for the current scope '''towards''' the specified scope.
|&nbsp;
|Opinion modifiers are found in {{path|common/opinion_modifiers/*.txt}}.
|1.0
|1.0
|-
|-id="give_resource_rights"
|reverse_add_opinion_modifier
|give_resource_rights
|<code>target = <scope></code><br /> The target country. 
|<code>receiver = <tag></code><br/>The country that would get the resource rights.<br/>
<code>modifier = <modifier></code><br /> The opinion modifier to add.
<code>state = <state></code><br/>The state where the resource rights are located.<br/>
<code>resources = { <resource> <...> <resource> }</code><br/>The resources to which give resource rights to. Optional, defaults to all.
|<pre>give_resource_rights = { receiver = ENG state = 291 }</pre>
<pre>give_resource_rights = {
   receiver = POL
   state = 321
   resources = { oil }
}</pre>
|Gives all the resources of a state to the target country
|The resource rights will only be provided as long as the current country controls the state with resource rights.
|1.6
|-id="remove_resource_rights"
|remove_resource_rights
|<code><state></code><br/>The state to remove current country's resource rights from.
|<pre>ENG = { remove_resource_rights = 477 }</pre>
|Removes given resource rights
|&nbsp;
|1.6
|-id="add_fuel"
|add_fuel
|<code><int></code><br/>The fuel amount
|<pre>add_fuel = 400</pre>
|Adds fuel to the current country.
|&nbsp;
|1.6
|-id="set_fuel"
|set_fuel
|<code><int></code><br/>Fuel amount.
|<pre>set_fuel = 400</pre>
|Sets country's current fuel amount.
|&nbsp;
|1.6
|-id="set_fuel_ratio"
|set_fuel_ratio
|<code><decimal></code><br/>The needed ratio of fuel.
|<pre>set_fuel_ratio = 0.5</pre>
|Set country's current fuel ratio relative to its capacity.
|&nbsp;
|1.6
|}
===Buildings===


|<pre>reverse_add_opinion_modifier = {
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
    target = GER
|+ class="nowrap" | Building-related country-scoped effects:<br/>
    modifier = faction_traitor
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" | Version Added
|-id="add_offsite_building"
|add_offsite_building
|<code>type = <building></code><br/>The building to add.
<code>level = <level> / <variable></code><br/>The maximum level to add.
|<pre>add_offsite_building = { type = arms_factory level = 1 }
</pre>
|Adds an off-map (offmap) building for the current scope that produces its effects without being present in a state.
|&nbsp;
|1.5
|-id="modify_building_resources"
|modify_building_resources
|<code>building = <building></code><br/>The building to modify.
<code>resource = <resource></code><br/>The resource to add.<br/><code>amount = <amount></code><br/>The amount of resource to add.
|<pre>modify_building_resources = {
   building = synthetic_refinery
    resource = oil
    amount = 1
}
}
</pre>
</pre>
|Modifies the resource output of the specified building for the current scope.
|&nbsp;
|1.5
|}


|Adds the specified opinion modifier for the specified scope '''towards''' the current scope.
===National focuses===
|Opinion modifiers are found in {{path|common/opinion_modifiers/*.txt}}.
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px"  style="display: inline-block; padding: 5px" width="100%"
|+ class="nowrap" | National focus-related country-scoped effects:<br/>
! width="10%" |Name
! width="15%" |Parameters
! width="20%" |Examples
! width="20%" |Description
! width="30%" |Notes
! width="5%" |Version Added
|-id="load_focus_tree"
|load_focus_tree
|<code><focus tree></code><br/>The national focus tree to load.<br/>'''OR'''<br/><code>tree = <focus tree ID></code><br/>The national focus tree to load.<br/><code>keep_completed = <bool></code><br/>Whether focuses shared between the old and new trees should stay completed. Defaults to false.
|<pre>load_focus_tree = china_communist_focus</pre>
<pre>load_focus_tree = { tree = british_focus keep_completed = yes }</pre>
|Loads a new focus tree for the current scope, retaining any shared focuses if set.
|Focuses that aren't present in the newly-loaded tree will not be kept as completed for [[Triggers#has_completed_focus|has_completed_focus]] checks or when loading the old tree back.
|1.5
|-id="unlock_national_focus"
|unlock_national_focus
|<code><focus></code><br/>The focus to unlock.
|<pre>unlock_national_focus = my_focus</pre>
|Bypasses the specified focus for the current scope (marks as complete without firing <code>complete_effect</code> of the focus).
|&nbsp;
|1.0
|-id="complete_national_focus"
|complete_national_focus
|<code><focus></code><br/>The focus to complete.
|<pre>complete_national_focus = my_focus</pre>
|Completes the specified focus for the current scope.
|&nbsp;
|1.0
|1.0
|-
|-id="uncomplete_national_focus"
|add_relation_modifier
|uncomplete_national_focus
|<code>target = <scope></code><br /> The target country
|<code>focus = <focus></code><br><code>uncomplete_children = <bool></code><br>Defaults "no". Optional.<br><code>refund_political_power = <bool></code><br>Defaults "no". Optional.
<code>modifier = <modifier></code><br /> The relation modifier to add.
|<pre>uncomplete_national_focus = {
  focus = GER_oppose_hitler
  uncomplete_children = yes
  refund_political_power = no
}</pre>
|Removes a focus from list of completed focus, and potentially all focuses requiring it as a prerequisite.<br>If the focus has one, the 'on_uncomplete' effect will be executed on each uncompleted focus.
|
|1.11
|-id="mark_focus_tree_layout_dirty"
|mark_focus_tree_layout_dirty
|<code><bool></code><br/>Boolean.
|<pre>mark_focus_tree_layout_dirty = yes</pre>
|Refreshes the focus tree for the specified country, restarting the checks in <code>allow_branch</code> and position offsets for focuses.
|If put within a focus' completion reward, the focus will not be marked as complete at the time the effect is executed, leading to <code>has_completed_focus</code> checks specifying that focus in particular to be marked as false.<br/>
This can be bypassed by putting an effect within a hidden event fired immediately within the focus or by reloading the same focus tree with <code>load_focus_tree</code> set to keep completed focuses, marking the focus as complete, before using the effect.
|1.9
|}


|<pre>add_relation_modifier = {
===Decisions===
   target = SWE
   modifier = HUN_dynastic_ties_license
}
</pre>


|Adds the specified relation modifier for the current scope '''towards''' the specified scope.
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|Relation modifiers are found in {{path|common/modifiers/*.txt}}.
|+ class="nowrap" | Decision-related country-scoped effects:<br/>
|1.4
! width="10%" |Name
|-
|remove_relation_modifier
|<code>target = <scope></code><br /> The target country.
<code>modifier = <modifier></code><br /> The relation modifier to remove.
 
|<pre>remove_relation_modifier = {
   target = SWE
   modifier = HUN_dynastic_ties_license
}
</pre>
 
|Removes the specified relation modifier for the current scope '''towards''' the specified scope.
|Relation modifiers are found in {{path|common/modifiers/*.txt}}.
|1.4
|}
 
===附属国===
 
{| class="wikitable sortable" width="100%"
|-
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Parameters
! width="25%" |Examples
! width="25%" |Examples
第1,552行: 第2,090行:
! width="15%" |Notes
! width="15%" |Notes
! width="5%" |Version Added
! width="5%" |Version Added
|-
|-id="activate_decision"
|add_autonomy_ratio
|activate_decision
|<code>value = <float></code><br /> The freedom score to add
|
<code>localization = <string></code><br /> The localization key for the modifier.
<code><decision></code><br/>The decision to activate.
 
|<pre>activate_decision = my_decision</pre>
|<pre>add_autonomy_ratio = {
|Activates the specified decision for the current scope, ignoring triggers for the decision.
    value = 0.1
|Decisions are found in {{path|common/decisions/*.txt}}
    localization = AST_adopt_westminster
|1.0
|-id="activate_targeted_decision"
|activate_targeted_decision
|<code>target = <country></code><br/>The country to target.
<code>decision = <decision></code><br/>The decision to activate.
|<pre>activate_targeted_decision = {
    target = GER
    decision = my_decision
}
}
</pre>
</pre>
 
|Activates the specified targeted decision for the specified target for the current scope.
|Adds a freedom score ratio modifier to the current scope.
|Decisions are found in {{path|common/decisions/*.txt}}
|Used in the subject.
|1.5
|1.3
|-id="remove_targeted_decision"
|-
|remove_targeted_decision
|add_autonomy_score
|<code><decision></code><br/>The decision to remove.
|<code>value = <float></code><br /> The freedom score to add.
|<pre>remove_targeted_decision = {
<code>localization = <string></code><br /> The localization key for the modifier.
    target = FROM
 
    decision = my_decision
|<pre>add_autonomy_ratio = {
    value = 10
    localization = EXAMPLE
}
}
</pre>
</pre>
 
|Removes the specified targeted decision for the current scope.
|Adds an exact freedom score modifier to the current scope.
|Decisions are found in {{path|common/decisions/*.txt}}
|Used in the subject.
|1.5
|1.3
|-id="unlock_decision_tooltip"
|-
|unlock_decision_tooltip
|set_autonomy
|<code><decision></code><br/>The decision to display.
|<code>target = <scope> / <variable></code><br /> The subject country
|<pre>unlock_decision_tooltip = my_decision</pre>
<code>autonomy_state = <type></code><br /> The type of autonomy state to set.<br /> <code>freedom_level = <float></code><br /> The new freedom level value. Optional.
|Displays a special tooltip for the specified decision in the effect tooltip.
 
|Decisions are found in {{path|common/decisions/*.txt}}
|<pre>set_autonomy = {
|1.5
   target = AST
|-id="unlock_decision_category_tooltip"
   autonomy_state = autonomy_free
|unlock_decision_category_tooltip
}
|<code><category></code><br/>The decision category to display.
</pre>
|<pre>unlock_decision_category_tooltip = my_category</pre>
 
|Displays a special tooltip for the specified decision category in the effect tooltip.
|Sets the autonomy level for the specified country.
|Decision categories are found in {{path|common/decisions/catergories/*.txt}}
|The autonomy states are found in {{path|common/autonomous_states/*.txt}}.
|1.5
|1.3
|-id="add_days_remove"
|-
|add_days_remove
|release_autonomy
|<code>decision = <decision> </code><br/>The decision to add days to.
|<code>target = <scope> / <variable></code><br /> The subject country
<code>days = <int> / <variable></code><br/>The number of days to add to the decision.
<code>autonomy_state = <type></code><br /> The type of autonomy state to set.<br /> <code>freedom_level = <float></code><br /> The new freedom level value. Optional.
|
 
<pre>add_days_remove  = {
|<pre>release_autonomy = {
    decision = decision_here
    target = VIN
    days = 30
    autonomy_state = autonomy_puppet
}</pre>
   freedom_level = 0.5
|Adds the number of days to the timer created by a decision's days_remove.
}
|Decisions are found in {{path|common/decisions/*.txt}}
</pre>
|1.9
 
|-id="remove_decision"
|Releases the country and sets the autonomy level for the specified country.
|remove_decision
|The autonomy states are found in {{path|common/autonomous_states/*.txt}}.
|Allows to remove specified decision without running remove_effect.
|1.3
|<pre>remove_decision = GER_MEPO</pre>
|Removes a decision.
|&nbsp;
|1.6
|-id="remove_decision_on_cooldown"
|remove_decision_on_cooldown
|<code><decision></code><br/>The decision that is to be removed.
|<pre>remove_decision_on_cooldown = TAG_my_decision</pre>
|If the decision is on cooldown, it gets removed, in order to reactivate or remove completely.
|
|1.11
|}
|}


=== 战争===
===Missions===


{| class="wikitable sortable" width="100%"
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|-
|+ class="nowrap" | Mission-related country-scoped effects:<br/>
! width="10%" | 名字
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Parameters
! width="25%" | 例子
! width="25%" |Examples
! width="20%" | 描述
! width="20%" |Description
! width="15%" |Notes
! width="15%" |Notes
! width="5%" |Version Added
! width="5%" |Version Added
|-
|-id="activate_mission"
|add_threat
|activate_mission
|<code><int></code><br /> 增加多少世界紧张度
|<code><mission></code><br/>The mission to activate.
|<pre>add_threat = 10</pre>
|<pre>activate_mission = my_mission</pre>
|Activates the specified mission for the current scope, ignoring any triggers for the decision.
|Missions are found in {{path|common/decisions/*.txt}}
|1.5
|-id="activate_mission_tooltip"
|activate_mission_tooltip
|<code><mission></code><br/>The mission to display.
|<pre>activate_mission_tooltip = my_mission</pre>
|Displays a special tooltip for the specified mission in the effect tooltip.
|Missions are found in {{path|common/decisions/*.txt}}
|1.5
|-id="remove_mission"
|remove_mission
|<code><mission></code><br/>The mission to remove.
|<pre>remove_mission = my_mission</pre>
|Removes the specified mission for the current scope.
|Missions are found in {{path|common/decisions/*.txt}}
|1.5
|-id="add_days_mission_timeout"
|add_days_mission_timeout
|<code> mission = <mission> </code><br/>The mission to add days to.
<code>days = <int> / <variable></code><br/>The number of days to add to the mission.
|<pre>add_days_mission_timeout = {
   mission = my_mission
   days = 20
}</pre>
|Adds the number of days to the specified mission.
|Missions are found in {{path|common/decisions/*.txt}}
|1.9
|}
===Technologies and doctrines===


| 增加全球紧张度
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ class="nowrap" | Technology-related country-scoped effects:<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="add_research_slot"
|add_research_slot
|<code><int></code><br/>The number of slots to add or remove.
|<pre>add_research_slot = 1</pre>
|Adjusts the number of research slots the current scope has. Can remove slots with negatives.
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|-id="set_research_slots"
|add_named_threat
|set_research_slots
|<code>threat = <int></code><br /> The amount to change by.
|<code><int></code><br/>The number of slots to set.
<code>name = <string></code><br /> The localization string.
|<pre>set_research_slots = 4</pre>
 
|Sets the number of research slots the current scope has.
|<pre>add_named_threat = {
   threat = 5
   name = GER_rhineland
}
</pre>
 
|Adjusts the level of World Tension and adds an entry in the World Tension tooltip.
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|-id="add_tech_bonus"
|annex_country
|add_tech_bonus
|<code>target = <scope></code><br /> 被吞并的国家ID
|<code>bonus = <float></code><br/>The bonus to technology given, default 0.
<code>transfer_troops = yes</code><br /> Whether to transfer the troops of the annexed country.
<code>uses = <int></code><br/>The amount of times the bonus can be used, default 1.<br/><code>ahead_reduction = <float></code><br/>The cost reduction if ahead of time, default 0.<br/><code>category = <string></code><br/>Which technology category the bonus applies to. Multiple can be defined.<br/><code>technology = <string></code><br/>Which technology the bonus applies to. Multiple can be defined.
 
<code>name = <string></code>


|<pre>annex_country = {
Tooltip shown in research tabs, optional.
    target = GER
|<pre>add_tech_bonus = {
    transfer_troops = yes
    bonus = 0.5
   uses = 1
    category = radar_tech
}
}
</pre>
</pre>
 
|Grants a research bonus to the current scope with the specified parameters.
| 让一个国家吞并另一个国家
|Research bonus categories are defined in {{path|common/technology_tags/*.txt}} files, while technologies are defined in {{path|common/technologies/*.txt}} files.
|&nbsp;
|1.0
|1.0
|-
|-id="set_technology"
|add_to_war
|set_technology
|<code>targeted_alliance = <scope></code><br /> The country to assist.
|<code><technology> = <int></code><br/>The technology to add.<br><code>popup = no</code><br/>To not show the popup after adding technology
<code>enemy = <scope></code><br /> The country attacking the ally.<br /> <code>hostility_reason = <string></code><br /> Localization for the reason for joining. Optional.
|
 
<pre>set_technology = {
|<pre>add_to_war = { 
    suicide_craft = 1
    targeted_alliance = PREV
   enemy = HUN
   hostility_reason = asked_to_join
}
}
</pre>
</pre>
 
|Grants the specified technology to the current scope.
|Adds the current scope into the war of their ally against the specified enemy.
|A value of 1 sets the technology. A value of 0 removes the technology, but if it is a researchable technology, the duration it takes to research isn't reset, meaning it can be researched in 1 day. Technologies that are mutually exclusive with other technologies can not be removed by this effect. Technologies are defined in {{path|common/technologies/*.txt}} files.
|&nbsp;
|1.0
|1.0
|-
|-id="add_to_tech_sharing_group"
|declare_war_on
|add_to_tech_sharing_group
|<code>target = <scope> / <variable></code><br /> 被攻击的国家ID
|<code><string></code><br/>The group to add the current scope to.
<code>type = <wargoal></code><br /> 此次战争的宣战借口
|<pre>add_to_tech_sharing_group = us_research</pre>
 
|Adds the current scope to the specified technology sharing group.
|<pre>declare_war_on = {
|&nbsp;Technology sharing groups are found in <code>Hearts of Iron IV\common\technology_sharing\*.txt</code>
    target = GER
|1.3
    type = annex_everything
|-id="remove_from_tech_sharing_group"
|remove_from_tech_sharing_group
|<code><string></code><br/>The group to remove the current scope from.
|<pre>remove_from_tech_sharing_group = us_research</pre>
|Removes the current scope from the specified technology sharing group.
|&nbsp;Technology sharing groups are found in <code>Hearts of Iron IV\common\technology_sharing\*.txt</code>
|1.3
|-id="modify_tech_sharing_bonus"
|modify_tech_sharing_bonus
|<code>id = <string></code><br/>The group to modify.
<code>bonus = <float></code><br/>The new bonus.
|<pre>modify_tech_sharing_bonus = {
    id = us_research
    bonus = 0.5
}
}
</pre>
</pre>
|Modifies the specified technology sharing group.
|&nbsp;Technology sharing groups are found in <code>Hearts of Iron IV\common\technology_sharing\*.txt</code>
|1.3
|-id="inherit_technology"
|inherit_technology
|<code><tag></code> The country to inherit technology from.
|<pre>inherit_technology = CAN</pre>
|Makes the current country's researched technologies be copied from the specified country.
|Useful when making a country independent.
|1.6
|-id="add_doctrine_cost_reduction"
|add_doctrine_cost_reduction
|<code>name = <name></code><br/>Tooltip showing why the doctrine has reduced cost in the doctrine menu. Optional.<br/>
<code>cost_reduction = <fraction></code><br/>Percentage of cost reduced.<br/>
<code>uses = <integer></code><br/>Number of times the cost reduction can be used.<br/>
<code>category = <doctrine category></code><br/>Which doctrine category the cost reduction will apply to. (Ex: <code>cat_mobile_warfare</code>,<code>land_doctrine</code> ,<code>air_doctrine</code>.)
|<pre>add_doctrine_cost_reduction = {
cost_reduction = 0.5
uses = 2
category = land_doctrine
}</pre>
|Gives bonuses of reducing land doctrine cost to current scope.
|Doctrines are defined in {{path|common/technologies/*.txt}} files.<br/>
For a general doctrine cost reduction, see "<land/air/naval>_doctrine_cost_factor" in [[Modifiers]].
|1.11
|}


| 让一个国家向另一个国家宣战,并且用其宣战借口宣战
===Ideas===
| 宣战借口类型可以在 {{path|common/wargoals/*.txt}}中定义
This includes national spirits, laws, designers, and advisors (using the idea_token)
|1.0
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|-
|+ class="nowrap" | Idea-related country-scoped effects:<br/>
|white_peace
! width="10%" |Name
|<code><scope> / <variable></code><br /> 被无条件和平的国家ID
! width="25%" |Parameters
<code><message></code><br /> 相当于和平条约窗口上的提示
! width="25%" |Examples
 
! width="20%" |Description
|<pre>white_peace = GER
! width="15%" |Notes
</pre>
! width="5%" |Version Added
<pre>white_peace = {
|-id="add_ideas"
    tag = GER
|add_ideas
    message = EXAMPLE
|<code><idea></code><br/>The idea to add.
|<pre>add_ideas = my_idea</pre>
<pre>add_ideas = {
    my_idea_1
    my_idea_2
}
}
</pre>
</pre>
 
|Adds the specified ideas to the current scope.
| 让一个国家无条件和平
|Can be used as a scope to add multiple at once.
|&nbsp;
|1.0
|1.0
|-
|-id="add_timed_idea"
|set_truce
|add_timed_idea
|<code>target = <scope></code><br /> The scope to truce with
|<code>idea = <idea></code><br/>The idea to add.
<code>days = <int></code><br /> The duration of the truce.
<code>days = <int> / <variable></code><br/>The number of days to add the idea for.<br/>
 
<code>months = <int> / <variable></code><br/>The number of months to add the idea for. A month is equal to 30 days.<br/>
|<pre>set_truce = {
<code>years = <int> / <variable></code><br/>The number of years to add the idea for. A year is equal to 365 days.
    target = GER
|<pre>add_timed_idea = {
    days = 90
    idea = my_idea
    days = 180
}
}
</pre>
</pre>
 
|Adds the specified ideas to the current scope for the specified number of days.
|Makes the current scope truce with the specified scope.
|Either one of <code>days</code>, <code>months</code>, or <code>years</code> is mandatory. The tooltip will use the exact same phrasing in years/months/days as used in the attributes.
|&nbsp;
|1.0
|1.0
|-
|-id="modify_timed_idea"
|create_wargoal(制造宣战借口)
|modify_timed_idea
|<code>target = <scope> / <variable></code><br /> 指定被制造宣战借口的国家
|<code>idea = <idea></code><br/>The idea to modify.
<code>type = <wargoal></code><br /> 指定制造的宣战借口类型,宣战借口类型在Hearts of Iron IV\common\wargoals\中(可通过该方式自定义宣战借口) <br /> <code>generator = { <state id> }</code><br /> The states to supply the wargoal (i.e. take_state_focus).
<code>days = <int> / <variable></code><br/>The number of days to modify the idea by.<br/>
 
<code>months = <int> / <variable></code><br/>The number of months to modify the idea by. A month is equal to 30 days.<br/>
|<pre>create_wargoal = {
<code>years = <int> / <variable></code><br/>The number of years to modify the idea by. A year is equal to 365 days.
    type = puppet_wargoal_focus
|<pre>modify_timed_idea = {
    target = ROOT
    idea = my_idea
    days = 60
}
}
</pre>
</pre>
 
|Extends or shortens the duration of the timed idea by the specified amount.
| 让一个国家获得对另一个国家的宣战借口
|Positives add to the time, negatives shorten it. Either one of <code>days</code>, <code>months</code>, or <code>years</code> is mandatory. The tooltip will use the exact same phrasing in years/months/days as used in the attributes.
|&nbsp;
|1.0
|1.0
|-
|-id="swap_ideas"
|start_civil_war
|swap_ideas
|<code>ideology = <ideology></code><br /> The ideology of the breakaway country
|<code>add_idea = <idea></code><br/>The idea to add.
<code>ruling_party = <ideology></code><br /> The ruling party of the original country. Optional.<br /> <code>size = <float></code><br /> The size of the breakaway country and the fraction of the original stockpile and military units it will receive. Optional.<br /> <code>capital = <state></code><br /> The capital of the breakaway country. Optional.<br /> <code>only_own_territory = <bool></code><br /> Limits the breakaway country to only own territory. Optional.<br /> <code>states = { <state> }</code><br /> The states included in the breakway country. Optional.<br /> <code>states_filter = { <triggers> }</code><br /> Filters to apply to the state assignment for the breakaway country. Optional.<br /> <code>keep_unit_leaders = { <unit leader id> }</code><br /> Keep the specified leaders. Optional.<br /> <code>keep_unit_leaders_trigger = { <triggers></code><br /> Keep the specified leaders that meet the triggers. Optional.
<code>remove_idea = <idea></code><br/>The idea to remove.
 
|<pre>swap_ideas = {
|<pre>start_civil_war = {
    remove_idea = my_idea_1
    ruling_party = communism
    add_idea = my_idea_2
   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
   }
}
}
</pre>
</pre>
 
|Switches two ideas with a tooltip displaying any modifier differences between them.
|Starts a civil war for the current scope with the specified parameters.
|If the ideas have the same name in the localisation, it will show up as modifying the idea rather than swapping them.
|&nbsp;
The add will occur before the removal of the old idea.
|1.3
|-id="remove_ideas"
|remove_ideas
|<code><idea></code><br/>The idea to remove.
|<pre>remove_ideas = my_idea</pre>
<pre>remove_ideas = {
   my_idea_1
   my_idea_2
}
</pre>
|Removes the specified idea from the current scope.
|Can be used as a scope to remove multiple at once.
|1.0
|1.0
|}
|-id="remove_ideas_with_trait"
 
|remove_ideas_with_trait
===资源===
|<code><trait></code><br/>The trait to target.
 
|<pre>remove_ideas_with_trait = motorized_equipment_manufacturer
{| class="wikitable sortable" width="100%"
|-
! width="10%" |名字
! width="25%" |参数
! width="25%" |示例
! width="20%" |描述
! width="15%" |注释
! width="5%" |添加
版本
|-
|add_resource
|<code>type = <resource></code><br /> 要添加的资源
<code>amount = <int></code><br /> 要添加资源的数量<br /> <code>state = <id></code>要添加资源的地区。 可以使用变量
 
|<pre>add_resource = {
   type = oil
   amount = 50
   state = 88
}
</pre>
</pre>
 
|Removes all ideas for the current scope that use the specified trait.
| 在特定地区添加特定数量的特定资源
|&nbsp;
|1.0
|-id="show_ideas_tooltip"
|show_ideas_tooltip
|<code><idea></code><br/>The idea to display.
|<pre>show_ideas_tooltip = my_idea</pre>
|Displays the specified idea in the tooltip for the current effect scope. Does not add the idea.
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|}
|destroy_resource
|<code>type = <resource></code><br /> 要添加的资源
<code>amount = <int></code><br /> 要添加资源的数量<br /> <code>state = <id></code>要添加资源的地区。 可以使用变量


|<pre>destroy_resource = {
===Units===
   type = oil
 
   amount = 50
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
    state = 88
|+ class="nowrap" | Unit-related country-scoped effects:<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="load_oob"
|load_oob
|<code><oob></code><br/>The filename of the order of battle to load, without the .txt extension.
|<pre>load_oob = "GER_default"</pre>
|Loads the specified order of battle for the current scope, applying the effects within. The filename with the <code>.txt</code> extension omitted is used as the effect's target.
|Orders of battle are stored within {{path|history/units/*.txt}}. Primarily used to spawn divisions at specified locations.
|1.0
|-id="division_template"
|division_template
|<code>name</code><br/>The name of the division.
<pre>regiments = {
    <unit> = { x = 0 y = 0 }
}
}
</pre>
support = {
 
   <unit> = { x = 0 y = 0 }
|在特定地区摧毁特定数量的特定资源
|&nbsp;
|1.9
|-
|create_import
|<code>resource = <resource></code><br /> The resource to import.
<code>amount = <int></code><br /> The amount of resource to import.<br /> <code>exporter = <id></code>Which country exports the resource.
 
|<pre>create_import = {
   resource = steel
   amount = 100
   exporter = GER
}
}
</pre>
</pre>
 
The composition of the division. Sub-units are defined in {{path|common/units/*.txt}} files.<br/>
|Creates an import for the current scope with the specified resource and from the specified exporter.
<code>division_names_group = <group></code><br/>
|&nbsp;
The division names group that the template will use, deciding on the automatically-generated names of any new divisions built using that template. Optional, assigns one automatically if omitted. These are defined within {{path|common/units/names_divisions/*.txt}} files.<br/>
<code>is_locked = <bool></code><br/>Whether the division is locked to modification and deletion. Optional.<br/>
<code>force_allow_recruiting = <bool></code><br/>Whether the locked template can have units deployed using it without allowing editing. Optional, only has an effect in locked templates.<br/>
<code>division_cap = <int></code><br/>The maximum amount of divisions that this template may have; requires the template to be locked. Optional.<br/>
<code>priority = <int></code><br/>The priority the template receives in receiving supplies. Goes from 0 to 2. Optional, 1 by default.<br/>
<code>template_counter = <int></code><br/>The icon used by the division as an integer. Optional, defaults to the icon of the most common sub-unit within. The icons are defined as sprites within any {{path|interface/*.gfx}} file (By default <code>subuniticons.gfx</code>) with the pattern of <code>GFX_div_templ_<int>_large</code> and <code>GFX_div_templ_<int>_small</code>.<br/>
<code>override_model = <entity></code><br/>[[Entity modding|Enforces the entity used by the units using this template to be the specified one]]. Optional.
|<pre>division_template = {
   name = "Test"
   is_locked = yes
   division_cap = 3
   division_names_group = USA_INF_01
   priority = 0
   template_counter = 0
   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 }
   }
}
</pre>
|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 and start from 0. No tooltip is shown.
|1.0
|1.0
|}
|-id="add_units_to_division_template"
 
|add_units_to_division_template
===建筑===
|<code>template_name = <string></code><br/>The template to change. Optional if used in division scope.<br/>
 
<pre>regiments = {
{| class="wikitable sortable" width="100%"
   <unit> = <column>
|-
}
! width="10%" |名字
support = {
! width="25%" |参数
   <unit> = <column>
! width="25%" |示例
}</pre>
! width="20%" |描述
The units to add to the template. Sub-units are defined in {{path|common/units/*.txt}} files.
! width="15%" |注释
|<pre>add_units_to_division_template = {
! width="5%" |添加
   template_name = "Test"
版本
   regiments = {
|-
     infantry = 2
|add_offsite_building
     infantry = 2
|<code>type = <building></code><br /> The building to add
   }
<code>level = <level> / <variable></code><br /> The maximum level to add.
   support = {
 
     military_police = 0
|<pre>add_offsite_building = { type = arms_factory level = 1 }
   }
}
</pre>
</pre>
 
|Adds the specified brigades to first available slots of specified columns to the template (if possible).
|Adds an off-map building for the current scope that produces its effects without being present in a state.
|Columns go left-to-right starting with 0. Can also be used in division scope.
|&nbsp;
|1.0
|1.5
|-id="set_division_template_lock"
|-
|set_division_template_lock
|modify_building_resources
|<code>division_template = <string></code><br/>The name of the division template.
|<code>building = <building></code><br /> The building to modify
<code>is_locked = <bool></code><br/>Whether the division is locked or not.
<code>resource = <resource></code><br /> The resource to add.<br /> <code>amount = <amount></code><br /> The amount of resource to add.
|<pre>set_division_template_lock = {
 
    division_template = "Infantry Division"
|<pre>modify_building_resources = {
    is_locked = yes
    building = synthetic_refinery
   resource = oil
    amount = 1
}
}
</pre>
</pre>
 
|Toggles the locked status on a division template for the current scope, which prevents editing or deletion.
|Modifies the resource output of the specified building for the current scope.
|&nbsp;
|&nbsp;
|1.5
|1.5
|}
|-id="country_lock_all_division_template"
 
|country_lock_all_division_template
===国策===
|<code><bool></code><br/>Boolean.
 
|<pre>country_lock_all_division_template = yes</pre>
{| class="wikitable sortable" width="100%"
|Locks all division templates for the current scope.
|-
|Used to prevent training, disbanding, and editing units.
! width="10%" | 名字
|1.9
! width="25%" | 参数
|-id="set_division_force_allow_recruiting"
! width="25%" | 示例
|set_division_force_allow_recruiting
! width="20%" | 描述
|<code>division_template = <string></code><br/>Template to modify.<br/>
! width="15%" | 注释
<code>force_allow_recruiting = <bool></code><br/>Whether to allow or disallow recruiting. Defaults to true if unset.
! width="5%" |添加
|<pre>set_division_force_allow_recruiting = {
版本
   division_template = "My locked template"
|-
}</pre>
|load_focus_tree
|Changes whether it's possible to recruit divisions of a locked template without unlocking the template.
|<code><string></code><br /> 加载某个指定国策树.<br />Alternatively, as an effect block:<br /><code>tree = <string></code><br /><code>keep_completed = yes/no</code>
|<pre>load_focus_tree = china_communist_focus</pre><br /><pre>load_focus_tree = { tree = british_focus keep_completed = yes }</pre>
 
|Loads a new focus tree for the current scope, retaining any shared focuses.
|&nbsp;
|&nbsp;
|1.5
|1.12
|-
|-id="set_division_template_cap"
|unlock_national_focus
|set_division_template_cap
|<code><focus></code><br /> The focus to unlock.
|<code>division_template = <string></code><br/>The name of the division template.<br/>
|<pre>unlock_national_focus = my_focus</pre>
<code>division_cap = <int></code><br/>The division cap.
 
|<pre>set_division_template_cap = { 
|Bypasses the specified focus for the current scope (marks as complete without firing <code>complete_effect</code> of the focus).
division_template = "Swiss Citizen Militia
|&nbsp;
division_cap = SWI_militia_division_cap
|1.0
}
|-
</pre>
|complete_national_focus
|Sets the cap of a division template. The template has to be locked first.
|<code><focus></code><br /> The focus to complete.
|
|<pre>complete_national_focus = my_focus</pre>
|1.12
 
|-id="clear_division_template_cap"
|Completes the specified focus for the current scope.
|clear_division_template_cap
|&nbsp;
|<code>division_template = <string></code><br/>The name of the division template.
|1.0
|<pre>clear_division_template_cap = { 
|}
division_template = "Swiss Citizen Militia"
 
===决议===
 
{| class="wikitable sortable" width="100%"
|-
! width="10%" |名字
! width="25%" |参数
! width="25%" |示例
! width="20%" |描述
! width="15%" |注释
! width="5%" |添加
版本
|-
|activate_decision
|<code><decision></code><br /> The decision to activate.
|<pre>activate_decision = my_decision</pre>
 
|Activates the specified decision for the current scope, ignoring triggers for the decision.
|Decisions are found in {{path|common/decisions/*.txt}}
|1.0
|-
|activate_targeted_decision
|<code>target = <scope></code><br /> The country to target
<code>decision = <decision></code><br /> The decision to activate.
 
|<pre>activate_targeted_decision = {
   target = GER
   decision = my_decision
}
}
</pre>
</pre>
 
|Clears the cap on the template, allowing it to have an unlimited amount of divisions.
|Activates the specified targeted decision for the specified target for the current scope.
|
|Decisions are found in {{path|common/decisions/*.txt}}
|1.12
|1.5
|-id="delete_unit_template_and_units"
|-
|delete_unit_template_and_units
|remove_targeted_decision
|<code>division_template = <string></code><br/>The name of the division template.
|<code><decision></code><br /> The decision to remove.
|<pre>delete_unit_template_and_units = {
|<pre>remove_targeted_decision = {
    division_template = "Infantry Division"
    target = FROM
    disband = yes #will refund equipment and manpower
    decision = my_decision
}
}
</pre>
</pre>
 
|Deletes the specified division template and all units using it for the current scope.
|Removes the specified targeted decision for the current scope.
|&nbsp;
|Decisions are found in {{path|common/decisions/*.txt}}
|1.5
|1.5
|-
|-id="delete_unit"
|unlock_decision_tooltip
|delete_unit
|<code><decision></code><br /> The decision to display.
|<code>state = <number id></code><br/>The id number of the state the unit must be in.<br/>
|<pre>unlock_decision_tooltip = my_decision</pre>
<code>division_template = <string></code><br/>The template the units must use to be deleted.<br/>
 
<code>id = <int></code><br/>The id given to the unit if created via the <code>create_unit</code> effect.
|Displays a special tooltip for the specified decision in the effect tooltip.
<code>disband = <bool></code><br/>If true, will refund equipment and manpower.
|Decisions are found in {{path|common/decisions/*.txt}}
|<pre>delete_unit = {
|1.5
   state = 787
|-
   disband = yes #will refund equipment and manpower
|unlock_decision_category_tooltip
}</pre>
|<code><category></code><br /> The decision category to display.
<pre>delete_unit = {
|<pre>unlock_decision_category_tooltip = my_category</pre>
   division_template = "Infantry Division"
 
}</pre>
|Displays a special tooltip for the specified decision category in the effect tooltip.
<pre>delete_unit = {} # Will delete all units</pre>
|Decision categories are found in {{path|common/decisions/catergories/*.txt}}
|Deletes all units that meet the filters.
|No tooltip is generated. delete_units can be used if deleting all units of a specific template.
|1.5
|1.5
|-id="delete_units"
|delete_units
|<code>division_template = <string></code><br/>The template the units must use to be deleted.<br/>
<code>disband = <bool></code><br/>If true, will refund equipment and manpower.
|<pre>delete_units = {
   division_template = "Infantry Division"
   disband = yes
}</pre>
|Deletes all units with a certain template.
|Generates a tooltip, unlike delete_unit. Mandatory to specify a division_template.
|1.9
|-id="create_railway_gun"
|create_railway_gun
|<code>equipment = <type></code><br/>Equipment type used by the railway gun.<br/>
<code>name = <string></code><br/>The name used by the railway gun. Optional.<br/>
<code>location = <province></code><br/>Location where the railway gun is created. Assumes the capital by default.
|<pre>create_railway_gun = {
   equipment = railway_gun_equipment_1
name = TAG_new_railway_gun
location = 12406
}</pre>
|Creates a railway gun.
|
|1.11
|-id="teleport_railway_guns_to_deploy_province"
|teleport_railway_guns_to_deploy_province
|<code><boolean></code><br/>
|<pre>teleport_railway_guns_to_deploy_province = yes</pre>
|Teleports all railway guns to the province where they get deployed.
|
|1.11
|}
|}


=== 任务===
===Equipment===


{| class="wikitable sortable" width="100%"
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|-
|+ class="nowrap" | Equipment-related country-scoped effects:<br/>
! width="10%" | 名字
! width="10%" |Name
! width="25%" | 参数
! width="25%" |Parameters
! width="25%" | 示例
! width="25%" |Examples
! width="20%" | 描述
! width="20%" |Description
! width="15%" | 注释
! width="15%" |Notes
! width="5%" | 添加
! width="5%" |Version Added
版本
|-id="set_equipment_fraction"
|-
|set_equipment_fraction
|activate_mission
|<code><float> / <variable></code><br/>The fraction of equipment to remove.
|<code><mission></code><br /> The mission to activate.
|<pre>set_equipment_fraction = 0.5</pre>
|<pre>activate_mission = my_mission</pre>
|Reduces the overall equipment stockpile by the specified fraction.
 
|This should '''not''' be used in civil wars to simulate stockpile splitting. <code>start_civil_war</code> automatically divides stockpiles according to the respective size.
|Activates the specified mission for the current scope, ignoring any triggers for the decision.
|1.0
|Missions are found in {{path|common/decisions/*.txt}}
|-id="add_equipment_to_stockpile"
|1.5
|add_equipment_to_stockpile
|-
|<code>type = <equipment></code><br/>The equipment to add. Either types and archetypes are accepted.<br/>
|activate_mission_tooltip
<code>amount = <int> / <variable></code><br/>The amount to add.<br/>
|<code><mission></code><br /> The mission to display.
<code>producer = <country> / <variable></code><br/>Defines who produced the equipment. Optional, defaults to the current scope.<br/>
|<pre>activate_mission_tooltip = my_mission</pre>
<code>variant_name = <string></code><br/>The equipment variant to add. Mandatory if a variant needs to be created to produce the equipment, optional otherwise.<br/>
 
|<pre>add_equipment_to_stockpile = {
|Displays a special tooltip for the specified mission in the effect tooltip.
   type = infantry_equipment
|Missions are found in {{path|common/decisions/*.txt}}
   amount = -100
|1.5
   producer = GER
|-
}</pre>
|remove_mission
<pre>add_equipment_to_stockpile = {
|<code><mission></code><br /> The mission to remove.
   type = medium_tank_chassis_1
|<pre>remove_mission = my_mission</pre>
   amount = 100
 
   variant_name = "Panzer III"
|Removes the specified mission for the current scope.
}</pre>
|Missions are found in {{path|common/decisions/*.txt}}
|Edits the equipment stockpile of the current scope, adds or removes equipment of a specified type or archetype.
|1.5
|With negative numbers, optionally specifying a producer will ensure only equipment with that producer gets removed. The equipment must be unlocked by the producer for the effect to succeed.
|}
 
===科技===
 
{| class="wikitable sortable" width="100%"
|-
! width="10%" |名字
! width="25%" |参数
! width="25%" |示例
! width="20%" |描述
! width="15%" |注释
! width="5%" |添加
版本
|-
|add_research_slot
|<code><int></code><br /> 要加多少个科研槽
|<pre>add_research_slot = 1</pre>
 
| 让一个国家增加一定数量个科研槽
|&nbsp;
|1.0
|1.0
|-
|-id="send_equipment"
|set_research_slots
|send_equipment
|<code><int></code><br />设置的
|<code>type = <equipment></code><br/>The equipment to add. Can be archetype.
|<pre>set_research_slots = 4</pre>
<code>amount = <int> / <variable></code><br/>The amount to add.<br/><code>target = <country> / <variable></code><br/>Which country receives the equipment.
 
|<pre>send_equipment = {
|Sets the number of research slots the current scope has.
    equipment = infantry_equipment
|&nbsp;
    amount = 100
|1.0
    target = GER
|-
|add_tech_bonus
|<code>bonus = <float></code><br /> The bonus to technology given
<code>uses = <int></code><br /> The amount of times the bonus can be used.<br /> <code>ahead_reduction = <float></code><br /> The cost reduction if ahead of time.<br /> <code>category = <string></code><br /> Which technology category the bonus applies to. Multiple can be defined.<br /> <code>technology = <string></code><br /> Which technology the bonus applies to. Multiple can be defined.
 
|<pre>add_tech_bonus = {
    bonus = 0.5
    uses = 1
    category = radar_tech
}
}
</pre>
</pre>
 
|Sends the specified amount of equipment to the specified target, removing said equipment from the current scope.
|Grants a research bonus to the current scope with the specified parameters.
|Cannot remove equipment into negatives, in which case equipment will not be received by the target in entirety.
|Research bonus categories are found in <code>Hearts of Iron IV/common/technology_tags/*.txt</code>
|1.0
|1.0
|-
|-id="send_equipment_fraction"
|set_technology
|send_equipment_fraction
|<code><technology> = <int></code><br /> The technology to add.<br><code>popup = no</code><br /> To not show the popup after adding technology
|<code>value = <0-1></code><br/>How much equipment to send.
|<pre>set_technology = {
<code>target = <country> / <variable></code><br/>Which country receives the equipment.
    suicide_craft = 1
|<pre>send_equipment_fraction = {
    value = 0.3
   target = GER
}
}
</pre>
</pre>
 
|Sends the specified fraction of equipment to the specified target, removing said equipment from the current scope.
|Grants the specified technology to the current scope.
|&nbsp;
|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.9
|1.0
|-id="create_production_license"
|-
|create_production_license
|add_to_tech_sharing_group
|<code>target = <country></code><br/>Which country receives the license.<br/>
|<code><string></code><br /> The group to add the current scope to.
<code>cost_factor = <float></code><br/>Modifies the production cost.<br/>
|<pre>add_to_tech_sharing_group = us_research</pre>
'''Equipment scope'''<br/><code>type = <equipment></code><br/>The equipment the country is licensed to produce. Must be an non-archetype equipment.<br/>
 
<code>version = <int></code><br/>The version indicates which variant should be licensed. The default is 0, meaning the base variant.<br/>
|Adds the current scope to the specified technology sharing group.
<code>new_prioritised = <boolean></code><br/>Whether new equipment is prioritised or not. Yes by default.
|&nbsp;
|<pre>create_production_license = {
|1.3
    target = HUN
|-
   equipment = {
|remove_from_tech_sharing_group
     type = fighter_equipment_1
|<code><string></code><br /> The group to remove the current scope from.
     version = 0
|<pre>remove_from_tech_sharing_group = us_research</pre>
     new_prioritised = no
 
    }
|Removes the current scope from the specified technology sharing group.
   cost_factor = 0
|&nbsp;
|1.3
|-
|modify_tech_sharing_bonus
|<code>id = <string></code><br /> The group to modify
<code>bonus = <float></code><br /> The new bonus.
 
|<pre>modify_tech_sharing_bonus = {
    id = us_research
    bonus = 0.5
}
}
</pre>
</pre>
 
|Grants the specified country a license to produce the specified equipment from the current scope.
|Modifies the specified technology sharing group.
|&nbsp;
|&nbsp;
|1.3
|1.4
|}
|-id="add_equipment_subsidy"
 
|add_equipment_subsidy
=== 民族精神/ 内阁===
|<code>cic = <int></code><br/>The amount of economic capacity required by the subsidy.<br/>
 
<code>equipment_type = <archetype></code><br/>The equipment archetype that the subsidy is for.<br/>
{| class="wikitable sortable" width="100%"
<code>seller_tags = { <countries }</code><br/>Countries that can have the subsidy.<br/>
|-
<code>seller_trigger = <scripted trigger></code><br/>The trigger deciding which countries can have the subsidy.<br/>
! width="10%" | 名字
|<pre>add_equipment_subsidy = {
! width="25%" | 参数
   cic = 300
! width="25%" |示例
   equipment_type = support_equipment
! width="20%" |描述
   seller_tags = { BHR }
! width="15%" |注释
}</pre>
! width="5%" | 添加
<pre>add_equipment_subsidy = {
版本
   cic = 1000
|-
   equipment_type = infantry_equipment
|add_ideas
   seller_trigger = my_scripted_trigger
|<code><idea></code><br /> 需添加的民族精神/ 内阁成员
}</pre>
|<pre>add_ideas = my_idea</pre>
|Creates an equipment subsidy on the [[international market]].
<pre>add_ideas = {
|<code>seller_tags</code> and <code>seller_trigger</code> are mutually exclusive. In the scripted trigger, <code>ROOT</code> is the country with the subsidy and <code>FROM</code> is the seller.
    my_idea_1
|1.13
    my_idea_2
|-id="add_cic"
|add_cic
|<code><int></code><br/>The amount of economic capacity to add.
|<pre>add_cic = 300</pre>
|Modifies the economic capacity bank on the [[international market]].
|The economic capacity will be capped to 0 if the total after the effect is negative.
|1.13
|-id="create_equipment_variant"
|create_equipment_variant
|<code>name = <string></code><br/>The name of the variant.<br/>
<code>type = <equipment></code><br/>The equipment type the variant is of.<br/>
<code>parent_version = <int></code><br/>Ordering for multiple variants of the same equipment. 0 is the oldest, 1 is the second-oldest, etc. Optional, 0 by default.<br/>
<code>obsolete = <bool></code><br/>Whether the equipment variant is flagged as obsolete within the GUI and for AI. Optional, no by default.<br/>
<code>mark_older_equipment_obsolete = <bool></code><br/>Marks all older (non-chassis) equipment variants as obsolete as long as the following matches: Archetype, niche, mission set (for planes). Optional, defaults to false.<br/>
<code>name_group = <name group></code><br/>The name group used for equipment. Stored in {{path|common/units/names_ships}}. Optional, can only be defined for ships.<br/>
<code>role_icon_index = <int>/auto</code><br/>Index of the role icon that will be used, as an integer. If set to "auto", will pick automatically. If set to 0, will be unset. Optional, only can be defined for ships.<br/>
<code>model = <model name></code><br/>Model that will be used by the equipment on the world map. Optional.<br/>
<code>icon = <sprite></code><br/>The icon that will be used by equipment. Stored as a spriteType within {{path|interface/*.gfx}}. Optional.<br/>
<code>design_team = mio:<MIO></code><br/>The [[military industrial organisation]] that should be set as the designer of the equipment. Optional.<br/>
<code>allow_without_tech = <bool></code><br/>If set, bypasses the requirement that the equipment that the variant is for must be unlocked through research. Optional, defaults to false.<br/>
'''Upgrade scope'''<br/><code><upgrade> = <amount></code><br/>The upgrades configuration for the variant.<br/>
'''Module scope'''<br/><code><slot> = <module></code><br/>The modules configuration for the variant.
|<pre>create_equipment_variant = {
   name = "Vetehinen Class"
   type = ship_hull_submarine_1
   name_group = FIN_SS_HISTORICAL
   role_icon_index = 1
   modules = {
     fixed_ship_torpedo_slot = ship_torpedo_sub_1
     fixed_ship_engine_slot = sub_ship_engine_1
     rear_1_custom_slot = ship_mine_layer_sub
   }
}</pre>
<pre>create_equipment_variant = {
   name = "He 112"
   type = fighter_equipment_0
   obsolete = yes
   upgrades = {
     plane_gun_upgrade = 1
     plane_range_upgrade = 1
   }
}</pre>
<pre>create_equipment_variant = {
   name = "Light Tank Mk. IV"
   type = light_tank_chassis_1
   parent_version = 1
   modules = {
     main_armament_slot = tank_heavy_machine_gun
   }
   upgrades = {
     tank_nsb_engine_upgrade = 2
   }
   icon = "GFX_ENG_basic_light_tank_medium"
   model = ENG_MKIV_light_tank_entity
   design_team = mio:ENG_vauxhall_organization
}</pre>
|Creates the specified equipment variant for the current scope.
|Role icons for ships are defined in {{path|gfx/army_icons/army_icons.txt}}.<br/>
Upgrades are defined within {{path|common/units/equipment/upgrades/*.txt}}.<br/>
Equipment types, including module slots for them, are defined within {{path|common/units/equipment/*.txt}}.<br/>
Equipment modules are defined within {{path|common/units/equipment/modules/*.txt}}.<br/>
|1.0
|-id="add_equipment_production"
|add_equipment_production
|<code>amount = <int></code><br/>The amount to produce before automatically stopping. Optional.
<code>requested_factories = <int></code><br/>The number of factories to assigned initially. Optional.<br/>
<code>progress = <float></code><br/>The initial production progress. Optional.<br/>
<code>efficiency = <float></code><br/>The initial production efficiency. Optional.<br/>
<code>name = <string></code><br/>The name that'll be used for the equipment, such as with ships. Optional.<br/>
<code>industrial_manufacturer = mio:<MIO></code><br/>The [[military industrial organisation]] that's set as the equipment's designer.<br/>
'''Equipment scope'''<br/>
<code>type = <equipment></code><br/>The name of the equipment to produce.<br/>
<code>creator = <country></code><br/>The country which is producing the equipment. Used if root scope isn't producer. Optional.<br/>
<code>version_name = <string></code>The name of the variant to produce. Optional.
|<pre>add_equipment_production = {
   equipment = {
     type = light_cruiser_2
   }
   requested_factories = 1
    progress = 0.95
    amount = 1
}
}
</pre>
</pre>
 
|Starts a production line for the specified equipment for the current scope.
| 将指定民族精神添加到当前作用域。
|&nbsp;
| 可以在同效果内添加多个民族精神。
|1.0
|1.0
|-
|}
|add_timed_idea
|<code>idea = <idea></code><br /> 需添加的民族精神
<code>days = <int> / <variable></code><br /> 限时存在的天数


|<pre>add_timed_idea = {
===Military===
   idea = my_idea
   days = 180
}
</pre>


| 在指定作用域添加限时民族精神。
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|&nbsp;
|+ class="nowrap" | Military-related country-scoped effects:<br/>
|1.0
! width="10%" |Name
|-
! width="25%" |Parameters
|modify_timed_idea
! width="25%" |Examples
|<code>idea = <idea></code><br /> 需要修改的民族精神
! width="20%" |Description
<code>days = <int> / <variable></code><br /> 需要添加的时间量(天数)
! width="15%" | Notes
 
! width="5%" |Version Added
|<pre>modify_timed_idea = {
|-id="destroy_ships"
    idea = my_idea
|destroy_ships
    days = 60
|<code>type = <ship></code><br/>The type of ship to destroy.<br/>
<code>count = <int> or all</code><br/>The amount to destroy.
|<pre>destroy_ships = {
    type = destroyer
    count = all
}
}
</pre>
</pre>
 
|Destroys the specified type and amount of ships controlled by the current scope.
| 将限时民族精神的持续时间延长指定量。
|&nbsp;
|&nbsp;
|1.0
|1.5
|-
|-id="transfer_navy"
|swap_ideas
|transfer_navy
|<code>add_idea = <idea></code><br /> 需添加的民族精神
|
<code>remove_idea = <idea></code><br /> 需移除的民族精神
<code>target = <country></code><br/>The target country.
 
|<pre>transfer_navy = {
|<pre>swap_ideas = {
   target = GER
    remove_idea = my_idea_1
}</pre>
    add_idea = my_idea_2
|Transfers the current scope navy to the specified country.
|&nbsp;
|1.5
|-id="transfer_ship"
|transfer_ship
|<code>type = <ship></code><br/>The type of ship to transfer.<br/>
<code>target = <country></code><br/>The target country.<br/>
<code>prefer_name = <string></code><br/>Name of ship in origin navy that will preferably be transferred to target navy. Optional.<br/>
<code>exclude_refitting = <bool></code><br/>Determines whether ships that are being refitted will be transferred. Optional.
|<pre>transfer_ship = {
    prefer_name = "HMS Achilles"
   type = light_cruiser
   target = NZL
    exclude_refitting = no
}
}
</pre>
</pre>
 
|Transfers the specified type of ship from the current scope to the specified country.
| 在被添加和移除的民族精神之间显示效果的更改内容和差异。
|&nbsp;
|&nbsp;
|1.3
|1.4
|-
|-id="create_ship"
|remove_ideas
|create_ship
|<code><idea></code><br /> 需移除的民族精神
|<code>type = <ship></code><br/>The type of ship to create.<br/>
|<pre>remove_ideas = my_idea</pre>
<code>equipment_variant = <string></code><br/>The equipment variant to use.<br/>
<pre>remove_ideas = {
<code>creator = <country></code><br/>The country that created this ship. Optional.<br/>
    my_idea_1
<code>name = <string></code><br/>Name of the ship. Optional.<br/>
    my_idea_2
<code>amount = <int></code><br/>The amount of ships to create. Optional, defaults to 1.
|<pre>FRA = {
    create_ship = {
     type = ship_hull_submarine_1
     equipment_variant = "S Class"
     creator = ENG
     name = "My ship name"
    }
}
}
</pre>
</pre>
 
|Create a ship from another country and assign it to the reserve fleet. If not set, it will be the scoped country.
| 将指定民族精神移除出当前作用域。
|&nbsp;
| 可以在同效果内移除多个民族精神。.
|1.9
|1.0
|-id="add_mines"
|-
|add_mines
|remove_ideas_with_trait
|Add mines to a strategic region for the current country.
|<code><trait></code><br /> The trait to target.
|<pre>add_mines = { region = 42 amount = 100 }</pre>
|<pre>remove_ideas_with_trait = motorized_equipment_manufacturer
|Add mines to a strategic region.
|&nbsp;
|1.6
|-id="add_ace"
|add_ace
|<code>name = <string></code><br/>The name of the ace.<br/>
<code>surname = <string></code><br/>The surname of the ace.<br/>
<code>callsign = <string></code><br/>The callsign of the ace.<br/>
<code>type = <type></code><br/>The ace type.<br/>
<code>is_female = <bool></code><br/>The gender of the ace.
|<pre>add_ace = {
   name = "Amelia"
   surname = "Earhart"
   callsign = "Revenant"
   type = fighter_genius
   is_female = yes
}
</pre>
</pre>
 
|Adds an ace for the current scope.
|Removes all ideas for the current scope that use the specified trait.
|Ace types found in {{path|common/aces/*.txt}}.
|&nbsp;
|1.0
|-
|show_ideas_tooltip
|<code><idea></code><br /> 需要展示的民族精神
|<pre>show_ideas_tooltip = my_idea</pre>
 
|在当前作用域中显示指定的民族精神,注意,这个效果并不添加民族精神。
|&nbsp;
|1.0
|1.0
|}
|}


=== 单位===
===Intelligence===


{| class="wikitable sortable" width="100%"
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|-
|+ class="nowrap" | Intelligence-related country-scoped effects:<br/>
! width="10%" |Name
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Parameters
第2,181行: 第2,884行:
! width="20%" |Description
! width="20%" |Description
! width="15%" |Notes
! width="15%" |Notes
! width="5%" |Version Added
! width="5%" | Version Added
|-
|-id="create_intelligence_agency"
|load_oob(生成单位)
|create_intelligence_agency
|<code><oob></code><br /> 引入生成单位的指定文件,并通过该文件生成单位(生成单位的指定文件应放置于history\units文件夹中)
|Allows to create automatically an intelligence agency
|<pre>load_oob = "GER_default"</pre>
|<pre>create_intelligence_agency = {
 
   name = "A.G.E.N.C.Y"
|Loads the specified OOB for the current scope, applying the effects within.
   icon = GFX_intelligence_agency_logo_agency
}</pre>
|Creates an Intelligence Agency.
|&nbsp;
|&nbsp;
|1.0
|1.9
|-
|-id="upgrade_intelligence_agency"
|division_template
|upgrade_intelligence_agency
|<code>name</code><br /> The name of the division. <pre>regiments = {
|Allows to unlock automatically an intelligence agency upgrade
    <unit> = { x = 0 y = 0 }
|<pre>upgrade_intelligence_agency = upgrade_form_department</pre>
}
<pre>upgrade_intelligence_agency = <upgrade></pre>
support = {
|Unlocks an Intelligence Agency Upgrade.
   <unit> = { x = 0 y = 0 }
|Upgrades can be found in common/intelligence_agency_upgrades
}
|1.9
</pre>
|-id="add_decryption"
 
|add_decryption
The composition of the division.
|<code>target = <tag></code><br/>Towards which country to add decryption.<br/>
 
<code>amount = <int></code><br/>How much decryption to add in flat numbers.<br/>
|<pre>division_template = {
<code>ratio = <0-1></code><br/>How much decryption ratio to add.
    name = "Test"
|<pre>add_decryption = {
    regiments = {
    target = GER
     infantry = { x = 0 y = 0 }
   amount = 300
     infantry = { x = 0 y = 1 }
}</pre>
     infantry = { x = 0 y = 2 }
<pre>add_decryption = {
     infantry = { x = 0 y = 3 }
   target = GER
   }
   ratio = 0.5
   support = { 
}</pre>
     military_police = { x = 0 y = 0 }
|Adds decryption towards the target country
  
|<code>target</code> and <code>ratio</code> arguments are mutually exclusive.
|1.9
|-id="add_intel"
|add_intel
|<code>target = <tag></code><br/>Towards which country to add intelligence.<br/>
<code>civilian_intel = <int></code><br/>How much civilian intel to add.<br/>
<code>army_intel = <int></code><br/>How much army intel to add.<br/>
<code>navy_intel = <int></code><br/>How much navy intel to add.<br/>
<code>airforce_intel = <int></code><br/>How much airforce intel to add.<br/>
|<pre>add_intel = {
   target = GER
   civilian_intel = 3
   army_intel = 2
   navy_intel = 1
   airforce_intel = 2
}</pre>
|Adds the specified amount of intel towards the specified country.
|If an intel argument is left out, 0 is assumed.
|1.9
|-id="add_operation_token"
|add_operation_token
|<code>tag = <tag></code><br/>Towards which country to add a token on.<br/>
<code>token = <id></code><br/>Which token to add.<br/>
|<pre>add_operation_token = {
    tag = GER
   token = token_test
}</pre>
|Adds an operation token towards the country, allowing access to more intel or applying a targeted modifier.
|Operation tokens are defined in {{path|common/operation_tokens/*}}.
|1.9
|-id="remove_operation_token"
|remove_operation_token
|<code>tag = <tag></code><br/>Towards which country to remove a token from.<br/>
<code>token = <id></code><br/>Which token to remove.<br/>
|<pre>remove_operation_token = {
   tag = GER
    token = token_test
}</pre>
|Removes an operation token from the country.
|Operation tokens are defined in {{path|common/operation_tokens/*}}.
|1.9
|-id="capture_operative"
|capture_operative
|<code>operative = <tag></code><br/>Which operative to capture.<br/>
<code>ignore_death_chance = <bool></code><br/>Whether to ignore the death chance on capture (no by default).<br/>
|<pre>capture_operative = {
   operative = PREV
   ignore_death_chance = yes
}</pre>
<pre>capture_operative = PREV</pre>
|Captures the specified operative.
|Operatives can be referred to by using [[Scopes#Moving_Between_Scopes|tags that refer to scopes]]
|1.9
|-id="create_operative_leader"
|create_operative_leader
|<code>bypass_recruitment = <bool></code><br/>Whether the operative is directly added to the list of available operatives or needs to be recruited.
<code>available_to_spy_master = <bool></code><br/>Whether the operative can be recruited by the spy master. bypass_recruitment should be set to no.
<code>portrait_tag_override = <bool></code><br/>If selecting a random portrait, create one that is from the specified country rather than the current country.
<code>name = <string></code><br/>The name of the operative.<br/>
<code>GFX = <string></code><br/>The graphical reference of the picture of the leader, defined as a sprite within any {{path|interface/*.gfx}} file.<br/>
<code>nationalities = { <tag> }</code><br/>The nationalities of the operative.<br/>
<code>traits = { <trait> }</code><br/>The traits the leader spawns with.<br/>
<code>gender = <male{{!}}female></code><br/>The gender of the operative. Defaults to random.
|<pre>create_operative_leader = {
name = "Jacques Duclos"
GFX = GFX_portrait_jacques_duclos
traits = { operative_infiltrator operative_natural_orator }
bypass_recruitment = no
available_to_spy_master = yes
nationalities = { FRA POL }
}
}
</pre>
</pre>
|Creates an operative for the current scope with the specified attributes.
|Traits are found in {{path|common/unit_leader/*.txt}}. All arguments aside from bypass_recruitment are optional. '''Must use a spriteType for the portrait''', a direct link as in "gfx/leaders/TAG/filename.dds" will not work.
|1.9
|-id="free_operative"
|free_operative
|<code><tag></code><br/>The operative to be freed.
|<pre>free_operative = PREV</pre>
|Frees the specifies operative.
|Operatives can be referred to by using [[Scopes#Moving_Between_Scopes|tags that refer to scopes]]
|1.9
|-id="free_random_operative"
|free_random_operative
|<code>captured_by = <tag></code><br/>The country that captured the operative.
<code>all = <bool></code><br/>Whether to free all operatives or not (Defaults to no).
|<pre>free_random_operative = {
captured_by = POL
all = yes
}</pre>
|Frees one random captured operative or all of them.
|
|1.9
|-id="kill_operative"
|kill_operative
|<code>operative = <tag></code><br/>The operative that is killed.
|<pre>kill_operative = {
   operative = PREV
}</pre>
<pre>kill_operative = PREV</pre>
|Kills the targeted operative.
|Operatives can be referred to by using [[Scopes#Moving_Between_Scopes|tags that refer to scopes]]
|1.9
|-id="turn_operative"
|turn_operative
|<code>operative = <tag></code><br/>The operative that is turned.
|<pre>turn_operative = {
   operative = PREV
}</pre>
<pre>turn_operative = PREV</pre>
|Turns the targeted operative against their own country, transferring them to the current country.
|Operatives can be referred to by using [[Scopes#Moving_Between_Scopes|tags that refer to scopes]]. This counts as the operative dying and will trigger the corresponding [[On action]]. Logs an error if used against your own operative.
|1.9
|-id="steal_random_tech_bonus"
|steal_random_tech_bonus
|<code>category = <category name></code><br/>The category to steal from. See {{path|common/technology_tags/*}} for list.
<code>folder = naval_folder</code><br/>The folder to steal from. See {{path|common/technology_tags/*}} for list.
<code>ahead_reduction = <float></code><br/>The reduction to the ahead of time penalty.
<code>bonus = <float></code><br/>The bonus to research speed.
<code>base_bonus = <float></code><br/>The backup bonus if no tech is available.
<code>instant = <bool></code><br/>Whether to instantly give a tech instead of a bonus or not. No by default.
<code>dynamic = <bool></code><br/>Changes between instant and non-instant based on type. No by default.
<code>name = <localisation key></code><br/>The name of the bonus.
<code>target = <tag></code><br/>The country to steal from.
<code>uses = <int></code><br/>How many times the bonus can be used.
|<pre>steal_random_tech_bonus = {
   category = air_equipment
   folder = naval_folder
   ahead_reduction = 0.8
   bonus = 1.2
   base_bonus = 1.1
   dynamic = yes
   name = LOC_KEY
   target = POL
   uses = 2
}</pre>
|Steals a random tech bonus from the specified country.
|If a country does not have a tech to be stolen, a random bonus will be applied by using base_bonus as a base.
|1.9
|}


|Creates and adds the specified division template to the current scope.
===Characters===
|The ''x'' and ''y'' attributes represent the rows and columns in the division designer.
These are the character-related effects in the country scope. For effects in character scope, see {{Section link||Character scope}}.
|1.0
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|-
|+ class="nowrap" | Character-related country-scoped effects:<br/>
|set_division_template_lock
! width="10%" |Name
|<code>division_template = <string></code><br /> The name of the division template
! width="25%" |Parameters
<code>is_locked = <bool></code><br /> Whether the division is locked or not.
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="set_nationality"
|set_nationality
|<code>target_country = <country> / <variable></code><br/>The target country.<br/>
<code>character = <character></code> The character to transfer.
|<pre>set_nationality = {
   target_country = TZN
   character = OMA_sultan
}</pre>
|Switches the specified character to the specified country.
|If you wish to change the nationality of a specific character, and the country getting the effect doesn't have the character recruited already, use the
<pre>every_possible_country = {
   limit = { has_character = ID }
   random_character = {
     limit = { is_character = ID }
     set_nationality = TAG
   }
}</pre>
command to call them up. Only necessary in 1.11 and beyond.
|1.11
|-id="retire_character"
|retire_character
|<code><character></code>
|<pre>retire_character = GER_Character_Token</pre>
|Retires the character, removing every role they hold and making them disappear from the game.
|Country scope only. The character cannot be re-recruited after retiring.
|1.11
|-id="set_character_name"
|set_character_name
|<code>character = <character></code><br/>The character to modify.<br/>
<code>name = <localisation key></code><br/>The new name of the character.
|<pre>set_character_name = {
character = my_character
name = my_name
}</pre>
|Sets the new name for the target character.
|[[#c_set_character_name|Can also be used in character scope.]]
|1.11
|-id="character_list_tooltip"
|character_list_tooltip
|<code>limit = { <triggers> }</code><br/>Triggers that must be fulfilled to show up in the list.<br/>
<code>random_select_amount = <int></code><br/>Upper bound on the characters that may be shown.
|<pre>character_list_tooltip = {
limit = {
     has_character_flag = SOV_targeted_for_purge_flag
   }
   random_select_amount = 4
}</pre>
|Displays a list of every character meeting the specified limitation and recruited by the current country.
|
|1.11
|-id="add_trait"
|add_trait
|<code>character = <character></code><br/>The character to modify.<br/>
<code>slot = <slot></code> Slot of the character. Necessary for advisors.<br/>
<code>ideology = <sub-ideology></code> Ideology type of the character. Necessary for country leaders.<br/>
<code>trait = <trait></code><br/>The trait to add.
|<pre>add_trait = {
   character = TAG_jane_smith
   slot = political_advisor
   trait = really_good_boss
}</pre>
<pre>add_trait = {
   character = TAG_my_leader
   ideology = liberalism
   trait = field_of_gar
}</pre>
|Adds the specified country leader trait to the character.
|[[#c_add_trait|Can also be used in character scope]]. Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon. The character slot can be the character's name or id. Using name is recommended because 1.11 made id obsolete.
|1.11
|-id="remove_trait"
|remove_trait
|<code>character = <character></code><br/>The character to modify.<br/>
<code>slot = <slot></code> Slot of the character. Necessary for advisors.<br/>
<code>ideology = <sub-ideology></code> Ideology type of the character. Necessary for country leaders.<br/>
<code>trait = <trait></code><br/>The trait to remove.
|<pre>remove_trait = {
   character = TAG_jane_smith
   slot = political_advisor
   trait = really_good_boss
}</pre>
<pre>remove_trait = {
   character = TAG_my_leader
   ideology = liberalism
   trait = field_of_gar
}</pre>
|Removes the specified trait from the character.
|[[#c_remove_trait|Can also be used in character scope]]. Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon. The character slot can be the character's name or id. Using name is recommended because 1.11 made id obsolete.
|1.11
|}
====Unit leaders====


|<pre>set_division_template_lock = {
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
   division_template = "Infantry Division"
|+ class="nowrap" | Unit leader-related country-scoped effects:<br/>
   is_locked = yes
! width="10%" |Name
}
! width="25%" |Parameters
</pre>
! width="25%" |Examples
 
! width="20%" |Description
|Toggles the locked status on a division template for the current scope, which prevents editing or deletion.
! width="15%" |Notes
|&nbsp;
! width="5%" |Version Added
|1.5
|-id="create_corps_commander"
|-
|create_corps_commander
|delete_unit_template_and_units
|<code>name = <string></code><br/>The name of the leader.
|<code>division_template = <string></code><br /> The name of the division template.
<code>picture = <string></code>''OR''<br/>
|<pre>delete_unit_template_and_units = {
<code>portrait_path = <string></code>''OR''<br/>
   division_template = "Infantry Division"
<code>{{hover|Same as portrait_path|gfx}} = <string></code><br/>The graphical reference of the picture of the leader.
   disband = yes #will refund equipment and manpower
<code>skill = <int></code><br/>The skill of the leader.<br/>
<code>attack_skill = <int></code><br/>The attack skill of the leader.<br/>
<code>defense_skill = <int></code><br/>The defense skill of the leader.<br/>
<code>planning_skill = <int></code><br/>The planning skill of the leader.<br/>
<code>logistics_skill = <int></code><br/>The logistics skill of the leader.<br/>
<code>traits = { <trait> }</code><br/>The traits the leader spawns with.<br/>
<code>female = <bool></code><br/>The gender of the leader.<br/>
<code>legacy_id = <int></code><br/>The legacy ID used for the unit leader. Optional.
|<pre>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
}
}
</pre>
</pre>
|Deletes the specified division template and all units using it for the current scope.
|Creates a commander for the current scope with the specified attributes.
|&nbsp;
|Traits are found in {{path|common/unit_leader/*.txt}}. '''Deprecated''', recommended to use [[#add_corps_commander_role|add_corps_commander_role]] instead when possible. '''The created corps commander will not be able to have a portrait if assigned to be a minister via officer corps, causing errors.'''
|1.5
|1.0
|-
|-id="create_field_marshal"
|delete_unit
|create_field_marshal
|<code>state = <number id></code><br /> The id number of the state.
|<code>name = <string></code><br/>The name of the leader.
|<pre> ENG = { delete_unit = { 
<code>picture = <string></code>''OR''<br/>
       state = 787      
<code>portrait_path = <string></code>''OR''<br/>
       disband = yes #will refund equipment and manpower
<code>{{hover|Same as portrait_path|gfx}} = <string></code><br/>The graphical reference of the picture of the leader.
        }}
<code>skill = <int></code><br/>The skill of the leader.<br/>
</pre>
<code>attack_skill = <int></code><br/>The attack skill of the leader.<br/>
|Deletes all units within the specified state using the country scope.
<code>defense_skill = <int></code><br/>The defense skill of the leader.<br/>
|&nbsp;
<code>planning_skill = <int></code><br/>The planning skill of the leader.<br/>
|1.5
<code>logistics_skill = <int></code><br/>The logistics skill of the leader.<br/>
<code>traits = { <trait> }</code><br/>The traits the leader spawns with.<br/>
<code>female = <bool></code><br/>The gender of the leader.<br/>
<code>legacy_id = <int></code><br/>The legacy ID used for the unit leader. Optional.
|<pre>create_field_marshal = {
name = "Maurice Gamelin"
portrait_path = "GFX_portrait_FRA_maurice_gamelin"
traits = { defensive_doctrine }
skill = 2
attack_skill = 1
defense_skill = 3
planning_skill = 2
logistics_skill = 1
}
</pre>
|Creates a field marshal for the current scope with the specified attributes.
|Traits are found in {{path|common/unit_leader/*.txt}}. Deprecated, recommended to use [[#add_field_marshal_role|add_field_marshal_role]] instead when possible. '''The created field marshal will not be able to have a portrait if assigned to be a minister via officer corps, causing errors.'''
|1.0
|-id="create_navy_leader"
|create_navy_leader
|<code>name = <string></code><br/>The name of the leader.
<code>picture = <string></code>''OR''<br/>
<code>portrait_path = <string></code>''OR''<br/>
<code>{{hover|Same as portrait_path|gfx}} = <string></code><br/>The graphical reference of the picture of the leader.
<code>skill = <int></code><br/>The skill of the leader.<br/>
<code>attack_skill = <int></code>The attack skill of the leader.<br/>
<code>defense_skill = <int></code>The defense skill of the leader.<br/>
<code>maneuvering_skill = <int></code>The maneuvering skill of the leader.<br/>
<code>coordination_skill = <int></code>The coordination skill of the leader.<br/>
<code>traits = { <trait> }</code><br/>The traits the leader spawns with.<br/>
<code>female = <bool></code><br/>The gender of the leader.<br/>
<code>legacy_id = <int></code><br/>The legacy ID used for the unit leader. Optional.
|
<pre>create_navy_leader = {
name = "François Darlan"
gfx = "GFX_portrait_FRA_francois_darlan"
traits = { superior_tactician }
skill = 3
attack_skill = 2
defense_skill = 4
maneuvering_skill = 3
coordination_skill = 2
}
</pre>
|Creates a naval leader for the current scope with the specified attributes.
|Traits are found in {{path|common/unit_leader/*.txt}}. Deprecated, recommended to use [[#add_naval_commander_role|add_naval_commander_role]] instead when possible. '''The created admiral will not be able to have a portrait if assigned to be a minister via officer corps, causing errors.'''
|1.0
|-id="remove_unit_leader"
|remove_unit_leader
|<code><id></code><br/>The id of the unit leader.
|<pre>remove_unit_leader = 70</pre>
|Removes the specified unit leader by their legacy ID.
|Does not work with the character ID. Instead, [[#remove_unit_leader_role|remove_unit_leader_role]] within the scope of the character is recommended when possible.
|1.0
|-id="add_corps_commander_role"
|add_corps_commander_role
|<code>character = <character></code><br/>The character to modify.<br/>
<code><...></code><br/>[[Character modding#Unit leaders|Army leader role definition]]<br/>
|<pre>add_corps_commander_role = {
   Character = GER_Character_token
   skill = 4
   attack_skill = 2
   defense_skill = 3
   planning_skill = 3
   logistics_skill = 5
}</pre>
|Sets the specified character to also act as a corps commander.
|[[#c_add_corps_commander_role|Can also be used in character scope.]]
|1.11
|-id="add_field_marshal_role"
|add_field_marshal_role
|<code>character = <character></code><br/>The character to modify.<br/>
<code><...></code><br/>[[Character modding#Unit leaders|Army leader role definition]]<br/>
|<pre>add_field_marshal_role = {
  character = GER_Character_token
  skill = 4
  attack_skill = 2
  defense_skill = 3
  planning_skill = 3
  logistics_skill = 5
}</pre>
|Sets the specified character to also act as a field marshal.
|[[#c_add_field_marshal_role|Can also be used in character scope.]]
|1.11
|-id="add_naval_commander_role"
|add_naval_commander_role
|<code>character = <character></code><br/>The character to modify.<br/>
<code><...></code><br/>[[Character modding#Unit leaders|Navy leader role definition]]<br/>
|<pre>add_naval_commander_role = {
  Character = GER_Character_token
  skill = 4
  attack_skill = 2
  defense_skill = 3
  planning_skill = 3
  logistics_skill = 5
}</pre>
|Sets the specified character to also act as an admiral.
|[[#c_add_naval_commander_role|Can also be used in character scope.]]
|1.11
|-id="show_unit_leaders_tooltip"
|show_unit_leaders_tooltip
|<code><character></code><br/>The character whose name is to be shown.
|<pre>show_unit_leaders_tooltip = TAG_my_leader</pre>
|Shows the name of the specified character as a tooltip.
|
|1.11
|}
|}


=== 装备===
====Country leaders====


{| class="wikitable sortable" width="100%"
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|-
|+ class="nowrap" | Country leader-related country-scoped effects:<br/>
! width="10%" |Name
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Parameters
第2,267行: 第3,323行:
! width="15%" |Notes
! width="15%" |Notes
! width="5%" |Version Added
! width="5%" |Version Added
|-
|-id="create_country_leader"
|set_equipment_fraction
|create_country_leader
|<code><float> / <variable></code><br /> The fraction of equipment to remove.
|<code>name = <string></code><br/>The name of the leader.
|<pre>set_equipment_fraction = 0.5</pre>
<code>desc = <string></code><br/>The description of the leader.<br/><code>picture = <spriteType></code><br/>The graphical reference to the leader portrait.<br/><code>expire = <string></code><br/>When the leader dies in history.<br/><code>ideology = <string></code><br/>The sub-ideology of the country leader. Does not accept regular ideologies.<br/>
 
<code>female = <bool></code><br/>The gender of the leader.<br/>'''Traits scope'''<br/><code><trait></code><br/>The trait to add. Can add multiple.
|Reduces the overall equipment stockpile by the specified fraction.
|<pre>create_country_leader = {
|This should '''not''' be used in civil wars to simulate stockpile splitting. <code>start_civil_war</code> now automatically divides stockpiles according to the respective size.
name = AFG_mohammed_zahir_shah
|1.0
desc = "POLITICS_MOHAMMED_ZAHIR_SHAH_DESC"
|-
picture = GFX_AFG_mohammed_zahir_shah
|add_equipment_to_stockpile
expire = "1965.1.1"
|<code>type = <equipment></code><br /> The equipment to add. Can be archetype
ideology = despotism
<code>amount = <int></code><br /> The amount to add.<br /> <code>producer = <scope></code><br /> Defines who produced the equipment. Optional.
traits = {
 
}
|<pre>add_equipment_to_stockpile = {
   type = infantry_equipment
   amount = 100
   producer = GER
}
}
</pre>
</pre>
|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
|<code>type = <equipment></code><br /> The equipment to add. Can be archetype.
<code>amount = <int> / <variable></code><br /> The amount to add.<br /> <code>target = <scope> / <variable></code><br /> Which country receives the equipment.
|<pre>send_equipment = {
   equipment = infantry_equipment
   amount = 100
   target = GER
}
</pre>
|Sends the specified amount of equipment to the specified target, removing said equipment from the current scope.
|&nbsp;
|&nbsp;
|The portrait uses a spriteType, defined within {{path|interface/*.gfx}}.<br/>
Sub-ideologies are defined in {{path|common/ideologies}}.<br/>
Deprecated. Recommended to use [[#add_country_leader_role|add_country_leader_role]] instead when possible.
|1.0
|1.0
|-
|-id="add_country_leader_role"
|create_production_license
|add_country_leader_role
|<code>target = <scope></code><br /> Which country receives the license
|<code>character = <character></code><br/>The character to modify.<br/>
<code>cost_factor = <float></code><br /> Modifies the production cost.<br /> '''Equipment scope'''<br /> <code>type = <equipment></code><br /> The equipment the country is licensed to produce. Must be an non-archetype equipment.
<code>country_leader = { ... }</code><br/>[[Character modding#Country leaders|Country leader role definition]]<br/>
 
<code>promote_leader = <bool></code><br/>Will promote the leader to be the leader of the assigned party. Optional, defaults to false.
|<pre>create_production_license = {
|<pre>add_country_leader_role = {
    target = HUN
    character = GER_character_token
    equipment = {
    promote_leader = yes
      type = fighter_equipment_1
   country_leader = {
      ideology = fascism_ideology
     expire = "1965.1.1.1"
     traits = { war_industrialist }
    }
    }
    cost_factor = 0
}</pre>
}
|Sets the specified character to also act as a country leader, promoting to the party leader if specified.
</pre>
|[[#c_add_country_leader_role|Can also be used in character scope.]] Does absolutely nothing if the character already has a country leader role in the ideology group.
 
|1.11
|Grants the specified country a licensed to produce the specified equipment from the current scope.
|-id="promote_character"
|promote_character
|<code><character></code><br/>The character to promote.<br/>
'''OR'''<br/>
<code>character = <character></code><br/>The character to promote.<br/>
<code>ideology = <ideology type></code><br/>The ideology type used by the country leader role.
|<pre>promote_character = GER_erwin_rommel</pre>
<pre>promote_character = {
    character = GER_erwin_rommel
   ideology = nazism
}</pre>
|Promotes a character to the leader of their political party.
|[[#c_promote_character|Can also be used in character scope.]] If the character has multiple country leader roles, specifying the ideology type is mandatory. Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon.
|1.11
|-id="remove_country_leader_role"
|remove_country_leader_role
|<code>character = <character></code><br/>The character to modify.<br/>
<code>ideology = <string></code><br/>The ideology type of the character.
|<pre>remove_country_leader_role = {
   character = GER_Character_Token
   ideology = socialism
}</pre>
|Removes a country leader role from a character.
|[[#c_remove_country_leader_role|Can also be used in character scope.]] Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon.
|1.11
|-id="kill_ideology_leader"
|kill_ideology_leader
|<code><ideology></code><br/>Ideology.
|<pre>kill_ideology_leader = communism</pre>
|Kills the country leader of the designated ideology for the current scope.
|&nbsp;
|&nbsp;
|1.4
|1.9
|-
|-id="retire_ideology_leader"
|create_equipment_variant
|retire_ideology_leader
|<code>name = <string></code><br /> The name of the variant
|<code><ideology></code><br/>Ideology.
<code>type = <equipment></code><br /> The equipment the variant is of.<br /> <code>parent_version = <int></code><br /> Ordering for multiple variants.<br /> '''Upgrade scope'''<br /> <code><upgrade> = <amount></code><br /> The upgrades configuration for the variant.
|<pre>retire_ideology_leader = fascism</pre>
 
|Retires and removes the country leader of the ideology party for the current scope.
|<pre>create_equipment_variant = {
|&nbsp;
   name = "Montecuccoli Class"
|1.9
   type = light_cruiser_1
|-id="kill_country_leader"
   upgrades = {
|kill_country_leader
     ship_reliability_upgrade = 3
|<code><bool></code><br/>Boolean.
     ship_engine_upgrade = 3
|<pre>kill_country_leader = yes</pre>
     ship_gun_upgrade = 3
|Kills the country leader for the current scope.
     ship_anti_air_upgrade = 3
   }
}
</pre>
 
|Creates the specified equipment variant for the current scope.
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|-id="retire_country_leader"
|add_equipment_production
|retire_country_leader
|<code>amount = <int></code><br /> The amount to produce. Optional
|<code><bool></code><br/>Boolean.
<code>requested_factories = <int></code><br /> The number of factories to assigned initially. Optional.<br /> <code>progress = <float></code><br /> The initial production progress. Optional.<br /> <code>efficiency = <float></code><br /> The initial production efficiency. Optional.<br /> '''Equipment scope'''<br /> <code>type = <equipment></code><br /> The name of the equipment to produce.<br /> <code>creator = <scope></code><br /> The country which is producing the equipment. Used if root scope isn't producer. Optional.<br /> <code>version_name = <string></code>The name of the variant to produce. Optional.
|<pre>retire_country_leader = yes</pre>
 
|Retires and removes the country leader as head of their party for the current scope.
|<pre>add_equipment_production = {
   equipment = {
     type = light_cruiser_2
   }
   requested_factories = 1
   progress = 0.95
   amount = 1
}
</pre>
 
|Starts a production line for the specified equipment for the current scope.
|&nbsp;
|&nbsp;
|1.0
|1.0
|}
|-id="set_country_leader_ideology"
 
|set_country_leader_ideology
=== 陆军===
|<code><government></code><br/>The government to set.
 
|<pre>set_country_leader_ideology = socialism</pre>
{| class="wikitable sortable" width="100%"
|Changes the country leader's government type for the current scope.
|-
|Creates no tooltip.
! width="10%" |Name
|1.0
|-id="set_country_leader_description"
|set_country_leader_description
|<code>ideology = <ideology></code><br/>The ideology of the country leader, optional.
<code>desc = <localisation key></code><br/>The new description.
|<pre>set_country_leader_description = {
ideology = neutrality
desc = LOC_KEY
}</pre>
|Changes the country leader's description.
|Must use a localisation key from any {{path|localisation/*.yml}} file, putting the description in quotes will not work. [[Localisation]] for more info
|1.9.1
|-id="set_country_leader_name"
|set_country_leader_name
|<code>ideology = <ideology></code><br/>The ideology of the country leader, optional.
<code>name = <localisation key></code><br/>The new name.
|<pre>set_country_leader_name = {
ideology = neutrality
name = LOC_KEY
}</pre>
|Changes the country leader's name.
|
|1.9.1
|-id="set_country_leader_portrait"
|set_country_leader_portrait
|<code>ideology = <ideology></code><br/>The ideology of the country leader, optional.
<code>portrait = <sprite name></code><br/>The new portrait.
|<pre>set_country_leader_portrait = {
ideology = neutrality
portrait = GFX_IMAGE_NAME
}</pre>
|Changes the country leader's portrait.
|The portrait must be defined in {{path|interface/*.gfx}}
|1.9.1
|-id="add_country_leader_trait"
|add_country_leader_trait
|<code><trait></code><br/>The trait to add.
|<pre>add_country_leader_trait = nationalist_symbol</pre>
|Adds the specified trait to the current country's country leader.
|Traits are found in {{path|common/country_leader/*.txt}} files.
|1.0
|-id="remove_country_leader_trait"
|remove_country_leader_trait
|<code><trait></code><br/>The trait to remove.
|<pre>remove_country_leader_trait = nationalist_symbol</pre>
|Removes the specified trait from the current scope's country leader.
|Traits are found in {{path|common/country_leader/*.txt}} files.
|1.0
|-id="swap_ruler_traits"
|swap_ruler_traits
|Similar to swap_ideas. Removes one trait and adds another.
|<pre>swap_ruler_traits = { remove = <trait> add = <trait> }</pre>
|Swaps traits.
|Use [[#swap_country_leader_traits|swap_country_leader_traits]] in character scope.
|1.6
|}
 
====Advisors====
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ class="nowrap" | Advisor-related country-scoped effects:<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Parameters
! width="25%" |Examples
! width="25%" |Examples
第2,372行: 第3,486行:
! width="15%" |Notes
! width="15%" |Notes
! width="5%" |Version Added
! width="5%" |Version Added
|-
|-id="activate_advisor"
|add_manpower
|activate_advisor
|<code><int> / <variable></code><br /> 要添加的数量。
|<code><character></code><br/>The character to activate.
|<pre>add_manpower = 100000</pre>
|<pre>activate_advisor = GER_character_token_air_chief</pre>
<pre>add_manpower = var:my_var</pre>
|Hires an advisor, placing them into their respective slot.
|
|1.11
|-id="deactivate_advisor"
|deactivate_advisor
|<code><character></code><br/>The character to deactivate.
|<pre>deactivate_advisor = GER_character_token_air_chief</pre>
|Dismisses an advisor from their respective slot, leaving it empty.
|
|1.11
|-id="add_advisor_role"
|add_advisor_role
|<code>character = <character></code><br/>The character to modify.<br/>
<code>advisor = { ... }</code><br/>[[Character modding#Advisors|Advisor role definition]]<br/>
<code>activate = <bool></code><br/>Will activate the advisor (add them directly when the command is run to the countries government). Optional, defaults to false.
|<pre>add_advisor_role = {
   character = GER_Character_token
   activate = yes
   advisor = {
     slot = air_chief
     cost = 50
     idea_token = GER_character_token_air_chief
     traits = {
       air_chief_ground_support_2
     }
   }
}</pre>
|Sets the specified character to also act as an advisor, activating if specified.
|[[#c_add_advisor_role|Can also be used in character scope.]] Trigger and effect blocks (such as <code>allowed</code> and <code>on_add</code>) cannot be added within advisor definitions created this way.
|1.11
|-id="remove_advisor_role"
|remove_advisor_role
|<code>character = <character></code><br/>Specifies the character if the effect is executed in country scope.<br/>
<code>slot = <int></code><br/>The slot where to remove the advisor slot from.
|<pre>remove_advisor_role = {
  character = "SOV_genrikh_yagoda"
  slot = political_advisor
}</pre>
|Removes the specified advisor role from the character.
|[[#c_remove_advisor_role|Can also be used in character scope.]]
|1.11
|-id="set_can_be_fired_in_advisor_role"
|set_can_be_fired_in_advisor_role
|<code>character = <character></code><br/>The character to modify.<br/>
<code>slot = <slot></code><br/>The slot of the character to modify.<br/>
<code>value = <bool></code><br/>The value to set.
|<pre>set_can_be_fired_in_advisor_role = {
   character = BHR_important_advisor
   value = no
}</pre>
|Changes the <code>can_be_fired</code> attribute of the advisor, preventing the player from dismissing the advisor.
|[[#c_set_can_be_fired_in_advisor_role|Can also be used in character scope.]]
|1.12.8
|}


| 将指定数量的人力添加到当前范围。
===MIOs===
|&nbsp;
These are the MIO-related effects in the country scope. For effects in [[military industrial organisation]] scope, see {{Section link||MIO scope}}.
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ class="nowrap" | MIO-related country-scoped effects:<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="show_mio_tooltip"
|show_mio_tooltip
|<code><MIO></code><br/>MIO to display.
|<pre>show_mio_tooltip = my_mio</pre>
|Displays a tooltip that shows the name of the MIO and its initial trait (if present).
|Doesn't change the availability of the MIO directly.
|1.13
|-id="unlock_mio_policy_tooltip"
|unlock_mio_policy_tooltip
|<code><policy></code><br/>Policy to display.
'''OR'''<br/>
<code>policy = <policy></code><br/>Policy to display.<br/>
<code>show_modifiers = <bool></code><br/>Whether the trait's modifiers should be shown in the tooltip. Defaults to true.
|<pre>unlock_mio_policy_tooltip = my_policy_1</pre>
<pre>unlock_mio_policy_tooltip = {
   policy = my_policy_2
   show_modifiers = no
}</pre>
|Displays a tooltip that says that the policy is made available.
|Doesn't change the availability of the policy directly.
|1.13
|-id="add_mio_policy_cost"
|add_mio_policy_cost
|<code>policy = <policy></code><br/>Policy to modify.<br/>
<code>value = <int></code><br/>Amount in political power to add.
|<pre>add_mio_policy_cost = {
   policy = my_policy
   value = 10
}</pre>
|Modifies the base cost of a MIO policy.
|The base amount is capped at 0 from below.
|1.13
|-id="set_mio_policy_cost"
|set_mio_policy_cost
|<code>policy = <policy></code><br/>Policy to modify.<br/>
<code>value = <int></code><br/>Amount in political power to set.
|<pre>set_mio_policy_cost = {
   policy = my_policy
   value = 100
}</pre>
|Modifies the base cost of a MIO policy.
|Cannot be negative.
|1.13
|-id="add_mio_policy_cooldown"
|add_mio_policy_cooldown
|<code>policy = <policy></code><br/>Policy to modify.<br/>
<code>value = <int></code><br/>Amount in days to add.
|<pre>add_mio_policy_cooldown = {
   policy = my_policy
   value = 10
}</pre>
|Modifies the base length of a MIO policy cooldown.
|The base amount is capped at 0 from below.
|1.13
|-id="set_mio_policy_cooldown"
|set_mio_policy_cooldown
|<code>policy = <policy></code><br/>Policy to modify.<br/>
<code>value = <int></code><br/>Amount in days to set.
|<pre>set_mio_policy_cooldown  = {
   policy = my_policy
   value = 100
}</pre>
|Modifies the base length of a MIO policy cooldown.
|Cannot be negative.
|1.13
|}
===History===
These effects can '''only be used within history files''', failing when used outside. However, they're considered effects anyway rather than history arguments, as they can be used in if statements.
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ class="nowrap" | Effects to be used in country history files:
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="recruit_character"
|recruit_character
|<code><character></code>
|<pre>recruit_character = GER_Character_token</pre>
|Initially assigns the specified character to the current country.
|
|1.11
|-id="generate_character"
|generate_character
|<code>token_base = <string></code><br>Mandatory, acts as the character token.<br>
<code>name = <localisation key></code><br/>The name used for the character. Generates a random name if not set.
|<pre>generate_character = {
   token_base = army_chief_defensive_1
   name = funny_name
   advisor = {
     slot = air_chief
     cost = 50
     idea_token = GER_character_token_air_chief
     traits = {
       air_chief_ground_support_2
     }
     allowed = {
       always = yes
     }
   }
}</pre>
|Generates a character for current country.
|If used to create an advisor, the idea token of the advisor role will be the <code>token_base</code> and <code>idea_token</code> (defaulting to the slot if the idea token is not set) concatenated, with an underscore as a separator. In the provided example, the idea token will be <code>army_chief_defensive_1_GER_character_token_air_chief</code>; if <code>idea_token</code> wasn't present, it'd be <code>army_chief_defensive_1_air_chief</code>.
|1.11
|-id="set_oob"
|set_oob
|<code><order of battle></code><br/>The name of the file used for the order of battle without the <code>.txt</code> extension.
|<pre>set_oob = BHR_1936</pre>
|Sets the order of battle to be used for the current country's divisions, overriding every other non-naval and non-air order of battle.
|Orders of battle are defined in {{path|history/units/*.txt}} files.
|1.0
|1.0
|-
|-id="set_naval_oob"
|army_experience
|set_naval_oob
|<code><float> / <variable></code><br /> 要添加的数量。
|<code><order of battle></code><br/>The name of the file used for the order of battle without the <code>.txt</code> extension.
|<pre>army_experience = 10</pre>
|<pre>set_naval_oob = BHR_1936_naval_legacy</pre>
 
|Sets the order of battle to be used for the current country's divisions, overriding every other naval order of battle.
| 将指定数量的陆军经验添加到当前范围。
|Orders of battle are defined in {{path|history/units/*.txt}} files.
|&nbsp;
|1.0
|1.0
|-
|-id="set_air_oob"
|create_corps_commander
|set_air_oob
|<code>name = <string></code><br /> The name of the leader.
|<code><order of battle></code><br/>The name of the file used for the order of battle without the <code>.txt</code> extension.
<code>picture = <string></code><br /> The graphical reference of the picture of the leader.<br /> <code>skill = <int></code><br /> The skill of the leader.<br /> <code>attack_skill = <int></code><br /> The attack skill of the leader.<br /> <code>defense_skill = <int></code><br /> The defense skill of the leader.<br /> <code>planning_skill = <int></code><br /> The planning skill of the leader.<br /> <code>logistics_skill = <int></code><br /> The logistics skill of the leader.<br /> <code>traits = { <trait> }</code><br /> The traits the leader spawns with.<br /> <code>female = <bool></code><br /> The gender of the leader.
|<pre>set_air_oob = ITA_1936_air_bba</pre>
|Sets the order of battle to be used for the current country's divisions, overriding every other air order of battle.
|Orders of battle are defined in {{path|history/units/*.txt}} files.
|1.12
|-id="set_keyed_oob"
|set_keyed_oob
|<code>key = <string></code><br/>The key used for the file.<br/>
<code>name = <order of battle></code><br/>The name of the file used for the order of battle without the <code>.txt</code> extension.
|<pre>set_keyed_oob = {
   key = naval
   name = BHR_1936_mtg
}</pre>
|Sets the order of battle to be used for the current country's divisions, overriding every other keyed order of battle that uses the same key.
|Orders of battle are defined in {{path|history/units/*.txt}} files.
|1.0
|}


|<pre>create_corps_commander = {
==State scope==
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
}
</pre>


|Creates a commander for the current scope with the specified attributes.
The effects here must be used within a '''state''' scope.
|Traits are found in {{path|common/unit_leader/*.txt}}.
===General===
|1.0
|-
|create_field_marshal
|<code>name = <string></code><br /> The name of the leader.
<code>picture = <string></code><br /> The graphical reference of the picture of the leader.<br /> <code>skill = <int></code><br /> The skill of the leader.<br /> <code>attack_skill = <int></code><br /> The attack skill of the leader.<br /> <code>defense_skill = <int></code><br /> The defense skill of the leader.<br /> <code>planning_skill = <int></code><br /> The planning skill of the leader.<br /> <code>logistics_skill = <int></code><br /> The logistics skill of the leader.<br /> <code>traits = { <trait> }</code><br /> The traits the leader spawns with.


|<pre>create_field_marshal = {
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
name = "Maurice Gamelin"
|+ class="nowrap" | General state-scoped effects:<br/>
picture = "Portrait_France_Maurice_Gamelin.dds"
! width="10%" |Name
traits = { defensive_doctrine }
! width="25%" |Parameters
skill = 2
! width="25%" |Examples
attack_skill = 1
! width="20%" |Description
defense_skill = 3
! width="15%" |Notes
planning_skill = 2
! width="5%" |Version Added
logistics_skill = 1
|-id="state_event"
|state_event
|<code>id = <event></code><br/>The event to fire.
<code>days = <int> / <variable></code><br/>Fires the event in the specified number of days. Optional.<br/><code>hours = <int> / <variable></code><br/>Fires the event in the specified number of hours. Optional.<br/><code>random = <int> / <variable></code><br/>Adds a random number (between ''0'' and ''random'', inclusive) of '''hours''' to the scheduled fire time. Optional.<br/><code>random_days = <int> / <variable></code><br/>Adds a random number (between ''0'' and ''random_days'', inclusive) of days to the scheduled fire time. Optional.
|
<pre>state_event = {
   id = my_event.1
   days = 10
   random = 50
   random_days = 10
   trigger_for = controller
}
}
</pre>
</pre>
 
|Fires the specified event for the current state.
|Creates a field marshal for the current scope with the specified attributes.
|Where triggers do not need to be repeatedly checked <code>random</code> can be a performance light alternative to <code>mean_time_to_happen</code> for scheduling events.
|Traits are found in {{path|common/unit_leader/*.txt}}.
Using days = <event> / <variable> or hours may still be bugged and will not fire the event.
|1.0
|-id="set_state_flag"
|set_state_flag
|<code><flag></code><br/>An unique string to identify the state flag with.<br/>
'''OR'''<br/>
<code>flag = <flag></code><br/>The flag to set.<br/>
<code>days = <int></code><br/>Sets the flag to last for the specified amount of days. Optional.<br/>
<code>value = <int></code><br/>The new value of the flag on the scale from -2 147 483 648 to 2 147 483 647.
|<pre>set_state_flag = my_flag</pre>
<pre>set_state_flag = {
   flag = my_flag
   days = 123
   value = 1
}</pre>
|Defines a state flag.
|No tooltip is shown. [[Data structures#Flags|The flag in this effect is used in the meaning of 'boolean flag', used to store information.]]
|1.0
|1.0
|}
|-id="clr_state_flag"
 
|clr_state_flag
===海军===
|<code><flag></code><br/>The unique string of a state flag to clear.
 
|<pre>clr_state_flag = my_flag</pre>
{| class="wikitable sortable" width="100%"
|Clears a defined state flag.
|-
|No tooltip is shown.
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-
|navy_experience
|<code><float> / <variable></code><br /> The amount to add.
|<pre>navy_experience = 10</pre>
 
|Adds the specified amount of navy experience to the current scope.
|&nbsp;
|1.0
|1.0
|-
|-id="modify_state_flag"
|destroy_ships
|modify_state_flag
|<code>type = <ship></code><br /> The type of ship to destroy
|<code>flag = <flag></code><br>The flag to modify.<br>
<code>count = <int> or all</code><br /> The amount to destroy.
<code>value = <value></code><br>The value to add to the flag. Defaults to 0.<br>
 
<code>days = <int></code><br/>The amount of days that the flag should last for before being cleared. Optional, defaults to permanent.<br/>
|<pre>destroy_ships = {
|<pre>
    type = destroyer
modify_state_flag = {
    count = all
    flag = my_flag
}
    value = 3
}</pre>
|Adds an integer value to a flag.
|The flag must be already set.
|1.3
|-id="set_state_name"
|set_state_name
|<code><string></code><br/>Defines the new name.
|<pre>set_state_name = "Funland"
</pre>
</pre>
 
|Changes the current state's name to the specified name.
|Destroys the specified type and amount of ships controlled by the current scope.
|&nbsp;
|&nbsp;
|1.5
|1.3
|-
|-id="reset_state_name"
|transfer_navy
|reset_state_name
|<code>target = <scope></code><br /> The target country.
|<code><bool></code><br/>Boolean.
|<pre>transfer_navy = {
|<pre>reset_state_name = yes</pre>
   target = GER
|Resets any changes to the current state's name.
}</pre>
|&nbsp;
 
|1.3
|Transfers the current scope navy to the specified country.
|-id="add_claim_by"
|add_claim_by
|<code><country> / <variable></code><br/>The country to add the claim for.
|<pre>add_claim_by = SOV</pre>
|Adds a claim for the specified country on the current scope.
|&nbsp;
|&nbsp;
|1.5
|1.0
|-
|-id="remove_claim_by"
|transfer_ship
|remove_claim_by
|<code>type = <ship></code><br /> The type of ship to transfer.<br <code>target = <scope><br /> The target country.</code>
|<code><country> / <variable></code><br/>The country to remove the claim for.
<code><code>prefer_name = <string></code><br /> The new name for the ships in the target country. Optional.
|<pre>remove_claim_by = SOV</pre>
 
|Removes a claim by the specified country on the current scope.
|<pre>transfer_ship = {
   prefer_name = "HMS Achilles"
   type = light_cruiser
   target = NZL
}
</pre>
 
|Transfers the specified type of ship from the current scope to the specified country.
|&nbsp;
|&nbsp;
|1.4
|-
|create_navy_leader
|<code>name = <string></code><br /> The name of the leader.
<code>picture = <string></code><br /> The graphical reference of the picture of the leader.<br /> <code>skill = <int></code><br /> The skill of the leader.<br /> <code>traits = { <trait> }</code><br /> The traits the leader spawns with.
|<pre>create_navy_leader = {
name = "François Darlan"
   picture = "Portrait_France_Francois_Darlan.dds"
traits = { superior_tactician }
skill = 3
}
</pre>
|Creates a naval leader for the current scope with the specified attributes.
|Traits are found in {{path|common/unit_leader/*.txt}}.
|1.0
|1.0
|}
|-id="add_core_of"
 
|add_core_of
===空军===
|<code><country> / <variable></code><br/>The country to add the core for.
 
|<pre>add_core_of = SOV</pre>
{| class="wikitable sortable" width="100%"
|Adds a core for the specified country on the current scope.
|-
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-
|air_experience
|<code><float> / <variable></code><br /> The amount to add.
|<pre>air_experience = 10</pre>
 
|Adds the specified amount of air experience to the current scope.
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|-id="remove_core_of"
|add_ace
|remove_core_of
|<code>name = <string></code><br /> The name of the ace.
|<code><country> / <variable></code><br/>The country to remove the core for.
<code>surname = <string></code><br /> The surname of the ace.<br /> <code>callsign = <string></code><br /> The callsign of the ace.<br /> <code>type = <type></code><br /> The ace type.<br /> <code>is_female = <bool></code><br /> The gender of the ace.
|<pre>remove_core_of = SOV</pre>
 
|Removes a core for the specified country on the current scope.
|<pre>add_ace = {
|&nbsp;
   name = "Amelia"
|1.0
   surname = "Earhart"
|-id="set_demilitarized_zone"
   callsign = "Revenant"
|set_demilitarized_zone
   type = fighter_genius
|<code><bool></code><br/>Boolean.
   is_female = yes
|<pre>set_demilitarized_zone = yes
}
</pre>
</pre>
 
|Makes the current scope a demilitarized zone.
|Adds an ace for the current scope.
|&nbsp;
|Ace types found in {{path|common/aces/*.txt}}.
|1.0
|1.0
|}
|-id="set_state_category"
 
|set_state_category
===AI===
|<code><category></code><br/>The category to change to.
 
|<pre>set_state_category = rural
{| class="wikitable sortable" width="100%"
</pre>
|-
|Changes the current state category to the specified category.
! width="10%" |Name
|Categories are found in {{path|common/state_category/*.txt}}
! width="25%" |Parameters
|1.3
! width="25%" |Examples
|-id="add_state_modifier"
! width="20%" |Description
|add_state_modifier
! width="15%" |Notes
|'''Modifier scope'''
! width="5%" |Version Added
<code><modifier> = <float></code><br/>Adds a modifier to the state.
|-
|<pre>add_state_modifier = {
|add_ai_strategy
    modifier = {
|<code>type = <type></code><br /> The type of strategy
     local_resources = 2.0
<code>id = <scope></code><br /> What country the strategy is against.<br /> <code>value = <int></code><br /> The weighting added by the strategy.
    }
 
|<pre>add_ai_strategy = {
    type = alliance
   id = GER
    value = 200
}
}
</pre>
</pre>
 
|Adds a [[Modifiers|modifier]] to the current state.
| 为当前范围设置 AI 策略.
|&nbsp;
| 有关更多详细信息,请参阅 [[AI_modding|AI Modding]]
|1.3
|-id="add_manpower"
|add_manpower
|<code><int> / <variable></code><br/>The amount to add.
|<pre>add_manpower = 10000</pre>
|Adds the specified amount of total population to the current state.
|Note that when using negative manpower it will, besides reducing the population, also add directly to the recruitable manpower of the state. Which will increase your manpower
|1.0
|1.0
|}
|-id="add_resource"
 
|add_resource
== 地区作用域==
|<code>type = <resource></code><br/>The resource to add.
 
<code>amount = <int> / <variable></code><br/>The amount to add.
The effects here must be used within a '''state''' scope.
|<pre>add_resource = {
 
   type = oil
===整体===
   amount = 100
 
}
{| class="wikitable sortable" width="100%"
</pre>
|-
|Adds the specified resource in the specified amount to the current state.
! width="10%" |Name
|[[#country_add_resource|Can also be used in country scope.]]
! width="25%" |Parameters
|1.0
! width="25%" |Examples
|-id="set_border_war"
! width="20%" |Description
|set_border_war
! width="15%" |Notes
|<code><bool></code><br/>Boolean.
! width="5%" |Version Added
|<pre>set_border_war = yes</pre>
|-
|Enables Border War status for the current state.
|state_event
|Used for the state-based border wars, represented with orange stripes, see {{Section link||Border wars}} for the border wars that simulate combat on a border between two countries. On the end of the border war, [[On actions#on_border_war_lost|the on_border_war_lost on action]] is fired for the state that where the border war was lost.
|<code>id = <event></code><br /> The event to fire
|1.0
<code>days = <event> / <variable></code><br /> Fires the event in the specified number of days. Optional.<br /> <code>hours = <event> / <variable></code><br /> Fires the event in the specified number of hours. Optional.<br /> <code>random = <event></code><br /> Adds a random number (between ''0'' and ''random'', inclusive) of '''hours''' to the scheduled fire time. Optional.<br /> <code>trigger_for = <scope></code><br /> Fires event in the specified scope.
|-id="create_unit"
|create_unit
|<code>division = <division string></code><br/>The division string.<br/>
<code>owner = <country></code><br/>The owner of the division.<br/>
<code>prioritize_location = <province></code><br/>If possible, this province within the state gets used. Optional.<br/>
<code>allow_spawning_on_enemy_provs = yes</code><br/>Allows the units to be created on provinces owned by the division owner's enemy. Defaults to false.<br/>
<code>count = <int></code><br/>The amount of units to create. Defaults to 1.<br/>
<code>id = <int></code><br/>The ID to identify the unit. Only used in [[#delete_unit|delete_unit]].<br/>
<code>country_score = { ... }</code><br/>A [[MTTH]] block deciding the province in the state where the division should spawn, evaluates in the scope of the controller. Defaults to prioritising owner's controlled provinces first and then owner's allies.<br/>
The following arguments go within <code>division = ""</code>:<br/>
:<code>name = \"<string>\"</code><br/>The name of the division.<br/>
:<code>division_template = \"<string>\"</code><br/>The template to be used by the division.<br/>
:<code>start_experience_factor = <double></code><br/>Experience of the division, with 0 being none and 1 being full training. Defaults to 1.<br/>
:<code>start_equipment_factor = <double></code><br/>Equipment stockpile of the division. Defaults to 1.<br/>
:<code>start_manpower_factor = <double></code><br/>Manpower stockpile of the division. Defaults to 1.<br/>
|<pre>create_unit = {
   division = "name = \"Infantry Division\" division_template = \"Infantry Division\" start_experience_factor = 0.5"
   owner = GER
}</pre>
<pre>create_unit = {
   division = "name = \"Artie\" division_template = \"Artillery Division\" start_manpower_factor = 0.3"
   owner = BHR
   count = 3
   allow_spawning_on_enemy_provs = yes
   country_score = {
     base = 3
     modifier = {
       factor = 2
       tag = OMA
     }
   }
   id = 123
}</pre>
|Adds the specified division to the current state.
|The division string '''must be on one line'''. A linebreak in the middle of <code>division = "..."</code> will break the effect and result in no units being spawned.
 
'''Can only be used within a state scope''', such as [[Scopes#capital_scope|capital_scope]]. The effect will do nothing when put into a country's scope. 


|<pre>state_event = {
'''Equipment factor cannot be set to zero.''' If set to zero, it will be treated as a 1. Created equipment will be the latest available to the country.
    id = my_event.1
|1.3
   days = 10
|-id="teleport_armies"
    random = 50
|teleport_armies
    trigger_for = controller
|<code>limit = { <triggers> }</code><br/>The condition that must be true for the owner of the armies for them to teleport.
<code>to_state_array = <array></code><br/>The state array the armies will get teleported to.<br/><code>to_province = <ID></code><br/>The province the armies will get teleported to.<br/><code>to_state = <ID></code><br/>The state the armies will get teleported to.<br/>
|<pre>teleport_armies = {
    limit = {
     has_war_together_with = ROOT
    }
    to_state_array = owned_controlled_states
}
}
</pre>
</pre>
|Teleports all armies in the specified state if the owner of the armies meets the condition.
|Only define one of to_state_array, to_state, or to_province. If none is specified, it defaults to the capital.
|1.9
|-id="add_province_modifier"
|add_province_modifier
|<code>static_modifiers = { <modifiers> }</code><br/>The list of modifiers.<br/><code>province = <id></code>The province to apply the modifiers to.<code>provinces = {}</code>Scope for selecting multiple provinces. The following arguments have to go inside it:<br/><code>id = <id></code>The ID of the province. Multiple can be specified.<br/><code>all_provinces = yes</code>Selects all provinces to which the limitations apply. The following arguments require it: <code>limit_to_coastal = yes</code> Limits the selection of provinces to only coastal ones.<br/><code>limit_to_border = yes</code> Limits the selection of provinces to only ones bordering a different country.<br/><code>limit_to_naval_base = yes</code> Limits the selection of provinces to only ones that have a naval base.<br/><code>limit_to_victory_point = yes</code> Limits the selection of provinces to only ones that have a victory point, or a city, in them.<br/>
|<pre>add_province_modifier = {
static_modifiers = { mod_modifier_1 mod_modifier_2 }
province = 1234
}</pre><pre>add_province_modifier = {
static_modifiers = { mod_modifier_1 mod_modifier_2 }
province = {
id = 1234
id = 4321
}
}</pre><pre>add_province_modifier = {
static_modifiers = { mod_modifier_1 mod_modifier_2 }
province = {
all_provinces = yes
limit_to_coastal = yes
limit_to_border = yes
limit_to_naval_base = yes
limit_to_victory_point = yes
}
}</pre>
|Adds a province modifier to the specified provinces in this state.
|Province modifiers are defined in {{path|common/modifiers/*.txt}}
|1.6
|-id="remove_province_modifier"
|remove_province_modifier
|<code>static_modifiers = { <modifiers> }</code><br/>The list of modifiers.<br/><code>province = <id></code>The province to apply the modifiers to.<code>provinces = {}</code>Scope for selecting multiple provinces. The following arguments have to go inside it:<br/><code>id = <id></code>The ID of the province. Multiple can be specified.<br/><code>all_provinces = yes</code>Selects all provinces to which the limitations apply. The following arguments require it: <code>limit_to_coastal = yes</code> Limits the selection of provinces to only coastal ones.<br/><code>limit_to_border = yes</code> Limits the selection of provinces to only ones bordering a different country.<br/><code>limit_to_naval_base = yes</code> Limits the selection of provinces to only ones that have a naval base.<br/><code>limit_to_victory_point = yes</code> Limits the selection of provinces to only ones that have a victory point, or a city, in them.<br/>
|<pre>remove_province_modifier = {
static_modifiers = { mod_modifier_1 mod_modifier_2 }
province = 1234
}</pre><pre>remove_province_modifier = {
static_modifiers = { mod_modifier_1 mod_modifier_2 }
province = {
id = 1234
id = 4321
}
}</pre><pre>remove_province_modifier = {
static_modifiers = { mod_modifier_1 mod_modifier_2 }
province = {
all_provinces = yes
limit_to_coastal = yes
limit_to_border = yes
limit_to_naval_base = yes
limit_to_victory_point = yes
}
}</pre>
|Removes a province modifier to the specified provinces in this state.
|Province modifiers are defined in {{path|common/modifiers/*.txt}}
|1.6
|-id="add_victory_points"
|add_victory_points
|Add victory points to a province
|<pre>add_victory_points = {
province = 1234
value = 10
}</pre>
|Adds victory points to a province.
|Accepts negative values
|1.10
|-id="set_victory_points"
|set_victory_points
|Set the victory points of a province
|<pre>set_victory_points = {
province = 1234
value = 10
}</pre>
|Sets the number of victory point in a province.
|Accepts negative values
|1.10
|-id="set_state_province_controller"
|set_state_province_controller
|<code>controller = <tag></code><br/>The new controller of the province.
<code>limit = { <triggers> }<br/>The triggers that must be fulfilled by the province's current controller to be transferred to the new controller.
|<pre>set_state_province_controller = {
   controller = POL
   limit = {
     OR = {
       tag = GER
       is_in_faction_with = GER
     }
   }
}</pre>
|Changes the controller of all provinces within that state controlled by countries that meet triggers to the specified country.
|&nbsp;
|1.9
|-id="transfer_state_to"
|transfer_state_to
|<code><country></code><br/>Country to transfer the state to.
|<pre>transfer_state_to = JAM</pre>
|Sets owner and controller of the state to the given country
|
|1.11
|-id="set_state_owner_to"
|set_state_owner_to
|<code><country></code><br/>Country to set the owner '''(but not the controller)''' of the state to.
|<pre>set_state_owner_to = JAM</pre>
|Sets the owner of the state to the given country
|Use [[#transfer_state_to|transfer_state_to]] unless the control specifically shouldn't be given.
|1.11
|-id="set_state_controller_to"
|set_state_controller_to
|<code><country></code><br/>Country to set the controller '''(but not the owner)''' of the state to.
|<pre>set_state_controller_to = ITA</pre>
|Sets the controller of the state to the given country
|
|1.11
|}


|Fires the specified event for the current state.
===Buildings===
|Where triggers do not need to be repeatedly checked <code>random</code> can be a performance light alternative to <code>mean_time_to_happen</code> for scheduling events.
 
Using days = <event> / <variable> or hours may still be bugged and will not fire the event.
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|1.0
|+ class="nowrap" | Building-related state-scoped effects:<br/>
|-
! width="10%" |Name
|set_state_flag
! width="25%" |Parameters
|<code><flag></code><br /> An unique string to identify the state flag with.
! width="25%" |Examples
|<code>set_state_flag = my_flag</code>
! width="20%" |Description
|Defines a state flag.
! width="15%" |Notes
|&nbsp;
! width="5%" |Version Added
|-id="add_extra_state_shared_building_slots"
|add_extra_state_shared_building_slots
|<code><int> / <variable></code><br/>The amount of slots to add or remove.
|<pre>add_extra_state_shared_building_slots = 2</pre>
|Changes the number of shared building slots for the current state.
|Shared buildings slots being the ones used for multiple building types, such as military or civilian factories. This is in contrast to non-shared slots, such as those used by radio stations or air bases, which only can be changed globally with technologies.
|1.0
|1.0
|-
|-id="add_building_construction"
|clr_state_flag
|add_building_construction
|<code><flag></code><br /> The unique string of a state flag to clear.
|<code>type = <string></code><br/>The building to add.
|<code>clr_state_flag = my_flag</code>
<code>level = <int> / <variable></code><br/>The level to set the building to.<br/><code>instant_build = <bool></code><br/>Defines whether the buildings are instantly built.<br/><code>province = <id></code><br/>Defines the exact province to add provincal buildings in. Can be used as a scope.<br/>'''Province scope'''<br/>
|Clears a defined state flag.
<code>all_provinces = <bool></code><br/>Affect all provinces within the state that meet each limit. Used in the province scope.<br/>
|&nbsp;
<code>id = <id></code><br/>Affect the specified province ID. Used in the province scope, will apply for each province if inserted multiple times.
|1.0
<code>limit_to_coastal = <bool></code><br/>Affect only coastal provinces within the selection. Used in the province scope.<br/>
|-
<code>limit_to_naval_base = <bool></code><br/>Affect only provinces that have naval bases built. Used in the province scope.<br/>
|modify_state_flag
<code>limit_to_border = <bool></code><br/>Affect only provinces that lie on a border between countries. Used in the province scope.<br/>
|<code>flag = <flag></code><br /> The state flag to modify
<code>limit_to_border_country = <country></code><br/>Affect only provinces that border a specific other country. Used in the province scope.<br/>
<code>value = <value></code><br /> The value to set it to: 0 or 1
<code>limit_to_victory_point = <int>/<bool></code><br/>Affect only provinces that meet the victory point amount prerequisite. If <code>yes</code> is used in place of a number, any amount of victory points works. Used in the province scope.<br/>
 
<code>limit_to_supply_node = <bool></code><br/>Affect only provinces that have a supply node. Used in the province scope.<br/>
|<pre>modify_state_flag = {
<code>level = <int></code><br/>Affect only provinces with buildings level below, at or above the specified level. Used in the province scope.<br/>
    flag = my_flag
|<pre>add_building_construction = {
    value = 1
    type = arms_factory
   level = 5
    instant_build = yes
}
}
</pre>
</pre>
 
<pre>add_building_construction = {
|Modifies a state flag.
   type = bunker
|Use [[Variables|variables]] instead.
   level = 10
|1.3
   instant_build = yes
|-
   province = {
|set_state_name
     all_provinces = yes
|<code><string></code><br /> Defines the new name.
     limit_to_border = yes
|<pre>set_state_name = "Funland"
     limit_to_victory_point > 1
   }
}
</pre>
<pre>add_building_construction = {
   type = bunker
   level = 1
   instant_build = yes
   province = 2999
}
</pre>
</pre>
|Starts construction in the current state for the specified building.
|For provincial buildings, '''must be done within the scope of the state that contains the province''' even if done on a specific province. '''If the controller country doesn't have an [[Country creation#Order of battle|order of battle assigned within the history file]], the buildings will not show up within the production menu''' until a recalculation of buildings, such as by changing consumer goods or reloading a savefile.


|Changes the current state's name to the specified name.
'''Can only be used within a state scope''', such as [[Scopes#random_owned_controlled_state|random_owned_controlled_state]]. The effect will do nothing when put into a country's scope
|&nbsp;
|1.3
|-


|reset_state_name
For the list of building IDs present in the base game, see [[Building modding#Types]].
|<code><bool></code><br /> Boolean.
|1.0
|<pre>reset_state_name = yes
|-id="set_building_level"
|set_building_level
|<code>type = <string></code><br/>The building to add.
<code>level = <int> / <variable></code><br/>The level to set the building to.<br/><code>instant_build = <bool></code><br/>Defines whether the buildings are instantly built.<br/><code>province = <id></code><br/>Defines the exact province to add provincal buildings in. Can be used as a scope.<br/>'''Province scope'''<br/>
<code>all_provinces = <bool></code><br/>Affect all provinces within the state that meet each limit. Used in the province scope.<br/>
<code>id = <id></code><br/>Affect the specified province ID. Used in the province scope, will apply for each province if inserted multiple times.
<code>limit_to_coastal = <bool></code><br/>Affect only coastal provinces within the selection. Used in the province scope.<br/>
<code>limit_to_naval_base = <bool></code><br/>Affect only provinces that have naval bases built. Used in the province scope.<br/>
<code>limit_to_border = <bool></code><br/>Affect only provinces that lie on a border between countries. Used in the province scope.<br/>
<code>limit_to_border_country = <country></code><br/>Affect only provinces that border a specific other country. Used in the province scope.<br/>
<code>limit_to_victory_point = <int>/<bool></code><br/>Affect only provinces that meet the victory point amount prerequisite. If <code>yes</code> is used in place of a number, any amount of victory points works. Used in the province scope.<br/>
<code>limit_to_supply_node = <bool></code><br/>Affect only provinces that have a supply node. Used in the province scope.<br/>
<code>level = <int></code><br/>Affect only provinces with buildings level below, at or above the specified level. Used in the province scope.<br/>
|<pre>set_building_level = {
   type = infrastructure
   level = 10
   instant_build = yes
}
</pre>
</pre>
 
<pre>set_building_level = {
|Resets any changes to the current state's name.
   type = bunker
|&nbsp;
   level = 3
   province = {
     all_provinces = yes
     limit_to_border = yes
     level < 3
   }
}
</pre>
|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 : <code>limit_to_victory_point > 5</code> (only build province buildings on province with VP over 5 ) <code>limit_to_victory_point = yes</code> (only build province buildings on province with VP) For provincial buildings, '''must be done within the scope of the state that contains the province''' even if done on a specific province.
|1.4
|-id="damage_building"
|damage_building
|<code>type = <building></code><br/>The building to damage.
<code>damage = <float></code><br/>The amount of damage to inflict.<br/><code>province = <id></code><br/>The province to target for provincal buildings.
|<pre>damage_building = {
   type = infrastructure
   damage = 1
}
</pre>
|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
|1.3
|-
|-id="remove_building"
|add_claim_by
|remove_building
|<code><scope> / <variable></code><br /> The country to add the claim for.
|<code>type = <building></code><br/>The building to remove.
|<pre>add_claim_by = SOV</pre>
<code>level = <int> / <variable></code><br/>The levels to remove.
 
|<pre>remove_building = {
|Adds a claim for the specified country on the current scope.
   type = arms_factory
   level = 5
}
</pre>
|Removes the specified building in the current state. For shared buildings level determines the amount, whereas for the others it is the actual level.
|&nbsp;
|&nbsp;
|1.0
|1.0
|-
|}
|remove_claim_by
|<code><scope> / <variable></code><br /> The country to remove the claim for.
|<pre>remove_claim_by = SOV</pre>


|Removes a claim by the specified country on the current scope.
===Resistance and compliance===
{{anchor|Resistance}}
{{anchor|Compliance}}
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ class="nowrap" | Resistance-related state-scoped effects:<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="add_compliance"
|add_compliance
|<code><int> / <variable></code><br/>The amount to add.
|<pre>add_compliance = 30</pre>
|Adds compliance to the specified state.
|&nbsp;
|&nbsp;
|1.0
|1.9
|-
|-id="add_resistance"
|add_core_of
|add_resistance
|<code><scope> / <variable></code><br /> The country to add the core for.
|<code><int> / <variable></code><br/>The amount to add.
|<pre>add_core_of = SOV</pre>
|<pre>add_resistance = 30</pre>
 
|Adds resistance to the specified state.
|Adds a core for the specified country on the current scope.
|&nbsp;
|&nbsp;
|1.0
|1.9
|-
|-id="add_resistance_target"
|remove_core_of
|add_resistance_target
|<code><scope> / <variable></code><br /> The country to remove the core for.
|<code><int> / <variable></code><br/>The amount to add.
|<pre>remove_core_of = SOV</pre>
|<pre>add_resistance_target = 30</pre>
 
|Increases resistance target in the specified state.
|Removes a core for the specified country on the current scope.
|&nbsp;
|&nbsp;
|1.0
|1.9
|-
|-id="add_resistance_target"
|set_demilitarized_zone
|add_resistance_target
|<code><bool></code><br /> Boolean.
|<code>id = <int></code><br/>The ID of the target increase.<br/><code>amount = <int>/<variable></code><br>The amount to increase the resistance target by.<br><code>occupied = <country></code><br>Will only apply the increase if the the occupied country is the specified scope.<br><code>occupier = <country></code><br>Will only apply the increase if the the occupier is the specified scope.<br><code>days = <int>/<variable></code><br>If set, the resistance target will only be increased for the specified amount of days.<br><code>tooltip = <string></code><br>The tooltip to show in the resistance target tooltip.
|<pre>set_demilitarized_zone = yes
|<pre>add_resistance_target = {
   id = 123
   amount = 30
   occupied = ENG
   occupier = GER
   days = 365
   tooltip = my_localisation_key
}
</pre>
</pre>
 
|Increases resistance target in the specified state.
|Makes the current scope a demilitarized zone.
|&nbsp;
|1.9
|-id="cancel_resistance"
|cancel_resistance
|<code><bool></code><br/>Boolean.
|<pre>cancel_resistance = yes</pre>
|Cancels resistance activity for the current state.
|&nbsp;
|1.9
|-id="force_disable_resistance"
|force_disable_resistance
|<code><country></code><br/>The target country.
|<pre>force_disable_resistance = GER</pre>
|Disables resistance for the scoped state when the occupier is the specified country.
|&nbsp;
|&nbsp;
|1.0
|1.9
|-
|-id="force_disable_resistance"
|set_state_category
|force_disable_resistance
|<code><category></code><br /> The category to change to.
|<code>clear = <bool></code><br/>If set to yes, will clear resistance.<br/><code>occupier = <country></code><br/>Resistance will be disabled if the occupier is the specified scope.<br/><code>occupied = <country></code><br/>Resistance will be disabled if the occupied country is the specified scope.
|<pre>set_state_category = rural
|<pre>force_disable_resistance = {
</pre>
    clear = yes
 
   occupier = GER
|Changes the current state category to the specified category.
    occupied = ENG
|Categories are found in {{path|common/state_category/*.txt}}
|1.3
|-
|add_state_modifier
|'''Modifier scope'''
<code><modifier> = <float></code><br /> Adds a modifier to the state.
 
|<pre>add_state_modifier = {
    modifier = {
     local_resources = 2.0
    }
}
}
</pre>
</pre>
 
|Disables resistance for the scoped state when the occupier is the specified country.
|Adds a [[Modifiers|modifier]] to the current state.
|&nbsp;
|&nbsp;
|1.3
|1.9
|-
|-id="force_enable_resistance"
|add_manpower
|force_enable_resistance
|<code><int> / <variable></code><br /> The amount to add.
|<code><country></code><br/>The target country.
|<pre>add_manpower = 10000</pre>
|<pre>force_enable_resistance = GER</pre>
 
|Enables resistance for the scoped state when the occupier is the specified country.
|Adds the specified amount of manpower to the current state.
|Does not start resistance by itself, only removes the checks forcefully disabling it. Use with [[#start_resistance|start_resistance]] in order to immediately start resistance.
|1.9
|-id="detailed_force_enable_resistance"
|force_enable_resistance
|<code>clear = <bool></code><br/>If set to yes, will clear resistance.<br/><code>occupier = <country></code><br/>Resistance will be enabled if the occupier is the specified scope.<br/><code>occupied = <country></code><br/>Resistance will be enabled if the occupied country is the specified scope.
|<pre>force_enable_resistance = {
   clear = yes
   occupier = GER
   occupied = ENG
}
</pre>
|Enables resistance for the scoped state when the occupier is the specified country.
|Does not start resistance by itself, only removes the checks forcefully disabling it. Use with [[#start_resistance|start_resistance]] in order to immediately start resistance.
|1.9
|-id="remove_resistance_target"
|remove_resistance_target
|<code><int> / <variable></code><br/>The id of the resistance target to remove. (Must be set with add_resistance_target)
|<pre>remove_resistance_target = 30</pre>
|Removes a set resistance target increase in the specified state.
|Has no tooltip.
|1.9
|-id="set_compliance"
|set_compliance
|<code><int> / <variable></code><br/>The amount to set the compliance to.
|<pre>set_compliance = 30</pre>
|Sets compliance in the specified state.
|&nbsp;
|&nbsp;
|1.0
|1.9
|-
|-id="set_resistance"
|add_resource
|set_resistance
|<code>type = <resource></code><br /> The resource to add
|<code><int> / <variable></code><br/>The amount to set the resistance to.
<code>amount = <int> / <variable></code><br /> The amount to add.
|<pre>set_resistance = 30</pre>
|Sets resistance in the specified state.
|The resistance should be enabled in the state, either via [[#start_resistance|start_resistance]] or through the in-game process. Occassionally it may take a tick for resistance to start after the controllership change, so it's preferable to do so on states that are given to the country immediately before this gets executed, such as if this is executed in country history.
|1.9
|-id="start_resistance"
|start_resistance
|<code><bool>/<country></code><br/>Whether to start resistance or not. If using a country as the parameter, the state will only start resistance if occupied by the target country.
|<pre>start_resistance = POL</pre>
<pre>start_resistance = yes</pre>
|Starts resistance in the specified state.
|If used on a state that normally can't start resistance, use alongside with [[#force_enable_resistance|force_enable_resistance]].
|1.9
|-id="set_garrison_strength"
|set_garrison_strength
|<code><0-1></code><br/>The new garrison strength.
|<pre>set_garrison_strength = 0.5</pre>
|Sets the strength of the garrison in the specified state.
|
|1.9
|-id="set_occupation_law"
|set_occupation_law
|<code><law ID></code><br/>The new occupation law enacted by the previous scope or <code>default_law</code>.
|<pre>GER = { every_controlled_state = { set_occupation_law = military_governor_occupation } } # Changes GER's occupation law for every controlled state.</pre>
|Sets the occupation law of the state.
|[[Scopes#PREV usage|PREV]] will be the country for whom the occupation law will be changed. If PREV is not a country, nothing changes. If PREV doesn't occupy the state, nothing happens until it does. If using <code>default_law</code>, resets to the law set by the country's occupation.
|1.12
|}


|<pre>add_resource = {
==Character scope==
   type = oil
   amount = 100
}
</pre>


|Adds the specified resource in the specified amount to the current state.
The effects here must be used within a '''character''' scope.
|&nbsp;
===General===
|1.0
|-
|set_border_war
|<code><bool></code><br /> Boolean.
|<pre>set_border_war = yes</pre>


|Enables Border War status for the current state.
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|&nbsp;
|+ class="nowrap" | General character-scoped effects:<br/>
|1.0
|-
|create_unit
|<code>division = <division string></code><br /> The division string.
<code>owner = <scope></code><br /> The owner of the division.<br /> <code>prioritize_location = <province></code><br /> Prioritize the specified province in the state.
 
|<pre>create_unit = {
   division = "name = \"Infantry Division\" division_template = \"Infantry Division\" start_experience_factor = 0.5 start_equipment_factor = 0.5"
   owner = GER
}
</pre>
 
|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
|<code>modifier = <modifier_string></code><br /> The name of the Modifier.
 
|add_dynamic_modifier = { modifier = sabotaged_ressources }
 
|Adds a dynamic modifier to the current scope
|Examples can be found in {{path|common/dynamic_modifiers/*.txt}}
|1.9
|}
 
===建筑===
 
{| class="wikitable sortable" width="100%"
|-
! width="10%" |Name
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Parameters
第2,778行: 第4,290行:
! width="15%" |Notes
! width="15%" |Notes
! width="5%" |Version Added
! width="5%" |Version Added
|-
|-id="set_character_flag"
|add_building_construction
|set_character_flag
|<code>type = <string></code><br /> The building to add
|<code><flag></code><br/>An unique string to identify the character flag with.<br/>
<code>level = <int> / <variable></code><br /> The level to set the building to.<br /> <code>instant_build = <bool></code><br /> Defines whether the buildings are instantly built.<br /> <code>province = <id></code><br /> Defines the exact province to add provincal buildings in. Can be used as a scope.<br /> '''Province scope'''<br /> <code>all_provinces = <bool></code><br /> Affect all provinces. Used in the province scope.<br /> <code>limit_to_coastal = <bool></code><br /> Affect coastal provinces. Used in the province scope.<br /> <code>limit_to_naval_base = <bool></code><br /> Affect naval base provinces. Used in the province scope.<br /> <code>limit_to_border = <bool></code><br /> Affect border provinces. Used in the province scope.<br /> <code>level = <int></code><br /> Affect only provinces with buildings level below, at or above the specified level. Used in the province scope.<br /> <code>id = <id></code><br /> Affect the specified province. Used in the province scope.
'''OR'''<br/>
 
<code>flag = <flag></code><br/>The flag to set.<br/>
|<pre>add_building_construction = {
<code>days = <int></code><br/>Sets the flag to last for the specified amount of days. Optional.<br/>
   type = arms_factory
<code>value = <int></code><br/>The new value of the flag on the scale from -2 147 483 648 to 2 147 483 647.
   level = 5
|<pre>set_character_flag = my_flag</pre>
   instant_build = yes
<pre>set_character_flag = {
}
   flag = my_flag
</pre>
   days = 123
<pre>add_building_construction = {
   value = 1
    type = bunker
}</pre>
   level = 10
|Defines a character flag.
    instant_build = yes
|No tooltip is shown. [[Data structures#Flags|The flag in this effect is used in the meaning of 'boolean flag', used to store information.]]
   province = {
|1.11
     all_provinces = yes
|-id="c_set_character_name"
      limit_to_border = yes
|set_character_name
|<code><localisation key></code><br/>The name to use.
|<pre>set_character_name = GER_my_cool_flag</pre>
|Changes the character's name to the specified localisation key's value.
|
|1.11
|-id="modify_character_flag"
|modify_character_flag
|<code>flag = <flag></code><br>The flag to modify.<br>
<code>value = <value></code><br>The value to add to the flag. Defaults to 0.<br>
<code>days = <int></code><br/>The amount of days that the flag should last for before being cleared. Optional, defaults to permanent.<br/>
|<pre>
modify_character_flag = {
   flag = my_flag
   value = 3
}</pre>
|Adds an integer value to a flag.
|The flag must be already set.
|1.11
|-id="clr_character_flag"
|clr_character_flag
|
|<pre>clr_character_flag = <bool></pre>
|Clears a character flag
|
|1.11
|-id="retire"
|retire
|<code><bool></code><br/>Boolean>
|<pre>retire = yes</pre>
|Retires the current character (removing them).
|&nbsp;
|1.5
|-id="set_nationality"
|set_nationality
|<code><country> / <variable></code><br/>The target country.
|<pre>set_nationality = GER</pre>
|Switches the current character to the specified country, giving them the character.
|If you wish to change the nationality of a specific character, and the country getting the effect doesn't have the character recruited already, use the
<pre>every_possible_country = {
    limit = { has_character = ID }
    random_character = {
     limit = { is_character = ID }
      set_nationality = TAG
    }
    }
}
}</pre>
</pre>
command to call them up. Only necessary in 1.11 and beyond.
<pre>add_building_construction = {
|1.5
   type = bunker
<!--
   level = 1
|-id="set_leader_description"
   instant_build = yes
|set_leader_description
   province = 2999
|
}
<code><localisation key></code> New leader description
</pre>
|<pre>set_leader_description = LOC_KEY</pre>
|Changes the description of the current character.
|Must be used with a localisation key, putting it in quotes won't work. See [[Localisation]] for more info.
|1.9.1
|-id="set_leader_name"
|set_leader_name
|<code><localisation key></code> New leader name
|<pre>set_leader_name = LOC_KEY</pre>
|Changes the name of the current character.
|
|1.9.1
|-id="set_leader_portrait"
|set_leader_portrait (obsolete)
|<code><sprite name></code> New leader portrait
|<pre>set_leader_portrait = GFX_IMAGE_NAME</pre>
|Changes the portrait of the current character.
|The portrait must be defined in {{path|interface/*.gfx}}


|Starts construction in the current state for the specified building.
|You can limit the construction to victory points using : <code>limit_to_victory_point > 5<code> (only build province buildings on province with VP over 5 ) <code>limit_to_victory_point = yes<code> (only build province buildings on province with VP)
|1.0
|-
|set_building_level
|<code>type = <string></code><br /> The building to add.
<code>level = <int> / <variable></code><br /> The level to set the building to.<br /> <code>instant_build = <bool></code><br /> Defines whether the buildings are instantly built.<br /> <code>province = <id></code><br /> Defines the exact province to add provincal buildings in. Can be used as a scope.<br /> '''Province scope'''<br /> <code>all_provinces = <bool></code><br /> Affect all provinces. Used in the province scope.<br /> <code>limit_to_coastal = <bool></code><br /> Affect coastal provinces. Used in the province scope.<br /> <code>limit_to_naval_base = <bool></code><br /> Affect naval base provinces. Used in the province scope.<br /> <code>limit_to_border = <bool></code><br /> Affect border provinces. Used in the province scope.<br /> <code>level = <int></code><br /> Affect only provinces with buildings level below, at or above the specified level. Used in the province scope.<br /> <code>id = <id></code><br /> Affect the specified province. Used in the province scope.


|<pre>set_building_level = {
OBSOLETE. Use set_portraits instead
    type = infrastructure
|1.9.1
    level = 10
!-->
    instant_build = yes
|-id="set_portraits"
}
|set_portraits
</pre>
|<code>character = <character></code><br/>The character name. Optional if in character scope.<br/>
<pre>set_building_level = {
'''Army scope''': <code>small = <sprite></code><br/>The sprite used as an advisor. <code>large = <sprite></code><br/>The sprite used as a general.<br/>
    type = bunker
'''Character scope''':<code>large = <sprite></code><br/>The sprite used as a country leader.<br/>
    level = 3
|<pre>set_portraits = {
    province = {
    character = my_character
      all_provinces = yes
   army = { small ="MySmallCharacterGFX" }
      limit_to_border = yes
   civilian = { large ="MyLargeCharacterGFX" }
      level < 3
}</pre>
|Changes the specified portraits of a character.
|Sprites are defined within {{path|interface/*.gfx}} files.
|1.11
|-id="c_add_trait"
|add_trait
|<code>slot = <slot></code> Slot of the character. Necessary for advisors.<br/>
<code>ideology = <sub-ideology></code> Ideology type of the character. Necessary for country leaders.<br/>
<code>trait = <trait></code><br/>The trait to add.
|<pre>add_trait = {
    slot = political_advisor
    trait = really_good_boss
}</pre>
<pre>add_trait = {
   ideology = liberalism
   trait = field_of_gar
}</pre>
|Adds the specified country leader trait to the character.
|Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon. The character slot can be the character's name or id. Using name is recommended because 1.11 made id obsolete.
|1.11
|-id="c_remove_trait"
|remove_trait
|<code>slot = <slot></code> Slot of the character. Necessary for advisors.<br/>
<code>ideology = <sub-ideology></code> Ideology type of the character. Necessary for country leaders.<br/>
<code>trait = <trait></code><br/>The trait to remove.
|<pre>remove_trait = {
    slot = political_advisor
   trait = really_good_boss
}</pre>
<pre>remove_trait = {
   ideology = liberalism
   trait = field_of_gar
}</pre>
|Removes the specified trait from the character.
|Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon. The character slot can be the character's name or id. Using name is recommended because 1.11 made id obsolete.
|1.11
|-id="c_add_corps_commander_role"
|add_corps_commander_role
|<code><...></code><br/>[[Character modding#Unit leaders|Army leader role definition]]<br/>
|<pre>add_corps_commander_role = {
    skill = 4
   attack_skill = 2
   defense_skill = 3
   planning_skill = 3
    logistics_skill = 5
}</pre>
|Sets the specified character to also act as a corps commander.
|
|1.11
|-id="c_add_field_marshal_role"
|add_field_marshal_role
|<code><...></code><br/>[[Character modding#Unit leaders|Army leader role definition]]<br/>
|<pre>add_field_marshal_role = {
  skill = 4
  attack_skill = 2
  defense_skill = 3
  planning_skill = 3
  logistics_skill = 5
}</pre>
|Sets the specified character to also act as a field marshal.
|
|1.11
|-id="c_add_naval_commander_role"
|add_naval_commander_role
|<code><...></code><br/>[[Character modding#Unit leaders|Navy leader role definition]]<br/>
|<pre>add_naval_commander_role = {
  skill = 4
  attack_skill = 2
  defense_skill = 3
  planning_skill = 3
  logistics_skill = 5
}</pre>
|Sets the specified character to also act as an admiral.
|
|1.11
|-id="c_add_country_leader_role"
|add_country_leader_role
|<code>character = <character></code><br/>The character to modify.<br/>
<code>country_leader = { ... }</code><br/>[[Character modding#Country leaders|Country leader role definition]]<br/>
<code>promote_leader = <bool></code><br/>Will promote the leader to be the leader of the assigned party. Optional, defaults to false.
|<pre>add_country_leader_role = {
   character = GER_character_token
   promote_leader = yes
   country_leader = {
     ideology = fascism_type
     expire = "1965.1.1.1"
      traits = { war_industrialist }
   }
}</pre>
|Sets the specified character to also act as a country leader, promoting to the party leader if specified.
|Does nothing if the character already has a country leader role in the ideology group.
|1.11
|-id="c_promote_character"
|promote_character
|<code><bool></code><br/>Boolean.<br/>
'''OR'''<br/>
<code><ideology type></code><br/>The ideology type used by the country leader role.
|<pre>promote_character = yes</pre>
<pre>promote_character = liberalism</pre>
|Promotes a character to the leader of their political party.
|If the character has multiple country leader roles, specifying the ideology type is mandatory. Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon.
|1.11
|-id="c_remove_country_leader_role"
|remove_country_leader_role
|<code>ideology = <string></code><br/>The ideology type of the character.
|<pre>remove_country_leader_role = {
   ideology = socialism
}</pre>
|Removes a country leader role from a character.
|Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon.
|1.11
|-id="c_add_advisor_role"
|add_advisor_role
|<code>advisor = { ... }</code><br/>[[Character modding#Advisors|Advisor role definition]]<br/>
<code>activate = <bool></code><br/>Will activate the advisor (add them directly when the command is run to the countries government). Optional, defaults to false.
|<pre>add_advisor_role = {
   activate = yes
   advisor = {
     slot = air_chief
     cost = 50
      idea_token = GER_character_token_air_chief
     traits = {
       air_chief_ground_support_2
      }
    }
    }
}
}</pre>
</pre>
|Sets the specified character to also act as an advisor, activating if specified.
|Trigger and effect blocks (such as <code>allowed</code> and <code>on_add</code>) cannot be added within advisor definitions created this way.
|1.11
|-id="c_remove_advisor_role"
|remove_advisor_role
|<code>slot = <int></code><br/>The slot where to remove the advisor slot from.
|<pre>remove_advisor_role = {
  slot = political_advisor
}</pre>
|Removes the specified advisor role from the character.
|
|1.11
|-id="c_set_can_be_fired_in_advisor_role"
|set_can_be_fired_in_advisor_role
|<code>slot = <slot></code><br/>The slot of the character to modify.<br/>
<code>value = <bool></code><br/>The value to set.
|<pre>set_can_be_fired_in_advisor_role = {
   slot = political_advisor
   value = no
}</pre>
|Changes the <code>can_be_fired</code> attribute of the advisor, preventing the player from dismissing the advisor.
|
|1.12.8
|}


|Sets the specified building to the current state (or provinces within the state).
===Unit leaders===
|The province scope is used for provincal level buildings.  You can limit the construction to victory points using : <code>limit_to_victory_point > 5<code> (only build province buildings on province with VP over 5 ) <code>limit_to_victory_point = yes<code> (only build province buildings on province with VP)
These can only be used with characters of the unit leader type.
|1.4
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|-
|+ class="nowrap" | General unit leader-scoped effects:<br/>
|damage_building
! width="10%" |Name
|<code>type = <building></code><br /> The building to damage
! width="25%" |Parameters
<code>damage = <float></code><br /> The amount of damage to inflict.<br /> <code>province = <id></code><br /> The province to target for provincal buildings.
! width="25%" |Examples
 
! width="20%" |Description
|<pre>damage_building = {
! width="15%" |Notes
    type = infrastructure
! width="5%" |Version Added
    damage = 1
|-id="unit_leader_event"
|unit_leader_event
|<code>id = <event></code><br/>The event to fire.
<code>days = <int> / <variable></code><br/>Fires the event in the specified number of days. Optional.<br/><code>hours = <int> / <variable></code><br/>Fires the event in the specified number of hours. Optional.<br/><code>random = <int> / <variable></code><br/>Adds a random number (between ''0'' and ''random'', inclusive) of '''hours''' to the scheduled fire time. Optional.<br/><code>random_days = <int> / <variable></code><br/>Adds a random number (between ''0'' and ''random_days'', inclusive) of days to the scheduled fire time. Optional.
|<pre>unit_leader_event = {
    id = my_event.1
   days = 10
   random = 50
    random_days = 10
}
}
</pre>
</pre>
 
|Fires the specified event for the owner of the current unit leader.
|Damages the specified building in the current state.
|Uses a special interface displaying the current unit leader portrait.
|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.
Where triggers do not need to be repeatedly checked <code>random</code> can be a performance light alternative to <code>mean_time_to_happen</code> for scheduling events.
|1.3
|1.5
|-
|-id="set_unit_leader_flag"
|remove_building
|set_unit_leader_flag
|<code>type = <building></code><br /> The building to remove
|<code><flag></code><br/>An unique string to identify the unit leader flag with.
<code>level = <int> / <variable></code><br /> The levels to remove.
|<pre>set_unit_leader_flag = my_flag</pre>
 
|Defines a unit leader flag.
|<pre>remove_building = {
|Deprecated. Use [[#set_character_flag|set_character_flag]] instead. No tooltip is shown.
    type = arms_factory
|1.5
    level = 5
|-id="clr_unit_leader_flag"
}
|clr_unit_leader_flag
</pre>
|<code><flag></code><br/>The unique string of a unit leader flag to clear.
 
|<pre>clr_unit_leader_flag = my_flag</pre>
|Removes the specified building in the current state. For shared buildings level determines the amount, whereas for the others it is the actual level.
|Clears a defined unit leader flag.
|Deprecated. Use [[#clr_character_flag|clr_character_flag]] instead. No tooltip is shown.
|1.5
|-id="modify_unit_leader_flag"
|modify_unit_leader_flag
|<code>flag = <flag></code><br>The flag to modify.<br>
<code>value = <value></code><br>The value to add to the flag. Defaults to 0.<br>
<code>days = <int></code><br/>The amount of days that the flag should last for before being cleared. Optional, defaults to permanent.<br/>
|<pre>
modify_unit_leader_flag = {
    flag = my_flag
    value = 3
}</pre>
|Adds an integer value to a flag.
|The flag must be already set. Deprecated. Use [[#modify_character_flag|modify_character_flag]] instead.
|1.5
|-id="promote_leader"
|promote_leader
|<code><bool></code><br/>Boolean
|<pre>promote_leader = yes</pre>
|Promotes the current unit leader to Field Marshal (if Commander).
|&nbsp;
|&nbsp;
|1.0
|1.5
|-
|-id="demote_leader"
|add_extra_state_shared_building_slots
|demote_leader
|<code><int> / <variable></code><br /> The amount of slots to add or remove.
|<code><bool></code><br/>Boolean
|<pre>add_extra_state_shared_building_slots = 2</pre>
|<pre>demote_leader = yes</pre>
 
|Demotes the current unit leader to Commander (if Field Marshal).
|Adjusts the number of shared building slots for the current state.
|&nbsp;
|&nbsp;
|1.5
|-id="add_unit_leader_trait"
|add_unit_leader_trait
|<code><trait></code><br/>The trait to add.
|<pre>add_unit_leader_trait = old_guard</pre>
|Adds the specified trait to the current unit leader.
|Traits are found in {{path|common/unit_leader/*.txt}} files.
|1.0
|1.0
|}
|-id="remove_unit_leader_trait"
 
|remove_unit_leader_trait
== 部队将领作用域==
|<code><trait></code><br/>The trait to remove.
 
|<pre>remove_unit_leader_trait = old_guard</pre>
The effects here must be used within a '''unit leader''' scope.
|Removes the specified trait from the current unit leader.
|Traits are found in {{path|common/unit_leader/*.txt}} files.
|1.0
|-id="add_random_trait"
|add_random_trait
|<code><trait></code><br/>The trait to add.
|<pre>add_random_trait = { old_guard brilliant_strategist inflexible_strategist }</pre>
|Adds a random trait from the list to the character.
|Traits are found in {{path|common/unit_leader/*.txt}} files.
|1.5
|-id="add_timed_unit_leader_trait"
|add_timed_unit_leader_trait
|<code><trait></code><br/>The trait to add.
<code>days = <int></code><br/>The duration of the trait.
|<pre>add_timed_unit_leader_trait = {
   trait = wounded
   days = 90
}
</pre>
|Adds the specified trait to the current unit leader for the specified duration.
|Traits are found in {{path|common/unit_leader/*.txt}} files.
|1.5
|-id="replace_unit_leader_trait"
|replace_unit_leader_trait
|&nbsp;
|&nbsp;
|&nbsp;
|Traits are found in {{path|common/unit_leader/*.txt}} files.
|1.5
|-id="remove_exile_tag"
|remove_exile_tag
|Remove the exile tag on an army leader, making them no longer be considered exile leaders.
|<pre>remove_exile_tag = yes</pre>
|Removes a leaders exile tag.
|&nbsp;
|1.6
|-id="gain_xp"
|gain_xp
|<code><int></code>
|<pre>gain_xp = 5</pre>
|Adds experience to the current unit leader, promoting to the next skill level if applicable.
|Cannot be used with negatives.
|1.9
|-id="remove_unit_leader"
|remove_unit_leader
|<code><bool></code>
|<pre>remove_unit_leader = yes</pre>
|Removes the current unit leader.
|
|1.0
|-id="remove_unit_leader_role"
|remove_unit_leader_role
|<code><bool></code><br/>Boolean.
|<pre>remove_unit_leader_role = yes</pre>
|Removes every unit leader role from the character
|
|1.11
|}


=== 整体===
===Country leaders===
 
These can only be used with characters of the country leader type.
{| class="wikitable sortable" width="100%"
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|-
|+ class="nowrap" | Country leader-scoped effects:<br/>
! width="10%" |Name
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Parameters
第2,887行: 第4,688行:
! width="15%" |Notes
! width="15%" |Notes
! width="5%" |Version Added
! width="5%" |Version Added
|-
|-id="add_country_leader_trait"
|unit_leader_event
|add_country_leader_trait
|<code>id = <event></code><br /> The event to fire
|<code><trait></code><br/>The trait to add.<br/>
<code>days = <event> / <variable></code><br /> Fires the event in the specified number of days. Optional.<br /> <code>hours = <event> / <variable></code><br /> Fires the event in the specified number of hours. Optional.<br /> <code>random = <event></code><br /> Adds a random number (between ''0'' and ''random'', inclusive) of '''hours''' to the scheduled fire time. Optional.
'''OR''':<br/>
 
<code>ideology = <sub-ideology></code><br/>The sub-ideology of the country leader role to which the trait is added.<br/>
|<pre>unit_leader_event = {
<code>trait = <trait></code><br/>The trait to add.
   id = my_event.1
|<pre>add_country_leader_trait = nationalist_symbol</pre>
    days = 10
<pre>add_country_leader_trait = {
    random = 50
   ideology = marxism
}
   trait = anti_communist
</pre>
}</pre>
 
|Adds the specified trait to the current character.
|Fires the specified event for the owner of the current unit leader.
|Traits are found in {{path|common/country_leader/*.txt}} files. ''The former only if the character has one country leader role.''
|Uses a special interface displaying the current unit leader portrait
|1.11
Where triggers do not need to be repeatedly checked <code>random</code> can be a performance light alternative to <code>mean_time_to_happen</code> for scheduling events.
|-id="remove_country_leader_trait"
|remove_country_leader_trait
|<code><trait></code><br/>The trait to remove.<br/>
'''OR''':<br/>
<code>ideology = <sub-ideology></code><br/>The sub-ideology of the country leader role to which the trait is added.<br/>
<code>trait = <trait></code><br/>The trait to remove.
|<pre>remove_country_leader_trait = nationalist_symbol</pre>
<pre>remove_country_leader_trait = {
    ideology = marxism
    trait = anti_communist
}</pre>
|Removes the specified trait from the current character.
|Traits are found in {{path|common/country_leader/*.txt}} files. ''The former only if the character has one country leader role.''
|1.11
|-id="swap_country_leader_traits"
|swap_country_leader_traits
|<code>remove = <trait></code><br/>Trait to remove<br/>
<code>add = <trait></code><br/>Trait to add<br/>
<code>ideology = <sub-ideology></code><br/>Sub-ideology of the leader where to swap traits.<br/>
|<pre>swap_country_leader_traits = {
   remove = nationalist_symbol
   add = anti_communist
   ideology = marxism
}</pre>
|Swaps traits of the current character.
|Use [[#swap_ruler_traits|swap_ruler_traits]] in country scope.
|1.11
|}
===Combat===


{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ class="nowrap" | Combat-related unit leader-scoped effects:<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" | Notes
! width="5%" |Version Added
|-id="supply_units"
|supply_units
|<code><int> / <variable></code><br/>The amount of hours of supply.
|<pre>supply_units = 24</pre>
|Adds the specified amount of hours of supply to troops led by the current unit leader.
|&nbsp;
|1.5
|1.5
|-
|-id="add_max_trait"
|set_unit_leader_flag
|add_max_trait
|<code><flag></code><br /> An unique string to identify the unit leader flag with.
|<code><int></code><br/>The amount to add.
|<code>set_unit_leader_flag = my_flag</code>
|<pre>add_max_trait = 1</pre>
|Defines a unit leader flag.
|Adds the specified amount of assignable trait slots to the current unit leader.
|&nbsp;
|&nbsp;
|1.5
|1.5
|-
|-id="add_skill_level"
|clr_unit_leader_flag
|add_skill_level
|<code><flag></code><br /> The unique string of a unit leader flag to clear.
|<code><int></code><br/>The skill to add.
|<code>clr_unit_leader_flag = my_flag</code>
|<pre>add_skill_level = 1</pre>
|Clears a defined unit leader flag.
|Adds skill to the current unit leader.
|&nbsp;
|&nbsp;
|1.5
|1.5
|-
|-id="add_logistics"
|modify_unit_leader_flag
|add_logistics
|<code>flag = <flag></code><br /> The unit leader flag to modify
|<code><int></code><br/>How many skill levels to add.
<code>value = <value></code><br /> The value to set it to: 0 or 1
|<pre>add_logistics = 1</pre>
 
|Adds logistics skill to the current unit leader.
|<pre>modify_unit_leader_flag = {
   flag = my_flag
   value = 1
}
</pre>
 
|Modifies a unit leader flag.
|&nbsp;
|&nbsp;
|1.5
|1.5
|-
|-id="add_planning"
|promote_leader
|add_planning
|<code><bool></code><br /> Boolean
|<code><int></code><br/>How many skill levels to add.
|<pre>promote_leader = yes</pre>
|<pre>add_planning = 1</pre>
 
|Adds planning skill to the current unit leader.
|Promotes the current unit leader to Field Marshal (if Commander.
|&nbsp;
|&nbsp;
|1.5
|1.5
|-
|-id="add_defense"
|demote_leader
|add_defense
|<code><bool></code><br /> Boolean
|<code><int></code><br/>How many skill levels to add.
|<pre>demote_leader = yes</pre>
|<pre>add_defense = 1</pre>
 
|Adds defense skill to the current unit leader.
|Demotes the current unit leader to Commander (if Field Marshal).
|&nbsp;
|&nbsp;
|1.5
|1.5
|-
|-id="add_attack"
|retire
|add_attack
|<code><bool></code><br /> Boolean>
|<code><int></code><br/>How many skill levels to add.
|<pre>retire = yes</pre>
|<pre>add_attack = 1</pre>
 
|Adds attack skill to the current unit leader.
|Retires the current unit leader (removing them).
|&nbsp;
|&nbsp;
|1.5
|1.5
|-
|-id="add_coordination"
|remove_unit_leader
|add_coordination
|<code><id></code><br /> The id of the unit leader.
|<code><int></code><br/>How many skill levels to add.
|<pre>remove_unit_leader = 70</pre>
|<pre>add_coordination = 1</pre>
 
|Adds coordination skill to the current navy leader.
|Removes the specified unit leader by their id.
|
|&nbsp;
|1.5
|1.0
|-id="add_maneuver"
|-
|add_maneuver
|set_nationality
|<code><int></code><br/>How many skill levels to add.
|<code><scope> / <variable></code><br /> The target country.
|<pre>add_maneuver = 1</pre>
|<pre>set_nationality = GER</pre>
|Adds maneuver skill to the current navy leader.
 
|
|Switches the current unit leader to the specified country, giving them the leader.
|&nbsp;
|1.5
|1.5
|-
|-id="add_temporary_buff_to_units"
|add_unit_leader_trait
|add_temporary_buff_to_units
|<code><trait></code><br /> The trait to add.
|<code>combat_offense = <float></code><br/>The bonus to grant. Optional.
|<pre>add_unit_leader_trait = old_guard</pre>
<code>combat_breakthrough = <float></code><br/>The bonus to grant. Optional.<br/><code>combat_defense = <float></code><br/>The bonus to grant. Optional.<br/><code>combat_entrenchment = <float></code><br/>The bonus to grant. Optional.<br/><code>org_damage_multiplier = <float></code><br/>The bonus to grant. Optional.<br/><code>str_damage_multiplier = <float></code><br/>The bonus to grant. Optional.<br/><code>war_support_reduction_on_damage = <float></code><br/>The bonus to grant. Optional.<br/><code>cannot_retreat_while_attacking = <float></code><br/>The bonus to grant. Optional.<br/><code>cannot_retreat_while_defending = <float></code><br/>The bonus to grant. Optional.<br/><code>days = <int></code><br/>The duration of the buff. Optional.<br/><code>tooltip = <string></code><br/>The tooltip to display for the buff.
 
|<pre>add_temporary_buff_to_units = {
|Adds the specified trait to the current unit leader.
    combat_offense = 0.25
|Traits are found in {{path|common/unit_leader/*.txt}}.
   combat_breakthrough = 0.25
|1.0
   org_damage_multiplier = -1.0
|-
   str_damage_multiplier = 0.25
|remove_unit_leader_trait
   war_support_reduction_on_damage = 0.2
|<code><trait></code><br /> The trait to remove.
   cannot_retreat_while_attacking = 1.0
|<pre>remove_unit_leader_trait = old_guard</pre>
 
    days = 7
|Removes the specified trait from the current unit leader.
   tooltip = ABILITY_FORCE_ATTACK_TOOLTIP
|Traits are found in {{path|common/unit_leader/*.txt}}.
|1.0
|-
|add_timed_unit_leader_trait
|<code><trait></code><br /> The trait to add
<code>days = <int></code><br /> The duration of the trait.
 
|<pre>add_timed_unit_leader_trait = {
    trait = wounded
    days = 90
}
}
</pre>
</pre>
|Adds the specified combat buff to the current unit leader.
|&nbsp;
|1.5
|}
===Operatives===


|Adds the specified trait to the current unit leader for the specified duration.
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|Traits are found in {{path|common/unit_leader/*.txt}}.
|+ class="nowrap" | Operative-scoped effects:<br/>
|1.5
|-
|replace_unit_leader_trait
|&nbsp;
|&nbsp;
|&nbsp;
|Traits are found in {{path|common/unit_leader/*.txt}}.
|1.5
|}
 
===战斗===
 
{| class="wikitable sortable" width="100%"
|-
! width="10%" |Name
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Parameters
第3,021行: 第4,833行:
! width="15%" |Notes
! width="15%" |Notes
! width="5%" |Version Added
! width="5%" |Version Added
|-
|-id="add_nationality"
|supply_units
|add_nationality
|<code><int> / <variable></code><br /> The amount of hours of supply.
|<code><tag></code><br/>The country to set the nationality to.
|<pre>supply_units = 24</pre>
|<pre>add_nationality = GER</pre>
 
|Adds the nationality to the current operative.
|Adds the specified amount of hours of supply to troops led by the current unit leader.
|&nbsp;
|&nbsp;
|1.5
|1.9
|-
|-id="capture_operative"
|add_max_trait
|capture_operative
|<code><int></code><br /> The amount to add.
|<code>captured_by = <tag></code><br/>By which country to get captured.<br/>
|<pre>add_max_trait = 1</pre>
<code>ignore_death_chance = <bool></code><br/>Whether to ignore the death chance on capture (no by default).<br/>
 
|<pre>capture_operative = {
|Adds the specified amount of assignable trait slots to the current unit leader.
   captured_by = POL
|&nbsp;
   ignore_death_chance = yes
|1.5
}</pre>
|-
|Makes the current operative be captured by a specific country.
|add_skill_level
|
|<code><int></code><br /> The skill to add.
|1.9
|<pre>add_skill_level = 1</pre>
|-id="force_operative_leader_into_hiding"
|force_operative_leader_into_hiding
|<code><bool></code><br/>
|<pre>force_operative_leader_into_hiding = yes</pre>
|Forces the current operative into hiding.
|
|1.9
|-id="free_operative"
|free_operative
|<code>captured_by = <tag></code><br/>The country that captured the operative.
|<pre>free_operative = { captured_by = POL }</pre>
|Frees the current operative.
|
|1.9
|-id="harm_operative_leader"
|harm_operative_leader
|<code><int></code><br/>How much to harm the operative.
|<pre>harm_operative_leader = 12</pre>
|Harms the current operative.
|The value is subject to modifiers.
|1.9
|-id="kill_operative"
|kill_operative
|<code>killed_by = <tag></code><br/>The country that'll kill the operative.
|<pre>kill_operative = { killed_by = POL }</pre>
|Kills the current operative.
|
|1.9
|-id="turn_operative"
|turn_operative
|<code>turned_by = <tag></code><br/>The country to which the operative defects.
|<pre>turn_operative = {
   turned_by = PREV
}</pre>
|Turns the current operative against their own country, transferring them to the specified country.
|This counts as the operative dying and will trigger the corresponding [[On action]]. Logs an error if used against your own operative.
|1.9
|-id="operative_leader_event"
|operative_leader_event
|<code>id = <event></code><br/>The event to fire.
<code>days = <int> / <variable></code><br/>Fires the event in the specified number of days. Optional.<br/><code>hours = <int> / <variable></code><br/>Fires the event in the specified number of hours. Optional.<br/><code>random = <int> / <variable></code><br/>Adds a random number (between ''0'' and ''random'', inclusive) of '''hours''' to the scheduled fire time. Optional.<br/><code>random_days = <int> / <variable></code><br/>Adds a random number (between ''0'' and ''random_days'', inclusive) of days to the scheduled fire time. Optional.<br/><code>originator = <tag></code><br/>The originator of the event. Optional, defaults to owner of operative.<br/><code>recipient = <tag></code><br/>The recipient of the event. Optional, defaults to owner of operative.<br/><code>set_from = <tag></code><br/>Sets the scope of FROM in scripted localization. Optional.<br/><code>set_from_from = <tag></code><br/>Sets the scope of FROM.FROM in scripted localization. Optional.<br/><code>set_root = <tag></code><br/>Sets the scope of ROOT in scripted localization. Optional.
|<pre>operative_leader_event = {
   id = my_event.1
originator = POL
recipient = GER
   days = 10
   random = 50
   random_days = 10
set_from = ENG
set_root = SOV
set_from_from = FRA
}
</pre>
|Fires the specified event for the operative.
|Uses a special interface displaying the current operative portrait.
Where triggers do not need to be repeatedly checked <code>random</code> can be a performance light alternative to <code>mean_time_to_happen</code> for scheduling events.
|1.9
|}
==Division scope==


|Adds skill to the current unit leader.
The effects here must be used within a '''division''' scope.
|&nbsp;
|1.5
|-
|add_logistics
|<code><int></code><br /> The skill to add.
|<pre>add_logistics = 1</pre>


|Adds logistics skill to the current unit leader.
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|&nbsp;
|+ class="nowrap" | Division-scoped effects:<br/>
|1.5
! width="10%" |Name
|-
! width="25%" |Parameters
|add_planning
! width="25%" |Examples
|<code><int></code><br /> The skill to add.
! width="20%" |Description
|<pre>add_planning = 1</pre>
! width="15%" |Notes
! width="5%" |Version Added
|-id="destroy_unit"
|destroy_unit
|<code><bool><br/></code>Boolean.
|<pre>destroy_unit = yes</pre>
|Destroys the currently-scoped division.
|
|1.12
|-id="add_history_entry"
|add_history_entry
|<code>key = <localisation key></code><br/>The name of the entry.<br/>
<code>subject = "<string>"</code><br/>Logged entry. Never shown to the player.<br/>
<code>allow = <bool></code><br/>Whether a medal can be awarded to the division over the history entry.
|<pre>add_history_entry = {
   key = my_history_entry
   subject = "Test entry"
   allow = no
}</pre>
|Creates an entry within the command history of a division.
|
|1.12
|-id="change_division_template"
|change_division_template
|<code><string></code><br/>The name of the division.
|<pre>change_division_template = {
   division_template = "New template"
}</pre>
|Changes the template of the division to the specified one.
|
|1.12
|-id="add_random_valid_trait_from_unit"
|add_random_valid_trait_from_unit
|<code><character></code><br/>Character to grant the trait to.
|<pre>add_random_valid_trait_from_unit = FROM</pre>
|Adds a random valid unit trait to a unit leader.
|Only possible to use if the division scope is the same as the ROOT scope.
|1.12
|-id="add_unit_medal_to_latest_entry"
|add_unit_medal_to_latest_entry
|<code>unit_medals = <medal ID></code><br/>The medal to add.
|<pre>add_unit_medal_to_latest_entry = {
   unit_medals = my_medal
}</pre>
|Adds the specified medal to the latest entry within the unit's history.
|
|1.12
|-id="add_divisional_commander_xp"
|add_divisional_commander_xp
|<code><decimal></code><br/>Experience to add.
|<pre>add_divisional_commander_xp = 10</pre>
|Adds the specified amount of experience to the divisional commander.
|
|1.12
|-id="reseed_division_commander"
|reseed_division_commander
|<code><int></code><br/>The seed to use.
|<pre>reseed_division_commander = 760</pre>
|Re-randomises the division commander using the given seed.
|Does not have a tooltip.
|1.12
|-id="set_unit_organization"
|set_unit_organization
|<code><decimal></code><br/>The level to set to.
|<pre>set_unit_organization = 0.3</pre>
|Changes the organisation of the unit.
|On the scale from 0 to 1.
|1.13
|}


|Adds planning skill to the current unit leader.
==MIO scope==
|&nbsp;
|1.5
|-
|add_defense
|<code><int></code><br /> The skill to add.
|<pre>add_defense = 1</pre>


|Adds defense skill to the current unit leader.
The effects here must be used within a '''military industrial organisation''' scope
|&nbsp;
|1.5
|-
|add_attack
|<code><int></code><br /> The skill to add.
|<pre>add_attack = 1</pre>


|Adds attack skill to the current unit leader.
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ class="nowrap" | MIO-scoped effects:<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="add_mio_funds"
|add_mio_funds
|<code><int></code><br/>Funds to add.
|<pre>add_mio_funds = 1000</pre>
|Adds funds to the MIO.
|If the amount goes above the "Size Up" limit, the MIO will automatically gains sizes. The amount of funds is capped at 0 from below.
|1.13
|-id="set_mio_funds"
|set_mio_funds
|<code><int></code><br/>Amount to set.
|<pre>set_mio_funds = 1000</pre>
|Sets the funds of a MIO to the certain level.
|If the amount goes above the "Size Up" limit, the MIO will automatically gains sizes. Cannot be negative.
|1.13
|-id="add_mio_funds_gain_factor"
|add_mio_funds_gain_factor
|<code><decimal></code><br/>Amount to add.
|<pre>add_mio_funds_gain_factor = 0.1</pre>
|Changes the base multiplier to MIO's funds.
|The multiplier is capped at 0 from below.
|1.13
|-id="set_mio_funds_gain_factor"
|set_mio_funds_gain_factor
|<code><decimal></code><br/>Amount to set.
|<pre>set_mio_funds = 0.1</pre>
|Changes the base multiplier to MIO's funds.
|Cannot be negative.
|1.13
|-id="add_mio_size"
|add_mio_size
|<code><int></code><br/>Amount to add.
|<pre>add_mio_size = 2</pre>
|Adds sizes to the MIO.
|Funds will not be changed by the effect. Cannot be negative.
|1.13
|-id="add_mio_size_up_requirement_factor"
|add_mio_size_up_requirement_factor
|<code><decimal></code><br/>Amount to add.
|<pre>add_mio_size_up_requirement_factor = 0.1</pre>
|Changes the base multiplier to the requirement to size up a MIO.
|The multiplier is capped at 0 from below.
|1.13
|-id="set_mio_size_up_requirement_factor"
|set_mio_size_up_requirement_factor
|<code><decimal></code><br/>Amount to set.
|<pre>set_mio_size_up_requirement_factor = 0.1</pre>
|Changes the base multiplier to the requirement to size up a MIO.
|Cannot be negative.
|1.13
|-id="add_mio_task_capacity"
|add_mio_task_capacity
|<code><int></code><br/>Amount to add.
|<pre>add_mio_task_capacity = 2</pre>
|Changes the base maximum task capacity of the MIO.
|If the capacity is reduced to below the amount of assigned tasks, they'll be turned allowed. The base amount is capped at 0 from below. Doesn't instantly apply.
|1.13
|-id="set_mio_task_capacity"
|set_mio_task_capacity
|<code><int></code><br/>Amount to set.
|<pre>set_mio_task_capacity = 2</pre>
|Changes the base maximum task capacity of the MIO.
|If the capacity is reduced to below the amount of assigned tasks, they'll be turned allowed. Cannot be negative. Doesn't instantly apply.
|1.13
|-id="add_mio_research_bonus"
|add_mio_research_bonus
|<code><decimal></code><br/>Amount to add.
|<pre>add_mio_research_bonus = 0.3</pre>
|Changes the base research bonus of the MIO.
|The base amount is capped at 0 from below.
|1.13
|-id="set_mio_research_bonus"
|set_mio_research_bonus
|<code><decimal></code><br/>Amount to set.
|<pre>set_mio_research_bonus = 0.3</pre>
|Changes the base research bonus of the MIO.
|Cannot be negative.
|1.13
|-id="set_mio_name_key"
|set_mio_name_key
|<code><localisation key></code><br/>The new name.
|<pre>set_mio_name_key = mio_new_name</pre>
|Changes the name of the MIO.
|May also refer to a [[scripted localisation]] definition, which'll be evaluated in MIO's scope.
|1.13
|-id="set_mio_icon"
|set_mio_icon
|<code><sprite></code><br/>The new [[spriteType|sprite]].
|<pre>set_mio_icon = GFX_new_mio_icon</pre>
|Changes the MIO's icon.
|
|1.13
|-id="add_mio_design_team_assign_cost"
|add_mio_design_team_assign_cost
|<code><decimal></code><br/>Amount to add.
|<pre>add_mio_design_team_assign_cost = 0.3</pre>
|Changes the base political power cost of the MIO to assign research.
|The base amount is capped at 0 from below.
|1.13
|-id="set_mio_design_team_assign_cost"
|set_mio_design_team_assign_cost
|<code><decimal></code><br/>Amount to set.
|<pre>set_mio_design_team_assign_cost = 0.3</pre>
|Changes the base political power cost of the MIO to assign research.
|Cannot be negative.
|1.13
|-id="add_mio_industrial_manufacturer_assign_cost"
|add_mio_industrial_manufacturer_assign_cost
|<code><decimal></code><br/>Amount to add.
|<pre>add_mio_industrial_manufacturer_assign_cost = 0.3</pre>
|Changes the base political power cost of the MIO to assign production lines.
|The base amount is capped at 0 from below.
|1.13
|-id="set_mio_industrial_manufacturer_assign_cost"
|set_mio_industrial_manufacturer_assign_cost
|<code><decimal></code><br/>Amount to set.
|<pre>set_mio_industrial_manufacturer_assign_cost = 0.3</pre>
|Changes the base political power cost of the MIO to assign production lines.
|Cannot be negative.
|1.13
|-id="add_mio_design_team_change_cost"
|add_mio_design_team_change_cost
|<code><decimal></code><br/>Amount to add.
|<pre>add_mio_design_team_change_cost = 0.3</pre>
|Changes the base experience cost of the MIO to assign to equipment by a percentage.
|The base amount is capped at 0 from below. Rounded down, e.g. <code>0.3</code> with a cost of <code>5</code> should result in <code>6.5</code>, but becomes <code>6</code> instead.
|1.13
|-id="set_mio_design_team_change_cost"
|set_mio_design_team_change_cost
|<code><decimal></code><br/>Amount to set.
|<pre>set_mio_design_team_change_cost = 0.3</pre>
|Changes the base experience cost of the MIO to assign to equipment by a percentage.
|Cannot be negative. Rounded down, e.g. <code>0.3</code> with a cost of <code>5</code> should result in <code>6.5</code>, but becomes <code>6</code> instead.
|1.13
|-id="unlock_mio_trait_tooltip"
|unlock_mio_trait_tooltip
|<code><trait></code><br/>Trait to display.
'''OR'''<br/>
<code>trait = <trait></code><br/>Trait to display.<br/>
<code>show_modifiers = <bool></code><br/>Whether the trait's modifiers should be shown in the tooltip. Defaults to true.
|<pre>unlock_mio_trait_tooltip = my_trait_1</pre>
<pre>unlock_mio_trait_tooltip = {
   trait = my_trait_2
   show_modifiers = no
}</pre>
|Displays a tooltip that says that the trait is made available.
|Doesn't change the availability of the trait directly.
|1.13
|-id="complete_mio_trait"
|complete_mio_trait
|<code><trait></code><br/>Trait to complete.<br/>
'''OR'''<br/>
<code>trait = <trait></code><br/>Trait to complete.<br/>
<code>show_modifiers = <bool></code><br/>Whether the trait's modifiers should be shown in the tooltip. Defaults to true.
|<pre>complete_mio_trait = my_trait_1</pre>
<pre>complete_mio_trait = {
   trait = my_trait_2
   show_modifiers = no
}</pre>
|Completes the specified MIO trait.
|Automatically adds 1 size to the MIO. No checks are placed on the trait.
|1.13
|-id="set_mio_flag"
|set_mio_flag
|<code><flag></code><br/>An unique string to identify the MIO flag with.<br/>
'''OR'''<br/>
<code>flag = <flag></code><br/>The flag to set.<br/>
<code>days = <int></code><br/>Sets the flag to last for the specified amount of days. Optional.<br/>
<code>value = <int></code><br/>The new value of the flag on the scale from -2 147 483 648 to 2 147 483 647.
|<pre>set_mio_flag = my_flag</pre>
<pre>set_mio_flag = {
   flag = my_flag
   days = 123
   value = 1
}</pre>
|Defines a MIO flag.
|No tooltip is shown.
|1.13
|-id="clr_mio_flag"
|clr_mio_flag
|<code><flag></code><br/>The unique string of a country flag to clear.
|<pre>clr_mio_flag = my_flag</pre>
|Clears a defined MIO flag.
|&nbsp;
|&nbsp;
|1.5
|1.13
|-
|-id="modify_mio_flag"
|add_temporary_buff_to_units
|modify_mio_flag
|<code>combat_offense = <float></code><br /> The bonus to grant. Optional.
|<code>flag = <flag></code><br>The flag to modify.<br>
<code>combat_breakthrough = <float></code><br /> The bonus to grant. Optional.<br /> <code>combat_defense = <float></code><br /> The bonus to grant. Optional.<br /> <code>combat_entrenchment = <float></code><br /> The bonus to grant. Optional.<br /> <code>org_damage_multiplier = <float></code><br /> The bonus to grant. Optional.<br /> <code>str_damage_multiplier = <float></code><br /> The bonus to grant. Optional.<br /> <code>war_support_reduction_on_damage = <float></code><br /> The bonus to grant. Optional.<br /> <code>cannot_retreat_while_attacking = <float></code><br /> The bonus to grant. Optional.<br /> <code>cannot_retreat_while_defending = <float></code><br /> The bonus to grant. Optional.<br /> <code>days = <int></code><br /> The duration of the buff. Optional.<br /> <code>tooltip = <string></code><br /> The tooltip to display for the buff.
<code>value = <value></code><br>The value to add to the flag. Defaults to 0.<br>
<code>days = <int></code><br/>The amount of days that the flag should last for before being cleared. Optional, defaults to permanent.<br/>
|<pre>
modify_mio_flag = {
   flag = my_flag
   value = 3
}</pre>
|Adds an integer value to a flag.
|The flag must be already set.
|1.13
|}
 
==Other scopes==
 
The effects here must be used within a scope that's specified within the notes.


|<pre>add_temporary_buff_to_units = {
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
   combat_offense = 0.25
|+ class="nowrap" | Otherwise-scoped effects:<br/>
   combat_breakthrough = 0.25
! width="10%" |Name
   org_damage_multiplier = -1.0
! width="25%" |Parameters
   str_damage_multiplier = 0.25
! width="25%" |Examples
   war_support_reduction_on_damage = 0.2
! width="20%" |Description
   cannot_retreat_while_attacking = 1.0
! width="15%" |Notes
! width="5%" |Version Added
   days = 7
|-id="execute_operation_coordinated_strike"
    tooltip = ABILITY_FORCE_ATTACK_TOOLTIP
|execute_operation_coordinated_strike
}
|<code>amount = <int></code><br/>How many times the operation will get executed within the days set in the operation.
</pre>
|<pre>execute_operation_coordinated_strike = {
 
    amount = 12
|Adds the specified combat buff to the current unit leader.
}</pre>
|&nbsp;
|All prepared Port Strike and Strategic Bombing in the target region will execute multiple times without air defence being able to intercept them.
|1.5
|Can only be used within operations.
|-
|1.9
|boost_planning
|-id="cancel_purchase_contract"
|<code><float></code><br /> The amount to add.
|cancel_purchase_contract
|<pre>boost_planning = 1</pre>
|<code><bool></code><br/>Boolean.
 
|<pre>cancel_purchase_contract = yes</pre>
|Improves the planning of units controlled by the current unit leader.
|Cancels the current purchase contract.
|&nbsp;
|Can only be used within the purchase contract scope.
|1.5
|1.13
|}
|}


==Flow Control==
==Flow control==


These scopes are used within effect scopes to control the execution of effects.
These scopes are used within effect scopes to control the execution of effects.
===If statements===
{{anchor|if|else|else_if}}
An [[wp:Conditional_(computer_programming)#If–then(–else)|if statement]] allows an execution of effects to only be done if certain [[triggers]] are met. Conditional statements are represented with the <code>if = { ... }</code> effect. <code>limit = { ... }</code> inside of the if statement serves as a [[triggers|trigger block]] that defines the conditions when it should be executed, and everything else directly inside of <code>if = { ... }</code> is interpreted as the effects that should be executed if the condition is true.


===If, Else If and Else===
For example, the following will add 10% {{icon|stability|1}} to the country this is executed on if it has positive {{icon|political power|1}} and below 90% stability:
 
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:
<pre>if = {
<pre>if = {
    limit = {
    limit = {
      original_tag = GER
      has_political_power > 0
    }  
     stability < 0.9
    }
    add_stability = 0.1
    add_stability = 0.1
}
}</pre>
</pre>
If the limit is not met, then none of the effects inside will be executed. If it is, then each one will be. If the limit is omitted, it defaults to being always true.
 
'''The effects must be inside of the if statement to be tied to the limit'''. For example, this will always give 100 {{icon|political power|1}}, regardless of what country is played:
<pre>if = {
   limit = { tag = BHR }
}             # Closes if = { ... }. Since no effects are inside, this means that the if statement does absolutely nothing
add_political_power = 100 # Outside of if = { ... }, so it will always give 100 political power, even if not playing as BHR</pre>


If you then wanted England to have a similar effect, and everyone else to have something else, you do the following:
Optionally, <code>else_if = { ... }</code> (with <code>limit = { ... }</code> serving in a similar fashion) and <code>else = { ... }</code> can be added. If the initial limit within <code>if = { ... }</code> is false, it moves on to the next <code>else_if = { ... }</code>, checking the limit there. If the limit there is false, then it moves on to the next one, until hitting an end or an <code>else = { ... }</code>.<br/>
Two variants exist: nested and unnested. In the first case, the <code>else_if</code> or <code>else</code> is put directly inside of the preceding <code>if</code> or <code>else_if</code>, while in the second case it's put ''right after''. In case of overlap, unnested if statements are preferred. Here is an example using unnested if statements:
<pre>if = {
<pre>if = {
    limit = {
    limit = {
      original_tag = GER
      stability < 0.3 # If stability is below 30%, add 30%.
    }  
    }
    add_stability = 0.1
    add_stability = 0.3
}
}
else_if = {
else_if = {
    limit = {
    limit = {
      original_tag = ENG
      stability < 0.6 # Otherwise, if it's below 60% (i.e. 30-59%), add 20%
    }
    }
    add_stability = 0.25
    add_stability = 0.2
}
}
else = {
else = {
    add_stability = 0.05
    add_stability = 0.1 # If there's 60-100% stability, add 10%
}
}
</pre>
</pre>


As you can see, this allows for flexibility in how effects occur and cuts down on duplication.
Within the tooltip, only effects that would be executed are shown. The effects within an unfulfilled if statement (or an <code>else</code>/<code>else_if</code> that's not read due to the if statement being met) will be hidden from the player, and so will the trigger. In order to avoid player confusion, [[#Effect tooltips|custom effect tooltips can be used to tell the player what this effect block would do]], such as being used within an <code>else</code>.


=== 隐藏效果===
===Random effects===
{{anchor|random|random_list}}
If you want an effect to have a random chance to be done or have nothing happen otherwise, the <code>random = { ... }</code> block is the simplest way to accomplish that:
<pre>random = {
   chance = 80
   add_stability = 0.4
   add_war_support = 0.3
}</pre>
This in particular will have an 80% chance to add 40% stability and 30% war support and, accordingly, a 20% chance to do nothing. The chance here is on the scale from 0 to 100.


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:
If you want the game to choose between effect blocks, random_list can be used instead. For example, if you wanted an effect to randomly given the player one out of four bonuses, you'd do the following:
<pre>hidden_effect = {
<pre>random_list = {
    set_variable = { my_var = 100 }
   10 = {
     add_stability = 0.5
   }
    10 = {
     add_manpower = 10000
   }
   10 = {
     add_war_support = 0.5
   }
   10 = {
     army_experience = 100
   }
}
}
</pre>
</pre>The number is not the chance, but the weight for each option, as they don't have to add up to 100 or any number. An option with the weight of 20 is twice as likely to be picked as the option with the chance of 10, for instance. In total, the probability for an option to be picked is equal to the weight of the option divided by the sum of all weights.
 
===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:
It is also possible to use modifiers (akin to [[MTTH|MTTH blocks]]) to affect the weight of each possible random effect or to use [[variables]] as chances.
<pre>random_list = {
<pre>random_list = {
    25 = {
    30 = {
     modifier = {
       factor = 1.3
       has_country_flag = inward_perfect_flag
     }
      add_stability = 0.5
      add_stability = 0.5
    }
    }
第3,163行: 第5,313行:
      add_manpower = 10000
      add_manpower = 10000
    }
    }
    25 = {
    20 = {
      add_war_support = 0.5
      add_war_support = 0.5
    }
    }
    25 = {
    my_variable = { # Taking "my_variable" as the variable's name, both "var:my_variable" and "my_variable" are valid options, left up to the developer's preference.
      army_experience = 100
      army_experience = 100
    }
    }
}
}
</pre>
</pre>
 
If the country flag inward_perfect_flag is set, it'll multiply the above chance of 30 by 1.3 to get 39. Meanwhile, <code>my_variable</code> will take the value of the according temp variable or the current scope's variable as the weight of the option.
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:
 
<pre>fixed_random_seed = no
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:
</pre>
<pre>fixed_random_seed = no
 
</pre>
It is also possible to use modifiers to affect the weight of each possible random effect.
'''This is only for decisions'''. Elsewhere, random seed is unfixed by default, making this argument unnecessary to set to "no".<br/>
<pre>random_list = {
 
    25 = {
===Tooltip manipulation===
      add_stability = 0.5
{{See also|Localisation}}
      modifier = {
{{Anchor|Effect tooltip|effect_tooltip|Effect tooltips|Hidden effect|hidden_effect}}
       factor = 1.3
The "tooltip" in this case refers to the text shown to the player in-game that explains what the effect block changes within the game, such as "{{green|+50}} {{icon|political power|1}}".
        has_country_flag = inward_perfect_flag
 
      }
There are 3 ways to edit the tooltip within an effect block:
    }
* <code>hidden_effect = { ... }</code> is used in order to hide the effects within from the tooltip, making their execution not get shown to the player.
    25 = {
* <code>effect_tooltip = { ... }</code> is, instead, used in order to put the effects into the tooltip without actually executing them.
     add_manpower = 10000
* <code>custom_effect_tooltip = my_localisation_key</code> is used in order to put an arbitrary paragraph of text as an effect that will get executed.
    }
 
    25 = {
For example, this sample [[National focus modding|focus' completion reward]] utilises all three:
      add_war_support = 0.5
<pre>completion_reward = { 
    }
    hidden_effect = {
    25 = {
      every_subject_country = { country_event = my_event.1 }
      army_experience = 100
   }
    }
   custom_effect_tooltip = send_event_to_subjects_tt
}
   effect_tooltip = {
</pre>
      add_political_power = 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.
   }
 
   custom_effect_tooltip = reject_war_tt
===Effect Tooltip===
}</pre>
 
In this case, send_event_to_subjects_tt and reject_war_tt are localisation keys defined within any {{path|localisation/english/*_l_english.yml}} file encoded with UTF-8-BOM, assuming the English language.
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:
<pre>
<pre>effect_tooltip = {
send_event_to_subjects_tt: "Sends a demand to our every subject.\nIf they agree, we get the following for each subject:"
   every_owned_state = {
reject_war_tt: "If they reject the demand, we gain a wargoal against them."
     add_manpower = 10000
</pre>
   }
In-game, this will appear as such:
}
{| class="eu4box-inline" style="padding: 1px;"
</pre>
|-
| <div style="color:#CE9810">Effect:</div>
Sends a demand to our every subject.<br/>
If they agree, we get the following for each subject:<br/>
Political Power: {{Green|+100}}<br/>
If they reject the demand, we gain a wargoal against them.
|}
 
Noticably, the effect that fires the country event gets hidden from the tooltip. After completing the focus, the only thing that happens is that every subject country receives an event with the ID of <code>my_event.1</code>, the country does not immediately gain 100 political power.
 
==Meta effects==
 
Meta effects allow you to use non-dynamic effects (the ones that do not accept modifiers and can only use static tokens or constant values) as if they were accepting variables.
 
<pre>add_equipment_to_stockpile = {
   type = infantry_equipment_2
   amount = eq_amount
}
</pre>
 
In the effect shown above, amount of equipment added is dynamic and can be set using the variable "eq_amount". However, this effect does not let you use a variable as equipment type. You can not store "infantry_equipment_2" in a variable and use it here.
 
However, meta effects will let you use variables and scripted localization within them to build effects as if they were texts and run them. Let's make previous effect accept equipment type and equipment level as variables stored in "eq_type" and "eq_level".
 
<pre>set_variable = { eq_type = 1 } # Sets the equipment type to "1", which determines the equipment given using scripted localisation, included below
set_variable = { eq_amount = 10 } # Sets the amount of equipment given to 10
set_variable = { eq_level = 2 } # Sets the equipment level to 2, which is used directly in the meta effect, no scripted localisation required
 
meta_effect = { # The actual meta effect. This can go anywhere you need it: in a decision, in a scripted effect, in a scripted GUI click effect, etc...
   text = {
     add_equipment_to_stockpile = {
       type = [EQ_TYPE]_[EQ_LEVEL]
        amount = eq_amount
      }
    }
    EQ_LEVEL = "[?eq_level|.0]" # Gets the "eq_level" variable and saves it as "EQ_LEVEL" for the meta effect to use
   EQ_TYPE = "[This.GetEquipmentName]" # Gets the equipment type from scripted localisation, included below, based on the "eq_type" variable, and saves it as "EQ_TYPE" for the meta effect to use
}
</pre>
 
<pre>
# The scripted localization for the "eq_type" variable, which goes in a scripted localisation file
defined_text = { # Since the "eq_type" variable in this example is equal to 1, the equipment given by the effect is "artillery_equipment"
    name = GetEquipmentName
    text = {
      trigger = {
       check_variable = { eq_type = 0 }
     }
     localization_key = "infantry_equipment"
    }
    text = {
     trigger = {
       check_variable = { eq_type = 1 }
      }
     localization_key = "artillery_equipment"
    }
}
</pre>
 
As you can see, we have created a meta_effect that takes two arguments. These arguments will be used replacing the parameters [EQ_TYPE] and [EQ_LEVEL] inside the meta effect. EQ_LEVEL will be replaced by [?eq_level|.0] which is the integer value of eq_level (in this case 2.000 becomes 2). EQ_TYPE is a bit more complicated, it is being replaced by a scripted localization. This scripted localization will check eq_type variable and depending on its value it will return the key token for the equipment. If it is 0, it will return "infantry_equipment". If it is 1, it will return "artillery_equipment".
 
So the final result is [EQ_TYPE] is being replaced by "artillery_equipment" and [EQ_LEVEL] is being replaced by "2" and in the end our effect will be built as:
 
<pre>add_equipment_to_stockpile = {
   type = artillery_equipment_2
   amount = eq_amount
}
</pre>
 
which will give you 10 artillery_equipment_2.
 
debug = yes can be added to meta effects. Which will print the final effect to game.log when the effect is executed and make debugging easier.
==Scripted effects==
Scripted effects serve a similar purpose to [https://en.wikipedia.org/wiki/Subroutine functions] in that they can be defined in {{path|common/scripted_effects/*.txt}} and then used elsewhere as a shortened version. '''A scripted effect will never run by itself''' and requires being used as an effect elsewhere to be executed. Alongside that, the game allows the creation of custom console commands, which are scripted effects.
 
A scripted effect is defined simply as <pre>scripted_effect_name = {
<effects>
}</pre>This example can be used as an effect in regular code as <code>scripted_effect_name = yes</code>.
 
Scripted effects can be accessed in console by typing <code>e scripted_effect_name</code> to run them.
 
To create a custom console command, the scripted effect's name should begin with <code>d_</code>. The console command itself does not include <code>d_</code>, so <code>d_test_command</code> would be run in console as <code>test_command</code><br/>
In custom console commands, the country running the command is FROM, while ROOT is the selected country, state, or character. Anything entered after the console command, separated by spaces like <code>test_command 123 321 GER</code> is added to the 'args' temp [[Arrays|array]]. An example of a scripted effect which will transfer every state entered as an argument to the country that runs the console command is
<pre>d_transfer_states = {
for_each_scope_loop = {
array = args
FROM = {
transfer_state = PREV
}
}
}</pre>used like <code>transfer_states 123 321</code>
=== Useful scripted effects ===
These scripted effects are defined in base game and might be useful to keep in the mod to cut down on the amount of code. As scripted effects, all of these use a boolean value as argument.
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Base game scripted effects:}}<br/>
! width="20%" |Name
! width="10%" |Scope
! width="25%" |Example
! width="20%" |Description
! width="25%" |Notes
|-id="instantiate_collaboration_government"
|instantiate_collaboration_government
|Country
|<pre>instantiate_collaboration_government = yes</pre>
|Creates a collaboration government, with the current scope as overlord.
|The target of the collaboration government is stored in the <code>country_to_initiate</code> [[temp variable]].
|-id="upgrade_economy_law"
|upgrade_economy_law
|Country
|<pre>upgrade_economy_law = yes</pre>
|Switches the economy law one level towards total mobilisation.
|If already on total mobilisation, adds 150 {{icon|political power|1}}. Must be adjusted manually for new laws.
|-id="gain_random_agency_upgrade"
|gain_random_agency_upgrade
|Country
|<pre>gain_random_agency_upgrade = yes</pre>
|Grants a random available intelligence agency upgrade.
|Only results in an agency being created if one doesn't exist.
|-id="add_ruling_to_dem"
|add_ruling_to_dem
|Country
|<pre>add_ruling_to_dem = yes</pre>
|All of the ruling party's popularity gets added to the {{icon|Democratic|1}} ideology group.
|Requires manual adjustment if new ideologies are added. See also: <code>add_ruling_to_fas</code>, <code>add_ruling_to_com</code>, <code>add_ruling_to_neu</code>
|-id="remove_any_country_role_from_character"
|remove_any_country_role_from_character
|Character
|<pre>remove_any_country_role_from_character = yes</pre>
|Removes all advisor roles from the current scope.
|Requires manual adjustment if new slots are added.
|-id="increase_state_category"
|increase_state_category
|State
|<pre>increase_state_category = yes</pre>
|Changes the [[state category]] to the next one that contains more building slots.
|Has no effect on small islands, megalopolises, or <code>large_city</code> (Dense Urban Region). <code>city</code> (Urban Region) gets upgraded straight to Metropolis, skipping <code>large_city</code>.
|-id="lerp"
|lerp
|Any
|<pre>lerp = yes</pre>
|Creates the <code>lerp_result</code> regular variable with <math>result := a + (b-a)\cdot x</math>
|<math>a</math>, <math>b</math>, and <math>x</math> are stored as <code>lerp_a</code>, <code>lerp_b</code>, <code>lerp_x</code> [[temp variable]]s. <math>x</math> is clamped between 0 and 1.
|-id="store_core_states_on_game_start"
|store_core_states_on_game_start
|Country
|<pre>store_core_states_on_game_start = yes</pre>
|Stores the current core states of the current scope in an [[array]] in ROOT's scope.
|The created array will be named <code>core_states_at_game_start</code>. Intended to be called in [[Country creation#Country history|country history]] only once.
|}


{{Modding navbox}}
{{Modding navbox}}
[[分类:Modding]]
[[分类:Modding]]
[[en:Commands]]

2024年9月6日 (五) 23:37的最新版本


Effects (also known as Commands) are used in order to affect the game dynamically from within a specific scope. They are a one-time change to the current condition of the game, without the ability to have a lasting effect. Instead, modifiers are used to have a continuous, everlasting effect on the game's condition that can be represented with a number. Effect blocks cannot be used to apply modifiers directly, however they can add something that can apply modifiers, most commonly with add_ideas.

Effects are used throughout the game in numerous scopes, most commonly edited effect blocks are national focus rewards, event options and decision effects.

Note that certain effects may take a value from a variable, i.e. add_manpower = var:my_var This is noted by <variable> in an effect's parameters. See Variables for information on the variable effects.

The list of effects may be outdated. A complete, but unsorted, list of effects can be found in /Hearts of Iron IV/documentation/effects_documentation.html or /Hearts of Iron IV/documentation/effects_documentation.md.

Scopes

主条目:Scopes

Scopes serve as special effect types that modify the entity that serves as the context for the effects being executed, such as GER = { add_political_power = 150 } adding 150 political power to 德意志国的国旗 德意志国.

Effect scopes

These can only be used as effects; trying to use them as triggers will result in nothing happening.

Effect scopes:
Name Usage Target type Example Description Version Added
every_possible_country Always usable Country every_possible_country = { ... } Executes children effects on every country that meets the limit, including those that do not exist. 1.11
every_country Always usable Country every_country = { … } Executes contained effects on every country that meets the limit. 1.0
random_country Always usable Country random_country = { … } Executes contained effects on a random country that meets the limit. 1.0
every_other_country Within country scope only Country every_other_country = { … } Executes contained effects on every country that meets the limit and is not the same country as the one this is contained in. 1.0
random_other_country Within country scope only Country random_other_country = { … } Executes contained effects on a random country that meets the limit and is not the same country as the one this is contained in. 1.0
every_country_with_original_tag Always usable Country
every_country_with_original_tag = {
    original_tag_to_check = TAG  #required
    …                  #effects to run
}
Executes contained effects on every country that meets the limit and has the specified original tag. 1.9
random_country_with_original_tag Always usable Country
random_country_with_original_tag = {
    original_tag_to_check = TAG  #required
    …                  #effects to run
}
Executes contained effects on a random country that meets the limit and has the specified original tag.
every_neighbor_country Within country scope only Country every_neighbor_country = { … } Executes contained effects on every country that meets the limit and borders the country this is contained in. 1.0
random_neighbor_country Within country scope only Country random_neighbor_country = { … } Executes contained effects on a random country that meets the limit and borders the country this is contained in. 1.0
every_occupied_country Within country scope only Country every_occupied_country = { … } Executes contained effects on every country that meets the limit and has any core states controlled by the country this is contained in. 1.9
random_occupied_country Within country scope only Country random_occupied_country = { … } Executes contained effects on a random country that meets the limit and has any core states controlled by the country this is contained in. 1.9
every_enemy_country Within country scope only Country every_enemy_country = { … } Executes contained effects on every country that meets the limit and is at war with the country this is contained in. 1.0
random_enemy_country Within country scope only Country random_enemy_country = { … } Executes contained effects on a random country that meets the limit and is at war with the country this is contained in. 1.0
every_subject_country Within country scope only Country every_subject_country = { … } Executes contained effects on every country that meets the limit and is a subject of the country this is contained in. 1.11
random_subject_country Within country scope only Country random_subject_country = { … } Executes contained effects on a random country that meets the limit and is a subject of the country this is contained in. 1.11
every_state Always usable State/s every_state = { … } Executes contained effects on every state that meets the limit. 1.0
random_state Always usable State
random_state = {
    prioritize = { 123 321 } #optional
    …    #effects to run
}
Executes contained effects on a random state that meets the limit. 1.0
every_neighbor_state Within state scope only State every_neighbor_state = { … } Executes contained effects on every state that meets the limit and neighbours the state this is contained in. 1.0
random_neighbor_state Within state scope only State random_neighbor_state = { … } Executes contained effects on a random state that meets the limit and neighbours the state this is contained in. Does not support prioritizing. 1.0
every_owned_state Within country scope only State every_owned_state = { … } Executes contained effects on every state that meets the limit and is owned by the country this is contained in. 1.0
random_owned_state Within country scope only State
random_owned_state = {
    prioritize = { 123 321 } #optional
    …    #effects to run
}
Executes contained effects on a random state that meets the limit and is owned by the country this is contained in. 1.0
every_core_state Within country scope only State every_core_state = { … } Executes contained effects on every state that meets the limit and is a core of the country this is contained in. 1.11
random_core_state Within country scope only State
random_core_state = {
    prioritize = { 123 321 } #optional
    …    #effects to run
}
Executes contained effects on a random state that meets the limit and is a core of the country this is contained in. 1.11
every_controlled_state Within country scope only State every_controlled_state = { … } Executes contained effects on every state that meets the limit and is controlled by the country this is contained in. 1.9
random_controlled_state Within country scope only State
random_controlled_state = {
    prioritize = { 123 321 } #optional
    …    #effects to run
}
Executes contained effects on a random state that meets the limit and is controlled by the country this is contained in. 1.9
random_owned_controlled_state Within country scope only State
random_owned_controlled_state = {
    prioritize = { 123 321 } #optional
    …    #effects to run
}
Executes contained effects on a random state that meets the limit and is owned and controlled by the country this is contained in. 1.3
every_unit_leader Within country scope only Unit Leader every_unit_leader = { … } Executes contained effects on every unit leader (corps commanders, field marshals, admirals) that meets the limit and is recruited by the country this is contained in. 1.5
random_unit_leader Within country scope only Unit Leader random_unit_leader = { … } Executes contained effects on a random unit leader (corps commanders, field marshals, admirals) that meets the limit and is recruited by the country this is contained in. 1.5
every_army_leader Within country scope only Unit Leader every_unit_leader = { … } Executes contained effects on every army leader that meets the limit and is recruited by the country this is contained in. 1.5
random_army_leader Within country scope only Unit Leader random_army_leader = { … } Executes contained effects on a random army leader that meets the limit and is recruited by the country this is contained in. 1.5
global_every_army_leader Always usable Unit Leader global_every_army_leader = { … } Executes contained effects on every army leader that meets the limit. Preferable to use every_army_leader unless necessary to use global_every_army_leader. 1.5
every_navy_leader Within country scope only Unit Leader every_navy_leader = { … } Executes contained effects on every navy leader that meets the limit and is recruited by the country this is contained in. 1.5
random_navy_leader Within country scope only Unit Leader random_navy_leader = { … } Executes contained effects on a random navy leader that meets the limit and is recruited by the country this is contained in. 1.5
every_operative Within country scope or operations only Operative every_operative = { … } Executes contained effects on every operative that meets the limit and is recruited by the country this is contained in. 1.9
random_operative Within country scope or operations only Operative random_operative = { … } Executes contained effects on a random operative that meets the limit and is recruited by the country this is contained in. 1.9
every_character Within country scope only Character every_character = { … } Executes contained effects on every character that meets the limit and is recruited by the country this is contained in. 1.11
random_character Within country scope only Character random_character = { … } Executes contained effects on a random character that meets the limit and is recruited by the country this is contained in. 1.11
every_country_division Within country scope only Division every_country_division = { … } Executes contained effects on every division that meets the limit and is owned by the current country. 1.12
random_country_division Within country scope only Division random_country_division = { … } Executes contained effects on a random division that meets the limit and is owned by the current country. 1.12
every_state_division Within state scope only Division every_state_division = { … } Executes contained effects on every division that meets the limit and is located within the current state. 1.12
random_state_division Within state scope only Division random_state_division = { … } Executes contained effects on a random division that meets the limit and is located within the current state. 1.12
every_military_industrial_organization Within country scope only MIO every_military_industrial_organization = { … } Executes contained effects on every MIO within the current country that meets the limit. 1.13
random_military_industrial_organization Within country scope only MIO random_military_industrial_organization = { … } Executes contained effects on a random MIO within the current country that meets the limit. 1.13
every_purchase_contract Within country scope only Purchase contract every_purchase_contract = { … } Executes contained effects on every purchase contract within the current country that meets the limit. 1.13
random_purchase_contract Within country scope only Purchase contract random_state_division = { … } Executes contained effects on a random purchase contract within the current country that meets the limit. 1.13
party_leader Within country scope only Character
party_leader = {
    limit = {
        has_ideology = liberalism
    }
    set_nationality = BHR
}
Executes the effects on the party leader with the specified ideology type. Must contain a has_ideology in the limit that refers to a specific ideology type (e.g. Despotic), not a group that contain the type (e.g. Non-Aligned). The selected character must be the leader of a party corresponding to the ideology group. 1.11

NOTE: Some of these scopes may have no countries/states that match the criteria

Effects with scopes

Effects that change the scope include the following:

Dual scopes

The following scopes can be used either as effect or trigger scopes; some can also be used as the right side of some effects and triggers as a target. If usage as a target is possible, it's marked within the table.

Several dual scopes may have a scope that varies depending on where it's used, such as variables, which can be set to anything.

Dual scopes:
Name Usage Target type Example Description Usable as target Version Added
TAG Always usable Country scope SOV = { country_event = my_event.1 } The country defined by the tag or tag alias. Tag aliases are defined in /Hearts of Iron IV/common/country_tag_aliases, as a way to refer to a specific country (such as a side in a civil war) in addition to its actual tag. If the country with the exact tag doesn't exist, but a dynamic country originating from the specified tag does, the scope will refer to the dynamic country. 1.0
<state_id> Always usable State scope 123 = { transfer_state_to = SCO } The state defined by this id. 1.0
<character> not within Character scope Character scope ENG_theodore_makhno = { set_nationality = UKR } On game versions prior to 1.12.8, the character must be already recruited by the country this is scoped from. 1.11
mio:<MIO> Always usable MIO scope mio:AST_cockatoo_doe_organization = { … } The MIO identified by that ID as defined within the /Hearts of Iron IV/common/military_industrial_organization/organizations/*.txt file. 1.13
ROOT Always usable Depends on usage
ENG = {
    FRA = {
        GER = {
            declare_war_on = {
                target = ROOT
                type = annex_everything
            }
        }
    }
} #GER declares war on ENG (if there is no scope before ENG)
Targets the root node of the block, an inherent property of each block. Most commonly, this is the default scope: for example, ROOT within a national focus will always refer to the country doing the focus and ROOT within a event will always refer to the country getting the event. However, some blocks do distinguish between the default scope and ROOT, such as certain scripted GUI contexts or certain on actions. If a block doesn't have ROOT defined (such as on_startup in on actions), then it is impossible to use it. 1.0
THIS Always usable Depends on usage
set_temp_variable = { target_country = THIS }
Targets the current scope where it's used. For example, when used in every_state, it will refer to the state that's currently being evaluated. Primarily useful for variables (as in the example, where omitting it wouldn't work) or for built-in localisation commands, where some scope must be specified. More rarely, this may help with scope manipulation when using PREV. Since omitting it makes no difference in how the code gets interpreted, there is little to no usage outside of these cases. 1.0
PREV Always usable Depends on usage
FRA = {
    random_country = {
        GER = {
            declare_war_on = {
                target = PREV
                type = annex_everything
            }
        }
    }
} #Germany declares war on random_country
Targets the scope that the current scope is contained in. Can have additional applications where the assumed default scope differs from the ROOT, such as in state events or some on_actions. Can be chained indefinitely as PREV.PREV. Commonly results in broken-looking tooltips: what's shown to the player doesn't always correlate with reality.

See also: PREV usage.

1.0
FROM Always usable Depends on usage
declare_war_on = {
    target = FROM
    type = annex_everything
}

FROM = {
    load_oob = defend_ourselves
}
Can be chained indefinitely as FROM.FROM. Used to target various hardcoded scopes inherent to the block, often a secondary scope in addition to ROOT. For example:

In events, this refers to the country that sent the event (i.e. if the event was fired using an effect, then it's the ROOT scope where it was fired).
In targeted decisions or diplomacy scripted triggers, this refers to the scope that is targeted.

1.0
overlord Within country scope only Country scope overlord = { … } The overlord of the country if it is a subject. Subject to the 'invalid event target' error. X 1.3
faction_leader Within country scope only Country scope faction_leader = { add_to_faction = FROM } Faction leader of the faction the country is a part of. Subject to the 'invalid event target' error. X 1.10.1
owner Within state, character, or combatant scope only Country scope owner = { add_ideas = owns_this_state } In state scope, the country that owns the state. In combatant scope, the country that owns the divisions. In character scope, the country that has recruited the character. Subject to the 'invalid event target' error when used for a state. X 1.0
controller Within state scope only Country scope
controller = { 
    ROOT = {
        create_wargoal = {
            target = PREV
            type = take_state_focus
            generator = { 123 }
        }
    }
}
The controller of the current state. Subject to the 'invalid event target' error. X 1.0
capital_scope Within country scope only State scope capital_scope = { … } The state where the capital of the current country is located in. Subject to the 'invalid event target' error in rare cases. X 1.0
event_target:<event_target_key> Always usable Depends on usage event_target:my_event_target = { … } Saved event target or global event target, with no space after the colon. Subject to the 'invalid event target' error. 1.0
var:<variable> Always usable Depends on usage var:my_variable = { … }
add_to_faction = my_variable or
add_to_faction = var:my_variable
Variable set to a scope.

When used as a target rather than a scope, the var: can be omitted in most cases.

1.5


Any scope

Can be used in country, state or character scopes.

General

General any-scoped effects:
Name Parameters Examples Description Notes Version Added
add_dynamic_modifier modifier = <modifier_string>
The name of the Modifier.
scope = <country>
If you specify it, your dynamic modifier will be scoped to this scope. Optional.
days = x
The modifiers will be removed after x days have passed. Optional.
add_dynamic_modifier = {
    modifier = example_dynamic_modifier
    scope = GER
    days = 14
}
Adds a dynamic modifier to the specified scope (the default scope is ROOT).
It will be updated daily, unless forced to update early by force_update_dynamic_modifier effect.
Examples can be found in /Hearts of Iron IV/common/dynamic_modifiers/*.txt. Any modifiers that use variables within of the dynamic modifier will not show up in the tooltip of this effect, while those that are set to a static value will. 1.6
remove_dynamic_modifier modifier = <modifier_string>
The name of the Modifier.
remove_dynamic_modifier = { modifier = sabotaged_ressources }
Removes a dynamic modifier from the current scope Examples can be found in /Hearts of Iron IV/common/dynamic_modifiers/*.txt 1.6
force_update_dynamic_modifier <bool>
Boolean.
force_update_dynamic_modifier = yes
Forces an update to the effects given by variables within dynamic modifiers. An update is done daily by default; this can be used if the applied values need to be changed urgently, such as if modifiers are checked or used later in the effect block. 1.6
set_global_flag <flag>
An unique string to identify the global flag with.

OR
flag = <flag>
The flag to set.
days = <int>
Sets the flag to last for the specified amount of days. Optional.
value = <int>
The new value of the flag on the scale from -2 147 483 648 to 2 147 483 647.

set_global_flag = my_flag
set_global_flag = {
    flag = my_flag
    days = 123
    value = 1
}
Defines a global flag. No tooltip is shown. The flag in this effect is used in the meaning of 'boolean flag', used to store information. 1.0
play_song <song title from .asset>
A music file located in the music folder and .asset
play_song = "general_peace_1"
Plays an audio track The song must be defined in a music station in order to work. More information can be found in the Music modding page. If you wish to simply play a sound, the sound_effect effect should be used instead.

The song will start playing for every country if the effect is executed. See scoped_play_song if only one country should have the song.

1.9.3
clr_global_flag <flag>
The unique string of a global flag to clear.
clr_global_flag = my_flag
Clears a defined global flag. No tooltip is shown 1.0
modify_global_flag flag = <flag>
The flag to modify.

value = <value>
The value to add to the flag. Defaults to 0.
days = <int>
The amount of days that the flag should last for before being cleared. Optional, defaults to permanent.

modify_global_flag = {
    flag = my_flag
    value = 3
}
Adds an integer value to a flag. The flag must be already set. 1.3
custom_effect_tooltip <string>
A localized string to display in the tooltip.
custom_effect_tooltip = my_tooltip_tt
Displays a localized key in the effect tooltip. 1.0
effect_tooltip <string>
effect_tooltip = {
    declare_war_on = {
        target = FRA
    }
}
Displays the effects in the tooltip without executing them.
log <string>
An string to in the game.log
log = "myVariable: [?myVariable]"
Displays a string in the user directory's /Hearts of Iron IV/logs/game.log file when executed, as well as showing up in the console if it is open when the logging effect was executed. Accepts all localisation commands (e.g. [Root.GetName], [GetDateText], etc) 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
sound_effect <string>
A sound reference from an .asset file.
sound_effect = "boom"
Plays the specified sound once. The sound effect must be properly defined in /Hearts of Iron IV/sound/ See also: Sound modding.

The sound will play for every country if the effect is executed. See scoped_sound_effect if only one country should hear it.

1.0
randomize_weather <int>
A seed integer.
randomize_weather = 12345
Randomizes the weather with the specified seed. 1.0
set_province_name id = <id>
The id of the province to be changed.

name = <string>
The name to change the province to.

set_province_name = {
    id = 325
    name = LOC_KEY
}
set_province_name = { id = 325 name = "New Name" }
Changes the specified province/victory point's name to the specified name. Localisation keys are to be defined in /Hearts of Iron IV/localisation/*_l_<language>.yml 1.3
reset_province_name <id>
The id of the province to reset.
reset_province_name = 325
Resets the specified province's name. 1.3
damage_units province = <id>
Province where to damage units.

state = <id>
State where to damage units.
region = <id>
Strategic region where to damage units.
limit = { <triggers> }
Will only delete units if the triggers within are met for the country that owns the units.
damage = <fraction>
The percentage of damage done to units.
org_damage = <fraction>
The percentage of damage done to units to organisation in particular.
str_damage = <fraction>
The percentage of damage done to units to strength in particular.
ratio = <yes>
Will damage a ratio damage to total organisation/strength of unit if set.
template = <string>
If specified, requires the template name to match.
army = <bool>
Will damage the army units.
navy = <bool>
Will damage the navy units.

damage_units = {
    province = 42
    state = 5
    region = 5
    limit = { has_country_flag = TAG_test }
    damage = 0.5
    org_damage = 0.5
    str_damage = 0.5
    ratio = yes
    template = "template_name"
    army = no
    navy = yes
}
Damages units in the specified area. 1.11
create_entity entity = <gfx_entry>
The entity to spawn, defined within /Hearts of Iron IV/gfx/entities/*.asset files.

id = int
A number ID which can be referred to by other effects. Optional.
var = <variable>
If provided, the id of the entity will be stored using this variable. Optional.
x = <int>
The X position of the entity.
y = <int>
The Y position of the entity.
z = <int>
The Z position of the entity.
province = <int>
The province the middle of which to use as the entity's position.
state = <int>
The state the middle of which to use as the entity's position.
rotation = <decimal>
The rotation of the entity in radians.
scale = <decimal>
The size of the entity.
min_zoom = <decimal>
Minimum zoom level needed to be able to see the entity.
visible = <scripted_trigger>
The scripted trigger that must be met for a country for it to see the entity.

create_entity = {
    entity = entity_name
    id = 123
    var = var_name
    x = 42
    y = 21
    z = 3
    province = 123
    state = 42
    rotation = 1.2
    scale = 10.0
    min_zoom = 100.0
    visible = scripted_trigger_name
}
Creates an entity. Uses the the same coordinate system that the map uses. A positive change in rotation results in counter-clockwise rotation, a full 360 degrees rotation is approximately 6.28 radians. For comparison, default minimum zoom level (closest to the map) is 50 units, while default maximum zoom level is 3000 units. 1.11
destroy_entity <id>
The ID of the entity to destroy.
destroy_entity = 123
Deletes an entity IDs are set by the create_entity effect. 1.11
set_entity_movement id = <ID>
The ID of the entity to modify.

ratio = <int>
Distance between starting position and target position where the entity is to be placed.
rotation = <int>
The rotation to apply after the positioning.
start and target arguments:

x = <int>
The X position of the point.
y = <int>
The Y position of the point.
z = <int>
The Z position of the point.
province = <int>
The province the middle of which to use as the point.
state = <int>
The state the middle of which to use as the point.
set_entity_movement = {
    id = 123
    start = {
        x = 42
        y = 21
        z = 3
    }
    target = {
        province = 124
    }
    ratio = 0.5
    rotation = 1.2
}
Sets the position and rotation of an entity using two coordinates. IDs are set by the create_entity effect. Uses the the same coordinate system that the map uses. A positive change in rotation results in counter-clockwise rotation, a full 360 degrees rotation is approximately 6.28 radians. 1.11
set_entity_position id = <id>
x = <int>
y = <int>
z = <int>
province = <int>
state = <int>
set_entity_position = {
  id = 123
  x = 42
  y = 21
  z = 3
  province = 123
  state = 42
}
Sets the position of an existing entity IDs are set by the create_entity effect. Uses the the same coordinate system that the map uses. 1.11
set_entity_rotation id = <ID>
The ID of the entity to modify.

rotation = <decimal>
The new angle in radians.

set_entity_rotation = {
    id = 123
    rotation = 0.23
}
Sets the currently-facing angle of an existing entity. IDs are set by the create_entity effect. A positive change results in counter-clockwise rotation, a full 360 degrees rotation is approximately 6.28 radians. 1.11
set_entity_scale id = <ID>
The ID of the entity to modify.

scale = <decimal>
The scale to change the entity to.

set_entity_scale = {
  id = 123
  scale = 5.0
}
Sets the size of an existing entity. IDs are set by the create_entity effect. 1.11
set_entity_animation id = <int>
The ID of the entity to modify.

animation = <animation_type>
The animation entry to apply.

set_entity_animation = {
    id = 123
    animation = "shoot_lasers"
}
Sets the animation of a specified entity. IDs are set by the create_entity effect. Animations are defined within the /Hearts of Iron IV/gfx/models/**/*.asset files. 1.11
build_railway level = <int>
Defaults to 1

build_only_on_allied = <bool>
No by default, if yes and in a country scope, it will only build on allied territories for the country scoped.
fallback = <bool>
Defaults to no, if yes each option will try to fallback to the next available one.
path = { <list of provinces> }
start_province = <int>
target_province = <int>
start_state = <int>
target_state = <int>
If using start state/target state, the game will pick the provinces with the best supply available. If using state province/target province, the game will link those two provinces.

build_railway = {
    level = 1
    build_only_on_allied = yes
    controller_priority = {
        base = 1
        modifier = {
            tag = MAN
            add = 2
        }
    }
    fallback = yes
    path = { 42 10 20 30 40 84 }
    start_province = 42
    target_province = 84
}
build_railway = {
    level = 1
    build_only_on_allied = yes
    controller_priority = {
        base = 1
        modifier = {
            tag = MAN
            add = 2
        }
    }
    fallback = yes
    path = { 50 10 20 30 40 100 }
    start_state = 50
    target_state = 100
}
Adds a railway level between two provinces or along a predefined path. 1.11
event_option_tooltip <option>
The name of the option.
event_option_tooltip = mtg_usa_civil_war_fascists.1.a
Shows the tooltip usually received for hovering over an event option with the specified name. ROOT and FROM scopes are swapped. 1.13
create_purchase_contract seller = <country>
The seller in the contract.

buyer = <country>
The buyer in the contract.
civilian_factories = <int>
The amount of civilian factories required by the contract.
equipment = { ... }
The equipment that the contract is for. In particular, contains these attributes:

type = <archetype>
The archetype of the equipment.
amount = <int>
The amount of the specified equipment.
create_purchase_contract = {
    seller = ROOT
    buyer = FROM
    civilian_factories = 2
    equipment = {
        type = artillery_equipment
        amount = 300
    }
}
Creates a purchase contract with the specified parameters. Allows using equipment = { ... } several times. 1.13

Border wars

These effects refer to the border wars that simulate combat on a border between two countries, with provinces where it takes place being highlighted in white. For the state-based border wars represented with orange stripes on states, see set_border_war in the state scope.

Border war-related any-scoped effects:
Name Parameters Examples Description Notes Version Added
start_border_war change_state_after_war = <bool>
Whether the state changes hands after the war.

Attacker or Defender scope
state = <id> / <variable>
The state the side is fighting on.
num_provinces = <id>
The number of provinces used in the state.
on_win = <id>
The event to fire for the side on a win.
on_lose = <id>
The event to fire for the side on a loss.
on_cancel = <id>
The event to fire for the side on a draw.
modifier = <decimal>
The modifier on combat. Defaults to 0.
dig_in_factor = <decimal>
The modifier applied to dig-in bonuses. Defaults to 1.
terrain_factor = <decimal>
The modifier applied to terrain bonuses. Defaults to 1.

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
        modifier = 0.1
        dig_in_factor = 0
        terrain_factor = 0
    }	
    defender = {
        state = 408
        num_provinces = 4
        on_win = japan_border_conflict.3
        on_lose = japan_border_conflict.2
        on_cancel = japan_border_conflict.4
    }
}
Starts a border war for the specified attacker and defender. The participating countries are the owners of the specified states.   1.5
set_border_war_data attacker = <id> / <variable>
The attacker state.

defender = <id> / <variable>
The defender state.
attacker_modifier = <id> / <variable>
The modifier applied to attacker strength.
defender_modifier = <id> / <variable>
The modifier applied to attacker strength.
combat_width = <id> / <variable>
The combat width used in the border war battle.

set_border_war_data = {
    attacker = 527
    defender = 408
    defender_modifier = 0.15
    combat_width = 100
}
Sets the bonuses or penalties for the attacker and defender in an on-going border war. Used after start_border_war.   1.5
cancel_border_war attacker = <id> / <variable>
The attacker state.

defender = <id> / <variable>
The defender state.
dont_fire_events = <bool>
Stops the events from start_border_war from firing.

cancel_border_war = {
    dont_fire_events = yes
    defender = 408
    attacker = 527
}
Cancels an on-going border war without a winner.   1.5
finalize_border_war attacker = <id> / <variable>
The attacker state.

defender = <id> / <variable>
The defender state.
attacker_win = <bool>
Makes the attacker the winner.
defender_win = <bool>
Makes the defender the winner.

finalize_border_war = {
    attacker_win = yes
    attacker = 527
    defender = 408
}
Ends an on-going border war.   1.5

Variables

This section is transcluded from Data structures § Operators

The following is a list of variable-related effects and triggers. Variable-modifying effects have an equivalent for temporary variables, with temp_variable being used instead of variable, and these temporary variable operators are also valid triggers, as described above. Every operator can be used with variables that do not exist, assuming a value of 0 unless a null-coalescing operator is used.

Variable-related arguments:
Name Parameters Examples Description Notes
set_variable var = <variable>
The variable to modify or create.

value = <decimal>/<variable>
The value to set the variable to.
tooltip = localisation_keyLocalisation used by the operation. Optional.

set_variable = {
    var = my_variable
    value = 100
    tooltip = set_var_to_100_tt
}
set_temp_variable = { temp_var = ROOT.overlord }
Sets a variable's value to the specified amount, creating it if not defined. Shortened version exists with set_variable = { <variable> = <value> }.
set_variable_to_random var = <variable>
The variable to modify or create.

min = <decimal>
The minimum possible value, defaults to 0.
max = <decimal>
The maximum possible value, defaults to 1.
integer = <bool>
Sets if the variable must be an integer or if it can be decimal. Defaults to false.

set_variable_to_random = {
    var = random_num
    max = 11
    integer = yes
}
set_temp_variable_to_random = my_var
Sets a variable's value to the specified amount, creating it if not defined. The result will be greater than or equal than the minimum and strictly less than the maximum. Shortened version exists with set_variable_to_random = <variable>, setting it to a decimal between 0 and 1. Can be used in triggers.
clear_variable <variable>
Variable to clear.
clear_variable = my_variable
Clears the value from the memory entirely. Can only be used on regular variables.
add_to_variable var = <variable>
The variable to add to.

value = <decimal>/<variable>
The value to add to the variable.
tooltip = localisation_keyLocalisation used by the operation. Optional.

add_to_variable = {
    var = my_variable
    value = 100
    tooltip = add_100_to_var_tt
}
add_to_temp_variable = { temp_var = num_owned_states }
Increases a variable's value by the specified amount, creating it if not defined. Shortened version exists with add_to_variable = { <variable> = <value> }.
subtract_from_variable var = <variable>
The variable to subtract from.

value = <decimal>/<variable>
The value to subtract from the variable.
tooltip = localisation_keyLocalisation used by the operation. Optional.

subtract_from_variable = {
    var = my_variable
    value = 100
    tooltip = sub_100_from_var_tt
}
subtract_from_temp_variable = { temp_var = num_owned_states }
Decreases a variable's value by the specified amount, creating it if not defined. Shortened version exists with subtract_from_variable = { <variable> = <value> }. Equivalent to adding a negative amount.
multiply_variable var = <variable>
The variable to multiply.

value = <decimal>/<variable>
The value to multiply the variable by.
tooltip = localisation_keyLocalisation used by the operation. Optional.

multiply_variable = {
    var = my_variable
    value = 100
    tooltip = multiply_var_by_100_tt
}
multiply_temp_variable = { temp_var = num_owned_states }
Multiplies a variable's value by the specified amount. Shortened version exists with multiply_variable = { <variable> = <value> }.
divide_variable var = <variable>
The variable to divide.

value = <decimal>/<variable>
The value to divide the variable by.
tooltip = localisation_keyLocalisation used by the operation. Optional.

divide_variable = {
    var = my_variable
    value = 100
    tooltip = divide_var_by_100_tt
}
divide_temp_variable = { temp_var = num_owned_states }
Divides a variable's value by the specified amount. Shortened version exists with divide_variable = { <variable> = <value> }.
modulo_variable var = <variable>
The variable to modulo.

value = <decimal>/<variable>
The value to modulo the variable by.
tooltip = localisation_keyLocalisation used by the operation. Optional.

modulo_variable = {
    var = my_variable
    value = 50
    tooltip = get_modulo_of_var_by_50_tt
}
modulo_temp_variable = { temp_var = num_controlled_states }
Makes the variable become the remainder of Euclidean division of the variable by the specified value. Shortened version exists with modulo_variable = { <variable> = <value> }.
round_variable <variable>
The variable to round.
round_variable = my_variable
round_temp_variable = temp
Rounds the variable towards the closest integer value. If exactly between two integers (Such as 1.5), the larger option gets chosen.
clamp_variable var = <variable>
The variable to clamp.

min = <decimal>/<variable>
The minimum value of the variable after the clamp.
max = <decimal>/<variable>
The maximum value of the variable after the clamp.

clamp_variable = {
    var = my_var
    min = 0
}
clamp_temp_variable = {
    var = my_var
    min = 0
}
Clamps the variable to ensure its value is between the two specified numbers, raising to the minimum if smaller or lowering to the maximum if larger. Either min or max can be omitted, in which case it'll not be checked. Does nothing if the variable is already in the range between min and max. This only changes the current value of the variable, it can still go beyond the minimum or the maximum after the clamp.

Arrays

参见:Arrays
Effects for modifying arrays:
Name Parameters Examples Description Notes
add_to_array array = <array>
The array to modify.

value = <decimal>/<variable>
The variable to add.
index = <integer>
The index to place the variable on in the array. Optional, defaults to the end of the array.

add_to_array = {
    array = global.my_countries
    value = THIS.id
}
add_to_temp_array = { temp_states = THIS }
Adds an element to the array either at the specified index, defaulting to the end otherwise. Shortened version exists with add_to_array = { <array> = <value> }.
remove_from_array array = <array>
The array to modify.

value = <decimal>/<variable>
The variable to remove. Optional.
index = <integer>
The index to remove the variable from in the array. Optional.

remove_from_array = {
    array = global.my_countries
    index = 0
}
remove_from_temp_array = { temp_states = THIS }
Removes an element from the array with the specified value or index. Shortened version exists with remove_from_array = { <array> = <value> }. If neither value nor index are specified, then the last element is deleted.
clear_array <array>
The array to clear.
clear_array = global.my_countries
clear_temp_array = temp_states
Clears the array, removing every element inside.
resize_array array = <array>
The array to modify.

value = <decimal>/<variable>
The variable to add to the array if the size is larger than the array's current size. Optional, defaults to 0.
size = <integer>
The amount of elements inside of the array after the resizing.

resize_array = {
    array = global.countries_by_states
    value = 10
    size = global.countries^num
}
resize_temp_array = { temp_states = 20 }
Resizes the array, removing or adding elements in the end if necessary. Shortened version exists with resize_array = { <array> = <size> }.
find_highest_in_array array = <array>
The array to modify.

value = <variable>
The temporary variable where the largest value will get stored.
index = <variable>
The temporary variable where the index of the largest value will get stored.

find_highest_in_array = {
    array = global.countries_by_states
    value = temp_largest_country
    index = temp_country_index
}
Finds the largest value in the array and assigns its value and index to a temporary variable. Either value or index are optional to specify.
find_lowest_in_array array = <array>
The array to modify.

value = <variable>
The temporary variable where the smallest value will get stored.
index = <variable>
The temporary variable where the index of the smallest value will get stored.

find_lowest_in_array = {
    array = global.countries_by_states
    value = temp_largest_country
    index = temp_country_index
}
Finds the smallest value in the array and assigns its value and index to a temporary variable. Either value or index are optional to specify.

Country scope

The effects here must be used within a country scope.

General

General country-scoped effects:
Name Parameters Examples Description Notes Version Added
set_country_flag <flag>
An unique string to identify the country flag with.

OR
flag = <flag>
The flag to set.
days = <int>
Sets the flag to last for the specified amount of days. Optional.
value = <int>
The new value of the flag on the scale from -2 147 483 648 to 2 147 483 647.

set_country_flag = my_flag
set_country_flag = {
    flag = my_flag
    days = 123
    value = 1
}
Defines a country flag. No tooltip is shown. The flag in this effect is used in the meaning of 'boolean flag', used to store information. In order to change the flag that represents the country, see cosmetic tags. 1.0
clr_country_flag <flag>
The unique string of a country flag to clear.
clr_country_flag = my_flag
Clears a defined country flag.   1.0
modify_country_flag flag = <flag>
The flag to modify.

value = <value>
The value to add to the flag. Defaults to 0.
days = <int>
The amount of days that the flag should last for before being cleared. Optional, defaults to permanent.

modify_country_flag = {
    flag = my_flag
    value = 3
}
Adds an integer value to a flag. The flag must be already set. 1.3
country_event id = <event>
The event to fire.

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

country_event = {
    id = my_event.1
    days = 10
    random_hours = 12
    random_days = 10
}
country_event = my_event.1
Fires the specified event for the current country. Where triggers do not need to be repeatedly checked random can be a performance light alternative to mean_time_to_happen for scheduling events. Shortened variant exists if the event's ID is used instead of arguments. 1.0
news_event id = <event>
The event to fire.

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

news_event = {
    id = my_event.1
    days = 10
    random_hours = 12
    random_days = 10
}
news_event = my_event.1
Fires the specified news event for the current country. The news event uses a different interface to the country event.

Where triggers do not need to be repeatedly checked random can be a performance light alternative to mean_time_to_happen for scheduling events. Shortened variant exists if the event's ID is used instead of arguments.

1.0
set_cosmetic_tag <string>
The cosmetic tag to switch to.
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.

desc = <localisation key>
The localisation used as the description for why the rule is set.

set_rule = {
    desc = TAG_my_rule_description
    can_create_factions = yes
}
Toggles the special game rules for the current scope. Note: each rule can only be toggled a few times before a reload is required.
Game rule list 
The following game rules exist as possible options:
Internal name Localised name Notes
can_access_market Can access International Market (Puppets and Overlords can always access each other's market)
can_be_spymaster Can be Spy Master
can_boost_other_ideologies Can boost popularity of other ideologies
can_boost_own_ideology Can boost own party popularity in other countries
can_create_collaboration_government Can create collaboration governments
can_create_factions Can Create Factions
can_declare_war_on_same_ideology Can declare war on country with the same ideology group without a war goal
can_declare_war_without_wargoal_when_in_war Can declare war on a neighbor without a wargoal when at war with a major
can_decline_call_to_war Can decline call to war
can_force_government Can force government of another country to adopt the same ideology
can_generate_female_aces Women in your country are allowed to become military pilots
can_generate_female_country_leaders Can generate female country leaders
can_generate_female_unit_leaders Can generate female unit leaders
can_guarantee_other_ideologies Can guarantee other ideologies
can_join_factions Can join factions
can_join_factions_not_allowed_diplomacy Country's name is not allowed to join factions
can_join_opposite_factions Can Join Factions led by another Ideology
can_lower_tension Lowers World Tension with Guarantees
can_not_build_buildings CAN_NOT_BUILD_BUILDINGS Doesn't seem to work.
can_not_declare_war Can not declare wars Prevents generating wargoals, but not using existing ones.
can_occupy_non_war Can hold territory owned by a country they are not at war with
can_only_justify_war_on_threat_country Can justify war goals against a country that have not generated world tension
can_puppet Can puppet a country
can_send_volunteers Can send volunteer forces
can_use_kamikaze_pilots Can use kamikaze pilots
contributes_operatives Contributes Operatives to Spy Master: Yes Only has an effect for subjects.
units_deployed_to_overlord Control over deployed units go to overlord Only has an effect for subjects.
1.0
set_party_rule ideology = <ideology group>
Ideology group of the party.

desc = <localisation key>
A description used for the rule. Optional, defaults to being the same as default.
<rule> = <bool>
Rule's new value.

set_party_rule = {
    ideology = democratic
    desc = TAG_my_rule_description
    can_create_factions = yes
}
Toggles the special game rules for the current scope's political party. 1.12
add_relation_rule_override target = <country>
Target of the rule.

usage_desc = <localisation key>
A description used as the reason for the rule applying. Optional.
trigger = <scripted trigger>
A scripted trigger deciding when the override should be active. Optional, defaults to always true.
<rule> = <bool>
Rule's new value.

add_relation_rule_override = {
    target = SOV
    usage_desc = TAG_my_rule_description
    trigger = my_scripted_trigger
    can_access_market = yes
}
Toggles the special game rules for the current scope in diplomacy towards the specified country only, if the trigger is met. Currently can_access_market and can_send_volunteers are supported. In case of overlap, restricting actions is preferred (e.g. can_send_volunteers = no or can_not_declare_war = yes are preferred over the alternatives). In the scripted trigger, ROOT is the country with the override and FROM is the target. 1.13
remove_relation_rule_override target = <country>
Target of the rule.

usage_desc = <localisation key>
A description used as the reason for the rule applying. Optional.
trigger = <scripted trigger>
A scripted trigger for identifying the relation rule.
<rule> = <bool>
Rule's new value.

remove_relation_rule_override = {
    target = SOV
    usage_desc = TAG_my_rule_description
    can_access_market = yes
}
Removes the toggle added with add_relation_rule_override. 1.13
scoped_sound_effect <string>
A sound reference from an .asset file.
scoped_sound_effect = "boom"
Plays the specified sound once only for the current country. The sound effect must be properly defined in /Hearts of Iron IV/sound/ More info can be found in the Sound modding article. 1.6
scoped_play_song <song title from .asset>
A music file located in the music folder and .asset
scoped_play_song = "general_peace_1"
Plays an audio track for the specified country only. The song must be defined in a music station in order to work. More information can be found in the Music modding page. If you wish to simply play a sound, the scoped_sound_effect effect should be used instead. 1.9.3
goto_province <id>
The id of the province go to.
goto_province = 325
Moves the camera position over the specified province. 1.0
goto_state <state> / <variable>
The id of the state go to.
goto_state = 1
goto_state = var:some_state
Moves the camera position over the specified state. 1.0
change_tag_from <country> / <variable>
The country to change from.
change_tag_from = ROOT
change_tag_from = var:from.country
Switches the player to the current scope from the target scope. Nothing happens if the target scope is controlled by AI. The country the player becomes needs to be the scope in which the command is used. For example, ABC = { change_tag_from = XYZ } will make the player controlling XYZ play as ABC instead. 1.0
reserve_dynamic_country <bool>
reserve_dynamic_country = yes
Reserves the dynamic country, making sure that it does not get recycled for civil war even if it does not exist. Usually used in combination with create_dynamic_country. 1.9
force_update_map_mode limit = { ... }
Triggers required for the map mode to refresh. Optional.

mapmode = <id>
The ID of the custom map mode.

force_update_map_mode = {
    limit = {
        is_ai = no
    }
    mapmode = my_map_mode
}
Forcefully refreshes the specified mapmode for the player, rather than waiting for a daily update. Map modes are defined in /Hearts of Iron IV/common/map_modes/*.txt 1.11
add_ai_strategy type = <type>
The type of strategy.

id = <country>
What country the strategy is against.
value = <int>
The weighting added by the strategy.

add_ai_strategy = {
    type = alliance
    id = GER
    value = 200
}
Sets an AI strategy for the current scope. See AI Modding for more details. 1.0
create_dynamic_country original_tag = <tag>
The original tag to be used by the country.

copy_tag = <tag>
If specified, copies stuff from this tag rather than the original tag.
<effects>
Effects that will be executed on the new dynamic country.

create_dynamic_country = {
    original_tag = POL
    copy_tag = SOV
    add_political_power = 100
    transfer_state = 123
}
Creates a new dynamic country, akin to ones used in civil wars. The reserve_dynamic_country effect can be used if the dynamic country does not yet exist in order to ensure that it does not get overwritten by other creations of dynamic countries. If this is not done, the dynamic country will immediately stop existing if no states are transferred in the same scope.

Every state of the original country immediately gets set as a dynamic country's core: if that's unneeded, the cores would need to be removed after creation.

1.9

States

These effects in particular are country-scoped effects that are related to states rather than effects within the state scope.

State-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
add_state_core <state> / <variable>
The state to add core to.
add_state_core = 345
Adds a core for the current scope to the specified state.   1.0
remove_state_core <state> / <variable>
The state to remove core from.
remove_state_core = 345
Removes the core of the current scope from the specified state.   1.0
set_capital state = <state> / <variable>
The state to make capital.

remember_old_capital = no
Whether the old capital gets "remembered", making the country change to it in case the current capital is lost.

set_capital = {state = 345}


set_capital = {
  state = 345
  remember_old_capital = no
}
Makes the specified state the current scope's capital state. Syntax has been changed in 1.11.

It was "set_capital = 345"


Old capital is remembered, if not specified otherwise.

1.0
add_state_claim <state> / <variable>
The state to add a claim to.
add_state_claim = 345
Adds a claim for the current scope on the specified state.   1.0
remove_state_claim <state> / <variable>
The state to remove the claim from.
remove_state_claim = 345
Removes a claim of the current scope from the specified state.   1.0
set_state_owner <state> / <variable>
The state to change ownership of.
set_state_owner = 345
Makes the current scope the owner of the specified state. This can fail to carry over the control, so it's recommended to instead use transfer_state unless transferring the ownership without transferring over the control. 1.0
set_state_controller <state> / <variable>
The state to change controller of.
set_state_controller = 345
Makes the current scope the controller of the specified state. 1.0
transfer_state <state> / <variable>
The state to change owner and controller of.
transfer_state = 345
Makes the current scope the owner and controller of the specified state. transfer_state_to exists as a state-scoped variant. 1.0
set_province_controller <id>
The province to change controller of.
set_province_controller = 2999
Changes the controller of the specified province to the current scope. A peace conference or the controller being at peace will reset the control of the province to the owner unless the controller is at war with the owner. 1.0

Mana

Mana in this usage means political power, stability, war support, and other values in the topbar. Fuel is, instead, in the resources section, while convoys can be added/removed with add_equipment_to_stockpile.

Mana-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
add_political_power <int> / <variable>
The amount to add.
add_political_power = 100
add_political_power = var:my_var
Adds the specified amount of political power to the current scope.   1.0
set_political_power <int> / <variable>
The amount to add.
set_political_power = 100
Sets the specified amount of political power for the current scope.   1.0
add_stability <int> / <variable>
The amount to add.
add_stability = 0.1
Adds to the current stability value for the current scope. Stability values are between 0 and 1. 1.5
set_stability <int> / <variable>
The amount to add.
set_stability = 0.5
Sets the current stability value for the current scope. Stability values are between 0 and 1. 1.5
add_war_support <int> / <variable>
The amount to add.
add_war_support = 0.1
Adds to the current war support value for the current scope. War Support values are between 0 and 1. 1.5
set_war_support <int> / <variable>
The amount to set.
set_war_support = 0.5
Sets the current war support value for the current scope. War Support values are between 0 and 1. 1.5
add_command_power <int> / <variable>
The amount to add.
add_command_power = 100
Adds the specified amount of command power to the current scope.   1.5
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
air_experience <float> / <variable>
The amount to add.
air_experience = 10
Adds the specified amount of air experience to the current scope.   1.0

Politics

Political country-scoped effects:
Name Parameters Examples Description Notes Version Added
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.
long_name = <string>
The long name of the country's new ruling party, appearing when hovering over it. Optional.
name = <string>
The name of the country's new ruling party. Optional.

set_politics = {
    ruling_party = democratic
    elections_allowed = no
    last_election = "1935.12.17"
    election_frequency = 48
    long_name = TAG_party_long
    name = TAG_party
}
Sets the political status of the country, including the ruling party and elections. Before 1.7, included parties = { ... } for assigning party popularities, which has been moved to set_popularities 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
add_popularity ideology = <ideology/tag>
The party to change. If using a tag, uses that tag's ruling party.

popularity = <int> / <variable>
The amount of popularity to change.

add_popularity = {
    ideology = fascism
    popularity = -0.5
}
Adjusts the popularity for the specified party in the current scope. Values used are 0 to 1.


You can use ideology = ROOT to increase the popularity of the currently ruling party.

1.0
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>
The party to change.

long_name = <string>
The new full name for the party.
name = <string>
The new short name for the party.

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. The name appears in the country politics/diplomacy view, the long name appears in the tooltip when hovering over the party. 1.0
hold_election <country>
The country to hold an election for.
hold_election = ROOT
Executes the events in the on_new_term_election on action for the current scope. 1.0

Balance of power

Balance of power is defined in /Hearts of Iron IV/common/bop/*.txt files.

Balance of power-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
set_power_balance id = <BoP ID>
Balance of power to set/modify.

left_side = <BoP side ID>
The left side of the BoP.
right_side = <BoP side ID>
The right side of the BoP.
set_default = <bool>
Resets the BoP to the initial state defined in the file. Optional, defaults to false.
set_value = <decimal>
The new value of the BoP. Optional, defaults to not changing the value.

set_power_balance = {
    id = my_bop
    left_side = my_bop_left_side
    right_side = my_bop_right_side
}
Sets a new balance of power or edits the existing one. Necessary for a balance of power to appear. For the default state, initial_value, left_side, and right_side directly inside of the BoP are read. 1.12
remove_power_balance id = <BoP ID>
Balance of power to modify.
remove_power_balance = {
    id = my_bop
}
Removes the balance of power in entirety. 1.12
add_power_balance_value id = <BoP ID>
Balance of power to modify.

value = <decimal>
The value to add.
tooltip_side = <BoP side ID>
The side to show in the tooltip. Optional.

add_power_balance_value = {
    id = my_bop
    value = -0.1
    tooltip_side = my_bop_side
}
Pushes the balance of power towards one side. 1.12
add_power_balance_modifier id = <BoP ID>
Balance of power to modify.

modifier = <static modifier>
The static modifier to apply.

add_power_balance_modifier = {
    id = my_bop
    modifier = my_static_modifier
}
Applies a balance of power modifier. 1.12
remove_power_balance_modifier id = <BoP ID>
Balance of power to modify.

modifier = <static modifier>
The static modifier to apply.

remove_power_balance_modifier = {
    id = my_bop
    modifier = my_static_modifier
}
Cancels a balance of power modifier. 1.12
remove_all_power_balance_modifiers id = <BoP ID>
Balance of power to modify.
remove_all_power_balance_modifiers = {
    id = my_bop
}
Cancels all balance of power modifiers. 1.12
set_power_balance_gfx id = <BoP ID>
Balance of power to modify.

side = <BoP side ID>
The side whose GFX to change.
gfx = <sprite>
The sprite to change the GFX to.

set_power_balance_gfx = {
    id = my_bop
    side = my_bop_side
    gfx = GFX_my_bop_side_new
}
Changes the appearance of one of the sides within the balance of power. Sprites are defined within /Hearts of Iron IV/interface/*.gfx files. 1.12

Diplomacy

Diplomatic country-scoped effects:
Name Parameters Examples Description Notes Version Added
set_major <bool>
Boolean.
set_major = yes
Makes the current scope a major country.   1.0
create_faction <string>
The name of the faction.
create_faction = MY_FACTION_NAME
Creates a faction with the specified name for the current scope. The current scope and any subjects automatically join the faction.   1.0
add_to_faction <TAG>
The TAG of the nation to add to the faction of the current scope.
FACTION_LEADER_TAG = { add_to_faction = TAG_TO_ADD }
Adds the TAG_TO_ADD to the faction of the FACTION_LEADER_TAG.   1.0
leave_faction <bool>
Boolean.
leave_faction = yes
Removes the current scope from the faction they are part of.   1.5
remove_from_faction <TAG>
The target country.
remove_from_faction = TAG_TO_REMOVE
Removes the specified scope from the faction led by the current scope.   1.0
dismantle_faction <bool>
Boolean.
dismantle_faction = yes
Dismantles the faction of the current scope.   1.0
set_faction_name Sets a faction name as the loc name.
set_faction_name = SOME_LOC_KEY
Changes faction names.   1.6
set_faction_leader <bool>
set_faction_leader = yes
Sets the current country as the faction leader. 1.0
set_faction_spymaster <bool>
set_faction_spymaster = yes
Sets the current country as the faction spymaster. 1.9
release <country>
The target country.
release = GER
Releases the specified non-existent country as a free nation within the current country's owned states. The effect does nothing if the country exists. All states that are cored by the specified country will be given to it. If the current country has a core on a state transferred to the released country, the core will be lost. If looking to make a subject into an independent nation, use set_autonomy. States that are owned but not controlled will be transferred to the released country, but won't be controlled by it. 1.0
release_on_controlled <country>
The target country.
release_on_controlled = GER
Releases the specified non-existent country as a free nation within the current country's controlled states. The effect does nothing if the country exists. All states that are cored by the specified country will be given to it. If the current country has a core on a state transferred to the released country, the core will be lost. 1.9.1
release_puppet <country>
The target country.
release_puppet = GER
Releases the specified non-existent country as a puppet of the current scope within the current country's owned states. The effect does nothing if the country exists. All states that are cored by the specified country will be given to it. If the current country has a core on a state transferred to the released country, the core will be lost. States that are owned but not controlled will be transferred to the released country, but won't be controlled by it. 1.0
release_puppet_on_controlled <country>
The target country.
release_puppet_on_controlled = GER
Releases the specified non-existent country as a puppet of the current scope within the current country's controlled states. The effect does nothing if the country exists. All states that are cored by the specified country will be given to it. If the current country has a core on a state transferred to the released country, the core will be lost. 1.9.1
release_autonomy target = <country> / <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 specified non-existent country as a subject of the specified autonomy of the current scope within the current country's owned states. The effect does nothing if the country exists. All states that are cored by the specified country will be given to it. If the current country has a core on a state transferred to the released country, the core will be lost. States that are owned but not controlled will be transferred to the released country, but won't be controlled by it. The autonomy states are found in /Hearts of Iron IV/common/autonomous_states/*.txt. 1.3
give_guarantee <country>
The target country.
give_guarantee = GER
The current scope guarantees the target country. diplomatic_relation effect can be used to remove it. 1.0
give_military_access <country>
The target country.
give_military_access = GER
The current scope grants military access to the target country. diplomatic_relation effect can be used to remove it. 1.0
recall_attache <country>
The target country with an attache.
recall_attache = GER
Recalls the current scope's attaché from the specified country.   1.5
diplomatic_relation country = <country>
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
  • embargo
1.0
add_opinion_modifier target = <country>
The target country.

modifier = <modifier>
The opinion modifier to add.

add_opinion_modifier = {
    target = GER
    modifier = faction_traitor
}
The current scope gains the specified opinion modifier towards the target scope. Can also be used to modify trade relations by adding 'trade = yes' in the opinion <modifier> in /Hearts of Iron IV/common/opinion_modifiers/*.txt. If used with a trade opinion_modifier the behaviour is reversed, meaning that the target gains the trade opinion towards the current scope. Opinion modifiers are found in /Hearts of Iron IV/common/opinion_modifiers/*.txt. 1.0
remove_opinion_modifier target = <country>
The target country.

modifier = <modifier>
The opinion modifier to remove.

remove_opinion_modifier = {
    target = GER
    modifier = faction_traitor
}
The current scope loses the specified opinion modifier towards the target scope. Opinion modifiers are found in /Hearts of Iron IV/common/opinion_modifiers/*.txt. 1.0
reverse_add_opinion_modifier target = <country>
The target country.

modifier = <modifier>
The opinion modifier to add.

reverse_add_opinion_modifier = {
    target = GER
    modifier = faction_traitor
}
The target scope gains the specified opinion modifier towards the current scope. Opinion modifiers are found in /Hearts of Iron IV/common/opinion_modifiers/*.txt.
Useful for when you don't know what the current scope will be.
1.0
add_relation_modifier target = <country>
The target country.

modifier = <modifier>
The relation modifier to add.

add_relation_modifier = {
    target = SWE
    modifier = HUN_dynastic_ties_license
}
The current scope gains the specified relation modifier towards the target scope. Relation modifiers are found in /Hearts of Iron IV/common/modifiers/*.txt files, used to apply a targeted modifier with a non-static target. To change the diplomatic opinion of a country, see add_opinion_modifier. 1.4
remove_relation_modifier target = <country>
The target country.

modifier = <modifier>
The relation modifier to remove.

remove_relation_modifier = {
    target = SWE
    modifier = HUN_dynastic_ties_license
}
The current scope loses the specified relation modifier for towards the target scope. Relation modifiers are found in /Hearts of Iron IV/common/modifiers/*.txt, used to apply a targeted modifier with a non-static target. To change the diplomatic opinion of a country, see remove_opinion_modifier. 1.4
add_collaboration target = <country>
The target country.

value = <0-1>
How much collaboration to add.

add_collaboration = {
    target = TAG
    value = 0.3
}
Adds collaboration in TAG with the scoped country. 1.9
set_collaboration target = <country>
The target country.

value = <0-1>
How much collaboration will be set.

set_collaboration = {
    target = TAG
    value = 0.3
}
Sets the collaboration in TAG with the scoped country. 1.9
recall_volunteers_from <tag>
The target country.
recall_volunteers_from = SPR
Recalls volunteers sent to the specified country back to the current country. 1.9
set_occupation_law <law ID>
The new occupation law enacted by the previous scope or default_law.
USA = { GER = { set_occupation_law = foreign_civilian_oversight } } # Changes USA's occupation law for GER.
USA = { USA = { set_occupation_law = default_law } } # Changes the USA's default occupation law to the default.
Sets the occupation law of the country. PREV will be the country for whom the occupation law will be changed. If PREV is not a country, nothing changes. If PREV is the same country, changes the default occupation law. If PREV is different, default_law resets the country-specific law to the global default, otherwise it resets the default law to the occupation law with starting_law = yes in definition. 1.12
set_occupation_law_where_available <law ID>
The new occupation law enacted by the previous scope or default_law.
USA = { GER = { set_occupation_law_where_available = foreign_civilian_oversight } } # Changes USA's occupation law for GER where possible.
USA = { USA = { set_occupation_law_where_available = default_law } } # Changes the USA's default occupation law to the default where possible.
Sets the occupation law of the country. Identical to set_occupation_law, except if the law is impossible to set, tries again at every smaller sub-set: if default is impossible, tries every single individual occupied country; if the country's law is impossible to change, tries every single state within the country. 1.12
send_embargo <tag>
The target country.
send_embargo = ITA
Embargos the target country. 1.12
break_embargo <tag>
The target country.
break_embargo = ITA
Stops embargoing the target country. As of 1.14.7, this effect ignores country scoping and always applies to the ROOT, instead the diplomatic_relation effect can be used to break the embargoes of other countries. 1.12
give_market_access <tag>
The target country.
give_market_access = ITA
Opens market access between the two countries. 1.13

Autonomy

Autonomy-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
puppet <country>
The target country.

OR
target = <country>
The target country.
end_wars = <bool>
Whether the target country will peace out in all of its non-civil wars it's participating in. Defaults to true.
end_civil_wars = <bool>
Whether the target country will peace out in all of its civil wars it's participating in. Defaults to true.

puppet = GER
puppet = {
    target = ITA
    end_wars = no
}
Makes the specified country a subject of the current scope. The autonomous state picked is one which contains default = yes and where allowed = { ... } is fulfilled within the /Hearts of Iron IV/commmon/autonomous_states/ definition, rather than necessarily being autonomy_puppet. Results in a crash-to-desktop if the game is unable to find any such autonomous states. 1.0
end_puppet <country>
The target country.
end_puppet = GER
Removes the subject status between the target and the current scope. Must be used within the overlord's scope. 1.0
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's scope. 1.3
add_autonomy_score value = <float>
The freedom score to add.

localization = <string>
The localization key for the modifier.

add_autonomy_score = {
    value = 10
    localization = EXAMPLE
}
Adds an exact freedom score modifier to the current scope. Used in the subject's scope. 1.3
set_autonomy target = <country> / <variable>
The subject country.

autonomous_state = <type>
The type of autonomy state to set.
freedom_level = <float>
The new freedom level value. Optional.
end_wars = <yes/no>
Will end any wars the subject is involved in.
end_civil_wars = <yes/no>
Will end any civil wars the subject is subject to

set_autonomy = {
    target = AST
    autonomous_state = autonomy_free
    end_wars = no
    end_civil_wars = no
}
Sets the autonomy level for the specified country, including independence. The autonomy_free state will free the subject, however this effect has to be executed within the scope of the target country's current overlord for this to have effect. The autonomy states are found in /Hearts of Iron IV/common/autonomous_states/*.txt files. Although end_wars is an optional argument defaulting to no, omitting it results in the country's occupied states returning to its control, stranding enemy units. 1.3

Governments in exile

Government in exile-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
add_legitimacy Adds legitimacy to a government in exile.
add_legitimacy = 10
Adds legitimacy.   1.6
set_legitimacy Sets the legitimacy of governments in exile.
set_legitimacy = 10
Sets legitimacy.   1.6
become_exiled_in Makes a country a government in exile in a set country, with a set starting legitimacy.
become_exiled_in = { target = <Host tag> legitimacy = <0-100> (starting legitimacy, optional) }
Creates a government in exile. Must be fired from ROOT, the country that should be exiled, or a TAG specification must be used. 1.6
end_exile Ends a government in exile.
end_exile = yes
Ends a government in exile.   1.6

War

War-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
add_threat <int>
The amount to change by.
add_threat = 10
Adjusts the level of World Tension.   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 = <country>
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. Without transfering troops, the annexed country's divisions' equipment is lost. 1.0
add_to_war targeted_alliance = <country>
The country to assist.

enemy = <country>
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
}
Forces the current scope to join the war of the specified ally against the specified enemy.   1.0
declare_war_on target = <country> / <variable>
The country to attack.

type = <wargoal>
The wargoal to declare with.
generator = { <state id> }
The states to supply the wargoal (i.e. take_state_focus).

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. See also add_civil_war_target in order to assign a war between different countries to be a civil war. 1.0
white_peace <country> / <variable>
The scope to white peace.

OR
tag = <country> / <variable>
The scope to white peace.
message = <localisation key>
The reason for peace showing up in the pop-up.

white_peace = GER
white_peace = {
    tag = GER
    message = my_peace_tt
}
Makes the current scope white peace the specified scope.   1.0
start_peace_conference tag = <country> / <variable>
The scope to peace with.

score_factor = <decimal> / <variable>
The fraction of the total score awarded to the winners compared to regular victory.
message = <localisation key>
The reason for peace showing up in the pop-up. Optional.
winner_scope = <scope type>
Which countries should be present in the conference on the winner side alongside the current scope. Optional, defaults to LIMITED_FACTION.
loser_scope = <scope type>
Which countries should be present in the conference on the loser side alongside the target country. Optional, defaults to LIMITED_FACTION.

start_peace_conference = {
    tag = GER
    score_factor = 0.4
    message = my_peace_tt
}
Makes the current scope start a peace conference with the specified scope on the other side. Current scope is the winner, target and its subjects are the losers. Can only be used if at war with the target. A score_factor of 0.0 is equivalent to a whitepeace. winner_scope and loser_scope have the following possible values:
  • ALL: all countries at war with the other side.
  • FACTION: all countries in the same faction as the current scope or under its overlordship.
  • LIMITED_FACTION: includes faction members if and only if the country is a faction leader, and includes subjects of the country.
  • LIMITED: includes only subjects of the country.
1.12
set_truce target = <country>
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 = <country> / <variable>
The country to target.

type = <wargoal>
The wargoal to generate.
generator = { <state id> }
The states to supply the wargoal (i.e. take_state_focus).
expire = 365
The amount of days that the wargoal will last before expiring. If unset or set to 0, will never expire.

create_wargoal = {
    type = puppet_wargoal_focus
    target = ROOT
}
create_wargoal = {
    type = take_state_focus
    target = PREV
    generator = { 123 321 }
    expire = 90
}
Grants the current scope a wargoal against the specified country.   1.0
remove_wargoal target = <country> / <variable>
The country to target.

type = <wargoal>
The wargoal to remove. "all" will remove all wargoals.

remove_wargoal = {
    type = all
    target = ROOT
}
Removes wargoals from the current scope to the specified country.   1.10.2
start_civil_war ideology = <ideology>
The ideology of the breakaway country.

ruling_party = <ideology>
Changes the ideology of the original, player-led country, if set. Optional.
size = <float>
The size of the breakaway country and the fraction of the original stockpile and military units it will receive by default. Optional, defaults to 0.5.
army_ratio = <float>
The size of the land army that the breakaway country gets. Optional, defaults to being the same as size.
navy_ratio = <float>
The size of the naval forces that the breakaway country gets. Optional, defaults to being the same as size.
air_ratio = <float>
The size of the airforce that the breakaway country gets. Optional, defaults to being the same as size.
capital = <state>
The capital state of the breakaway country. Optional.
states = { <state> }
The states included in the breakway country. Optional, defaults to random states based off size. all will result in all states that meet the filter going to the breakaway.
states_filter = { <triggers> }
A trigger block checked for the state that must be met to be transferred to the breakaway. Optional.
keep_unit_leaders = { <unit leader id> }
List of unit leaders to be kept by their legacy_id. Optional.
keep_unit_leaders_trigger = { <triggers> }
Trigger block checked for every unit leader that forces them to be kept if they meet the triggers. The default scope is the unit leader, ROOT is the country receiving the unit leader, while FROM is the original owner of the unit leader. Optional.
keep_political_leader = <bool>
Controls if the promoted party leader (i.e. the one that'd take power if the country were to be switched to that ideology group) of the revolting ideology group will be kept by the country or join the revolt, yes resulting in the former. Optional, defaults to false.
keep_political_party_members = <bool>
Controls if non-promoted party leaders of the revolting ideology group will be kept by the country or join the revolt, yes resulting in the former. Optional, defaults to false.
keep_all_characters = yes
If true, the revolter will have no characters from the original country transferred to them. Optional, defaults to false.
<effects>
An effect block executed for the breakaway country.

start_civil_war = {
    ruling_party = communism
    # Original country's ideology changes to communism
    ideology = ROOT
    # Breakaway gets old ideology of ROOT
    size = 0.8
    capital = 282
    states = {
        282 533 536 555 529 530 528
    }
    keep_unit_leaders = {
        750 751 752
    }
    keep_political_leader = yes
    keep_political_party_members = yes
}
start_civil_war = {
    ideology = democratic
    size = 0.1
    states = all
    states_filter = {
        is_on_continent = europe
        is_capital = no
    }
    set_country_flag = TAG_my_country_tag_alias_trigger
    # Sets a country flag that gets used in a country tag alias.
}

(See country tag aliases)

start_civil_war = {
    ideology = neutrality
    size = 0.1
    army_ratio = 0.5
    navy_ratio = 0
    air_ratio = 1
    keep_unit_leaders_trigger = {
        has_trait = my_trait_name
    }
    keep_all_characters = yes
    PREV = {  # Original country
        TAG_airforce_leader = { # Character
            set_nationality = PREV.PREV
            # Transfers to breakaway
        }
    }
    promote_character = TAG_airforce_leader
}

(See usage for PREV and PREV.PREV)

Starts a civil war for the current scope with the specified parameters. states = all would include every single state controlled by the country. If the country's current capital state is set as one of the states that the revolt can gain, it won't fire. set_capital can be used to change the capital beforehand, with on_civil_war_end being used to set it back to the default after the civil war ends.

Elections will always be disallowed for the breakaway. If the ruling_party attribute is used, the original country will have its elections disallowed. In the base game files, an on action is set up to ensure that elections get allowed if the democratic side wins the civil war.

A civil war started via this effect cannot have more than two sides and the effect cannot be used in history or bookmark's effect = { ... }. For adding more sides or starting one before the game's start, this can be simulated by setting an existing war (typically originating from a dynamic country created via create_dynamic_country) as a civil war via add_civil_war_target.

1.0
add_civil_war_target <country> - The country to set as the target.
add_civil_war_target = TAG
Sets that the war between ROOT and TAG is a civil war, resulting in the victory being the annexation of the other side and setting world tension limits on intervention. ROOT and TAG must already be at war with each other for the effect to take place. 1.9
remove_civil_war_target <country> - The country to set as the target.
remove_civil_war_target = TAG
Removes the status of the war as a civil war between the pair of countries. The ongoing war must already be marked as a civil war, whether it was initiated by start_civil_war or add_civil_war_target was used to mark it as one. 1.12.13
transfer_units_fraction target = <country>
The country which should receive the units from the current scope.

size = <float>
The size of the breakaway country and the fraction of the original stockpile and military units it will receive by default. Optional, defaults to 0.5.
army_ratio = <float>
The size of the land army that the breakaway country gets. Optional, defaults to being the same as size.
navy_ratio = <float>
The size of the naval forces that the breakaway country gets. Optional, defaults to being the same as size.
air_ratio = <float>
The size of the airforce that the breakaway country gets. Optional, defaults to being the same as size.
keep_unit_leaders = { <unit leader id> }
List of unit leaders to be kept by their legacy_id. Optional.
keep_unit_leaders_trigger = { <triggers> }
Trigger block checked for every unit leader that forces them to be kept if they meet the triggers. The default scope is the unit leader, ROOT is the country receiving the unit leader, while FROM is the original owner of the unit leader. Optional.

transfer_units_fraction= {
	target = SPD
	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
	}
}
Transfers a fraction of the military to a target, including units (either type: land, navy, or air), equipment, and unit leaders. 1.9
add_nuclear_bombs Adds nuclear bomb to TAG's stockpile.
add_nuclear_bombs = 100
Adds specified number of nukes to the country's stockpile Needs the Nuke tech to use. 1.6
launch_nuke province = <ID>
The specific province to nuke.

state = <ID>
The state to nuke.
controller = <TAG>
Prioritises provinces controlled by this country.
use_nuke = <boolean>
Whether a nuke should be deducted from the country's stockpile. Defaults to false.

launch_nuke = {
    province = 1234
}
launch_nuke = {
    state = 42
    controller = GER
    use_nuke = yes
}
Nukes the specified province or a province in the needed state. If a state is set rather than the specific province, first prioritises the country set in controller, then prioritises the countries at war with the current scope, and then countries that are neutral. If set to use a nuke, then requires at least one nuclear bomb in the stockpile. 1.6

Resources

Resource-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
add_resource type = <resource>
The resource to add.

amount = <int>
The amount of resource to add.
state = <id>Which state to add the resource to. Variables can be used.
show_state_in_tooltip = <bool>
Whether the state should be shown in the tooltip. Defaults to true.

add_resource = {
    type = oil
    amount = 50
    state = 88
}
Adds the specified resource in the specified amount to the specified state. Can also be used in state scope. 1.0
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
give_resource_rights receiver = <tag>
The country that would get the resource rights.

state = <state>
The state where the resource rights are located.
resources = { <resource> <...> <resource> }
The resources to which give resource rights to. Optional, defaults to all.

give_resource_rights = { receiver = ENG state = 291 }
give_resource_rights = {
    receiver = POL
    state = 321
    resources = { oil }
}
Gives all the resources of a state to the target country The resource rights will only be provided as long as the current country controls the state with resource rights. 1.6
remove_resource_rights <state>
The state to remove current country's resource rights from.
ENG = { remove_resource_rights = 477 }
Removes given resource rights   1.6
add_fuel <int>
The fuel amount
add_fuel = 400
Adds fuel to the current country.   1.6
set_fuel <int>
Fuel amount.
set_fuel = 400
Sets country's current fuel amount.   1.6
set_fuel_ratio <decimal>
The needed ratio of fuel.
set_fuel_ratio = 0.5
Set country's current fuel ratio relative to its capacity.   1.6

Buildings

Building-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
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 (offmap) 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

National focuses

National focus-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
load_focus_tree <focus tree>
The national focus tree to load.
OR
tree = <focus tree ID>
The national focus tree to load.
keep_completed = <bool>
Whether focuses shared between the old and new trees should stay completed. Defaults to false.
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 if set. Focuses that aren't present in the newly-loaded tree will not be kept as completed for has_completed_focus checks or when loading the old tree back. 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
uncomplete_national_focus focus = <focus>
uncomplete_children = <bool>
Defaults "no". Optional.
refund_political_power = <bool>
Defaults "no". Optional.
uncomplete_national_focus = {
  focus = GER_oppose_hitler
  uncomplete_children = yes
  refund_political_power = no
}
Removes a focus from list of completed focus, and potentially all focuses requiring it as a prerequisite.
If the focus has one, the 'on_uncomplete' effect will be executed on each uncompleted focus.
1.11
mark_focus_tree_layout_dirty <bool>
Boolean.
mark_focus_tree_layout_dirty = yes
Refreshes the focus tree for the specified country, restarting the checks in allow_branch and position offsets for focuses. If put within a focus' completion reward, the focus will not be marked as complete at the time the effect is executed, leading to has_completed_focus checks specifying that focus in particular to be marked as false.

This can be bypassed by putting an effect within a hidden event fired immediately within the focus or by reloading the same focus tree with load_focus_tree set to keep completed focuses, marking the focus as complete, before using the effect.

1.9

Decisions

Decision-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
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 = <country>
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
add_days_remove decision = <decision>
The decision to add days to.

days = <int> / <variable>
The number of days to add to the decision.

add_days_remove  = {
    decision = decision_here
    days = 30
}
Adds the number of days to the timer created by a decision's days_remove. Decisions are found in /Hearts of Iron IV/common/decisions/*.txt 1.9
remove_decision Allows to remove specified decision without running remove_effect.
remove_decision = GER_MEPO
Removes a decision.   1.6
remove_decision_on_cooldown <decision>
The decision that is to be removed.
remove_decision_on_cooldown = TAG_my_decision
If the decision is on cooldown, it gets removed, in order to reactivate or remove completely. 1.11

Missions

Mission-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
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_days_mission_timeout mission = <mission>
The mission to add days to.

days = <int> / <variable>
The number of days to add to the mission.

add_days_mission_timeout = {
    mission = my_mission
    days = 20
}
Adds the number of days to the specified mission. Missions are found in /Hearts of Iron IV/common/decisions/*.txt 1.9

Technologies and doctrines

Technology-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
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 with negatives.   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, default 0.

uses = <int>
The amount of times the bonus can be used, default 1.
ahead_reduction = <float>
The cost reduction if ahead of time, default 0.
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.

name = <string>

Tooltip shown in research tabs, optional.

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 defined in /Hearts of Iron IV/common/technology_tags/*.txt files, while technologies are defined in /Hearts of Iron IV/common/technologies/*.txt files. 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 it takes to research isn't reset, meaning it can be researched in 1 day. Technologies that are mutually exclusive with other technologies can not be removed by this effect. Technologies are defined in /Hearts of Iron IV/common/technologies/*.txt files. 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.  Technology sharing groups are found in Hearts of Iron IV\common\technology_sharing\*.txt 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.  Technology sharing groups are found in Hearts of Iron IV\common\technology_sharing\*.txt 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.  Technology sharing groups are found in Hearts of Iron IV\common\technology_sharing\*.txt 1.3
inherit_technology <tag> The country to inherit technology from.
inherit_technology = CAN
Makes the current country's researched technologies be copied from the specified country. Useful when making a country independent. 1.6
add_doctrine_cost_reduction name = <name>
Tooltip showing why the doctrine has reduced cost in the doctrine menu. Optional.

cost_reduction = <fraction>
Percentage of cost reduced.
uses = <integer>
Number of times the cost reduction can be used.
category = <doctrine category>
Which doctrine category the cost reduction will apply to. (Ex: cat_mobile_warfare,land_doctrine ,air_doctrine.)

add_doctrine_cost_reduction = {
	cost_reduction = 0.5
	uses = 2
	category = land_doctrine
}
Gives bonuses of reducing land doctrine cost to current scope. Doctrines are defined in /Hearts of Iron IV/common/technologies/*.txt files.

For a general doctrine cost reduction, see "<land/air/naval>_doctrine_cost_factor" in Modifiers.

1.11

Ideas

This includes national spirits, laws, designers, and advisors (using the idea_token)

Idea-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
add_ideas <idea>
The idea to add.
add_ideas = my_idea
add_ideas = {
    my_idea_1
    my_idea_2
}
Adds the specified ideas to the current scope. Can be used as a scope to add multiple at once. 1.0
add_timed_idea idea = <idea>
The idea to add.

days = <int> / <variable>
The number of days to add the idea for.
months = <int> / <variable>
The number of months to add the idea for. A month is equal to 30 days.
years = <int> / <variable>
The number of years to add the idea for. A year is equal to 365 days.

add_timed_idea = {
    idea = my_idea
    days = 180
}
Adds the specified ideas to the current scope for the specified number of days. Either one of days, months, or years is mandatory. The tooltip will use the exact same phrasing in years/months/days as used in the attributes. 1.0
modify_timed_idea idea = <idea>
The idea to modify.

days = <int> / <variable>
The number of days to modify the idea by.
months = <int> / <variable>
The number of months to modify the idea by. A month is equal to 30 days.
years = <int> / <variable>
The number of years to modify the idea by. A year is equal to 365 days.

modify_timed_idea = {
    idea = my_idea
    days = 60
}
Extends or shortens the duration of the timed idea by the specified amount. Positives add to the time, negatives shorten it. Either one of days, months, or years is mandatory. The tooltip will use the exact same phrasing in years/months/days as used in the attributes. 1.0
swap_ideas add_idea = <idea>
The idea to add.

remove_idea = <idea>
The idea to remove.

swap_ideas = {
    remove_idea = my_idea_1
    add_idea = my_idea_2
}
Switches two ideas with a tooltip displaying any modifier differences between them. If the ideas have the same name in the localisation, it will show up as modifying the idea rather than swapping them.

The add will occur before the removal of the old idea.

1.3
remove_ideas <idea>
The idea to remove.
remove_ideas = my_idea
remove_ideas = {
    my_idea_1
    my_idea_2
}
Removes the specified idea from the current scope. Can be used as a scope to remove multiple at once. 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>
The idea to display.
show_ideas_tooltip = my_idea
Displays the specified idea in the tooltip for the current effect scope. Does not add the idea.   1.0

Units

Unit-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
load_oob <oob>
The filename of the order of battle to load, without the .txt extension.
load_oob = "GER_default"
Loads the specified order of battle for the current scope, applying the effects within. The filename with the .txt extension omitted is used as the effect's target. Orders of battle are stored within /Hearts of Iron IV/history/units/*.txt. Primarily used to spawn divisions at specified locations. 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. Sub-units are defined in /Hearts of Iron IV/common/units/*.txt files.
division_names_group = <group>
The division names group that the template will use, deciding on the automatically-generated names of any new divisions built using that template. Optional, assigns one automatically if omitted. These are defined within /Hearts of Iron IV/common/units/names_divisions/*.txt files.
is_locked = <bool>
Whether the division is locked to modification and deletion. Optional.
force_allow_recruiting = <bool>
Whether the locked template can have units deployed using it without allowing editing. Optional, only has an effect in locked templates.
division_cap = <int>
The maximum amount of divisions that this template may have; requires the template to be locked. Optional.
priority = <int>
The priority the template receives in receiving supplies. Goes from 0 to 2. Optional, 1 by default.
template_counter = <int>
The icon used by the division as an integer. Optional, defaults to the icon of the most common sub-unit within. The icons are defined as sprites within any /Hearts of Iron IV/interface/*.gfx file (By default subuniticons.gfx) with the pattern of GFX_div_templ_<int>_large and GFX_div_templ_<int>_small.
override_model = <entity>
Enforces the entity used by the units using this template to be the specified one. Optional.

division_template = {
    name = "Test"
    is_locked = yes
    division_cap = 3 
    division_names_group = USA_INF_01
    priority = 0
    template_counter = 0
    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 and start from 0. No tooltip is shown. 1.0
add_units_to_division_template template_name = <string>
The template to change. Optional if used in division scope.
regiments = {
    <unit> = <column>
}
support = {
    <unit> = <column>
}

The units to add to the template. Sub-units are defined in /Hearts of Iron IV/common/units/*.txt files.

add_units_to_division_template = {
    template_name = "Test"
    regiments = {
        infantry = 2
        infantry = 2
    }
    support = {
        military_police = 0
    }
}
Adds the specified brigades to first available slots of specified columns to the template (if possible). Columns go left-to-right starting with 0. Can also be used in division scope. 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
country_lock_all_division_template <bool>
Boolean.
country_lock_all_division_template = yes
Locks all division templates for the current scope. Used to prevent training, disbanding, and editing units. 1.9
set_division_force_allow_recruiting division_template = <string>
Template to modify.

force_allow_recruiting = <bool>
Whether to allow or disallow recruiting. Defaults to true if unset.

set_division_force_allow_recruiting = {
    division_template = "My locked template"
}
Changes whether it's possible to recruit divisions of a locked template without unlocking the template.   1.12
set_division_template_cap division_template = <string>
The name of the division template.

division_cap = <int>
The division cap.

set_division_template_cap = { 
	division_template = "Swiss Citizen Militia" 
	division_cap = SWI_militia_division_cap
}
Sets the cap of a division template. The template has to be locked first. 1.12
clear_division_template_cap division_template = <string>
The name of the division template.
clear_division_template_cap = { 
	division_template = "Swiss Citizen Militia"
}
Clears the cap on the template, allowing it to have an unlimited amount of divisions. 1.12
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 the unit must be in.

division_template = <string>
The template the units must use to be deleted.
id = <int>
The id given to the unit if created via the create_unit effect. disband = <bool>
If true, will refund equipment and manpower.

delete_unit = {
    state = 787
    disband = yes #will refund equipment and manpower
}
delete_unit = {
    division_template = "Infantry Division"
}
delete_unit = {} # Will delete all units
Deletes all units that meet the filters. No tooltip is generated. delete_units can be used if deleting all units of a specific template. 1.5
delete_units division_template = <string>
The template the units must use to be deleted.

disband = <bool>
If true, will refund equipment and manpower.

delete_units = {
    division_template = "Infantry Division"
    disband = yes
}
Deletes all units with a certain template. Generates a tooltip, unlike delete_unit. Mandatory to specify a division_template. 1.9
create_railway_gun equipment = <type>
Equipment type used by the railway gun.

name = <string>
The name used by the railway gun. Optional.
location = <province>
Location where the railway gun is created. Assumes the capital by default.

create_railway_gun = {
    equipment = railway_gun_equipment_1
	name = TAG_new_railway_gun
	location = 12406
}
Creates a railway gun. 1.11
teleport_railway_guns_to_deploy_province <boolean>
teleport_railway_guns_to_deploy_province = yes
Teleports all railway guns to the province where they get deployed. 1.11

Equipment

Equipment-related country-scoped effects:
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 automatically divides stockpiles according to the respective size. 1.0
add_equipment_to_stockpile type = <equipment>
The equipment to add. Either types and archetypes are accepted.

amount = <int> / <variable>
The amount to add.
producer = <country> / <variable>
Defines who produced the equipment. Optional, defaults to the current scope.
variant_name = <string>
The equipment variant to add. Mandatory if a variant needs to be created to produce the equipment, optional otherwise.

add_equipment_to_stockpile = {
    type = infantry_equipment
    amount = -100
    producer = GER
}
add_equipment_to_stockpile = {
    type = medium_tank_chassis_1
    amount = 100
    variant_name = "Panzer III"
}
Edits the equipment stockpile of the current scope, adds or removes equipment of a specified type or archetype. With negative numbers, optionally specifying a producer will ensure only equipment with that producer gets removed. The equipment must be unlocked by the producer for the effect to succeed. 1.0
send_equipment type = <equipment>
The equipment to add. Can be archetype.

amount = <int> / <variable>
The amount to add.
target = <country> / <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. Cannot remove equipment into negatives, in which case equipment will not be received by the target in entirety. 1.0
send_equipment_fraction value = <0-1>
How much equipment to send.

target = <country> / <variable>
Which country receives the equipment.

send_equipment_fraction = {
    value = 0.3
    target = GER
}
Sends the specified fraction of equipment to the specified target, removing said equipment from the current scope.   1.9
create_production_license target = <country>
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.
version = <int>
The version indicates which variant should be licensed. The default is 0, meaning the base variant.
new_prioritised = <boolean>
Whether new equipment is prioritised or not. Yes by default.

create_production_license = {
    target = HUN
    equipment = {
        type = fighter_equipment_1
        version = 0
        new_prioritised = no
    }
    cost_factor = 0
}
Grants the specified country a license to produce the specified equipment from the current scope.   1.4
add_equipment_subsidy cic = <int>
The amount of economic capacity required by the subsidy.

equipment_type = <archetype>
The equipment archetype that the subsidy is for.
seller_tags = { <countries }
Countries that can have the subsidy.
seller_trigger = <scripted trigger>
The trigger deciding which countries can have the subsidy.

add_equipment_subsidy = {
    cic = 300
    equipment_type = support_equipment
    seller_tags = { BHR }
}
add_equipment_subsidy = {
    cic = 1000
    equipment_type = infantry_equipment
    seller_trigger = my_scripted_trigger
}
Creates an equipment subsidy on the international market. seller_tags and seller_trigger are mutually exclusive. In the scripted trigger, ROOT is the country with the subsidy and FROM is the seller. 1.13
add_cic <int>
The amount of economic capacity to add.
add_cic = 300
Modifies the economic capacity bank on the international market. The economic capacity will be capped to 0 if the total after the effect is negative. 1.13
create_equipment_variant name = <string>
The name of the variant.

type = <equipment>
The equipment type the variant is of.
parent_version = <int>
Ordering for multiple variants of the same equipment. 0 is the oldest, 1 is the second-oldest, etc. Optional, 0 by default.
obsolete = <bool>
Whether the equipment variant is flagged as obsolete within the GUI and for AI. Optional, no by default.
mark_older_equipment_obsolete = <bool>
Marks all older (non-chassis) equipment variants as obsolete as long as the following matches: Archetype, niche, mission set (for planes). Optional, defaults to false.
name_group = <name group>
The name group used for equipment. Stored in /Hearts of Iron IV/common/units/names_ships. Optional, can only be defined for ships.
role_icon_index = <int>/auto
Index of the role icon that will be used, as an integer. If set to "auto", will pick automatically. If set to 0, will be unset. Optional, only can be defined for ships.
model = <model name>
Model that will be used by the equipment on the world map. Optional.
icon = <sprite>
The icon that will be used by equipment. Stored as a spriteType within /Hearts of Iron IV/interface/*.gfx. Optional.
design_team = mio:<MIO>
The military industrial organisation that should be set as the designer of the equipment. Optional.
allow_without_tech = <bool>
If set, bypasses the requirement that the equipment that the variant is for must be unlocked through research. Optional, defaults to false.
Upgrade scope
<upgrade> = <amount>
The upgrades configuration for the variant.
Module scope
<slot> = <module>
The modules configuration for the variant.

create_equipment_variant = {
    name = "Vetehinen Class"								
    type = ship_hull_submarine_1
    name_group = FIN_SS_HISTORICAL
    role_icon_index = 1
    modules = {
        fixed_ship_torpedo_slot = ship_torpedo_sub_1
        fixed_ship_engine_slot = sub_ship_engine_1
        rear_1_custom_slot = ship_mine_layer_sub
    }
}
create_equipment_variant = {
    name = "He 112"
    type = fighter_equipment_0
    obsolete = yes
    upgrades = {
        plane_gun_upgrade = 1
        plane_range_upgrade = 1
    }
}
create_equipment_variant = {
    name = "Light Tank Mk. IV"
    type = light_tank_chassis_1
    parent_version = 1
    modules = {
        main_armament_slot = tank_heavy_machine_gun
    }
    upgrades = {
        tank_nsb_engine_upgrade = 2
    }
    icon = "GFX_ENG_basic_light_tank_medium"
    model = ENG_MKIV_light_tank_entity
    design_team = mio:ENG_vauxhall_organization
}
Creates the specified equipment variant for the current scope. Role icons for ships are defined in /Hearts of Iron IV/gfx/army_icons/army_icons.txt.

Upgrades are defined within /Hearts of Iron IV/common/units/equipment/upgrades/*.txt.
Equipment types, including module slots for them, are defined within /Hearts of Iron IV/common/units/equipment/*.txt.
Equipment modules are defined within /Hearts of Iron IV/common/units/equipment/modules/*.txt.

1.0
add_equipment_production amount = <int>
The amount to produce before automatically stopping. 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.
name = <string>
The name that'll be used for the equipment, such as with ships. Optional.
industrial_manufacturer = mio:<MIO>
The military industrial organisation that's set as the equipment's designer.
Equipment scope
type = <equipment>
The name of the equipment to produce.
creator = <country>
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

Military

Military-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
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 = <country>
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.

target = <country>
The target country.
prefer_name = <string>
Name of ship in origin navy that will preferably be transferred to target navy. Optional.
exclude_refitting = <bool>
Determines whether ships that are being refitted will be transferred. Optional.

transfer_ship = {
    prefer_name = "HMS Achilles"
    type = light_cruiser
    target = NZL
    exclude_refitting = no
}
Transfers the specified type of ship from the current scope to the specified country.   1.4
create_ship type = <ship>
The type of ship to create.

equipment_variant = <string>
The equipment variant to use.
creator = <country>
The country that created this ship. Optional.
name = <string>
Name of the ship. Optional.
amount = <int>
The amount of ships to create. Optional, defaults to 1.

FRA = {
    create_ship = {
        type = ship_hull_submarine_1
        equipment_variant = "S Class"
        creator = ENG
        name = "My ship name"
    }
}
Create a ship from another country and assign it to the reserve fleet. If not set, it will be the scoped country.   1.9
add_mines Add mines to a strategic region for the current country.
add_mines = { region = 42 amount = 100 }
Add mines to a strategic region.   1.6
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

Intelligence

Intelligence-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
create_intelligence_agency Allows to create automatically an intelligence agency
create_intelligence_agency = {
    name = "A.G.E.N.C.Y"
    icon = GFX_intelligence_agency_logo_agency
}
Creates an Intelligence Agency.   1.9
upgrade_intelligence_agency Allows to unlock automatically an intelligence agency upgrade
upgrade_intelligence_agency = upgrade_form_department
upgrade_intelligence_agency = <upgrade>
Unlocks an Intelligence Agency Upgrade. Upgrades can be found in common/intelligence_agency_upgrades 1.9
add_decryption target = <tag>
Towards which country to add decryption.

amount = <int>
How much decryption to add in flat numbers.
ratio = <0-1>
How much decryption ratio to add.

add_decryption = {
    target = GER
    amount = 300
}
add_decryption = {
    target = GER
    ratio = 0.5
}
Adds decryption towards the target country target and ratio arguments are mutually exclusive. 1.9
add_intel target = <tag>
Towards which country to add intelligence.

civilian_intel = <int>
How much civilian intel to add.
army_intel = <int>
How much army intel to add.
navy_intel = <int>
How much navy intel to add.
airforce_intel = <int>
How much airforce intel to add.

add_intel = {
    target = GER
    civilian_intel = 3
    army_intel = 2
    navy_intel = 1
    airforce_intel = 2
}
Adds the specified amount of intel towards the specified country. If an intel argument is left out, 0 is assumed. 1.9
add_operation_token tag = <tag>
Towards which country to add a token on.

token = <id>
Which token to add.

add_operation_token = {
    tag = GER
    token = token_test
}
Adds an operation token towards the country, allowing access to more intel or applying a targeted modifier. Operation tokens are defined in /Hearts of Iron IV/common/operation_tokens/*. 1.9
remove_operation_token tag = <tag>
Towards which country to remove a token from.

token = <id>
Which token to remove.

remove_operation_token = {
    tag = GER
    token = token_test
}
Removes an operation token from the country. Operation tokens are defined in /Hearts of Iron IV/common/operation_tokens/*. 1.9
capture_operative operative = <tag>
Which operative to capture.

ignore_death_chance = <bool>
Whether to ignore the death chance on capture (no by default).

capture_operative = {
    operative = PREV
    ignore_death_chance = yes
}
capture_operative = PREV
Captures the specified operative. Operatives can be referred to by using tags that refer to scopes 1.9
create_operative_leader bypass_recruitment = <bool>
Whether the operative is directly added to the list of available operatives or needs to be recruited.

available_to_spy_master = <bool>
Whether the operative can be recruited by the spy master. bypass_recruitment should be set to no. portrait_tag_override = <bool>
If selecting a random portrait, create one that is from the specified country rather than the current country. name = <string>
The name of the operative.
GFX = <string>
The graphical reference of the picture of the leader, defined as a sprite within any /Hearts of Iron IV/interface/*.gfx file.
nationalities = { <tag> }
The nationalities of the operative.
traits = { <trait> }
The traits the leader spawns with.
gender = <male|female>
The gender of the operative. Defaults to random.

create_operative_leader = {
	name = "Jacques Duclos"
	GFX = GFX_portrait_jacques_duclos
	traits = { operative_infiltrator operative_natural_orator }
	bypass_recruitment = no
	available_to_spy_master = yes
	nationalities = { FRA POL }
}
Creates an operative for the current scope with the specified attributes. Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. All arguments aside from bypass_recruitment are optional. Must use a spriteType for the portrait, a direct link as in "gfx/leaders/TAG/filename.dds" will not work. 1.9
free_operative <tag>
The operative to be freed.
free_operative = PREV
Frees the specifies operative. Operatives can be referred to by using tags that refer to scopes 1.9
free_random_operative captured_by = <tag>
The country that captured the operative.

all = <bool>
Whether to free all operatives or not (Defaults to no).

free_random_operative = {
	captured_by = POL
	all = yes
}
Frees one random captured operative or all of them. 1.9
kill_operative operative = <tag>
The operative that is killed.
kill_operative = {
    operative = PREV
}
kill_operative = PREV
Kills the targeted operative. Operatives can be referred to by using tags that refer to scopes 1.9
turn_operative operative = <tag>
The operative that is turned.
turn_operative = {
    operative = PREV
}
turn_operative = PREV
Turns the targeted operative against their own country, transferring them to the current country. Operatives can be referred to by using tags that refer to scopes. This counts as the operative dying and will trigger the corresponding On action. Logs an error if used against your own operative. 1.9
steal_random_tech_bonus category = <category name>
The category to steal from. See /Hearts of Iron IV/common/technology_tags/* for list.

folder = naval_folder
The folder to steal from. See /Hearts of Iron IV/common/technology_tags/* for list. ahead_reduction = <float>
The reduction to the ahead of time penalty. bonus = <float>
The bonus to research speed. base_bonus = <float>
The backup bonus if no tech is available. instant = <bool>
Whether to instantly give a tech instead of a bonus or not. No by default. dynamic = <bool>
Changes between instant and non-instant based on type. No by default. name = <localisation key>
The name of the bonus. target = <tag>
The country to steal from. uses = <int>
How many times the bonus can be used.

steal_random_tech_bonus = {
    category = air_equipment
    folder = naval_folder
    ahead_reduction = 0.8
    bonus = 1.2
    base_bonus = 1.1
    dynamic = yes
    name = LOC_KEY
    target = POL
    uses = 2
}
Steals a random tech bonus from the specified country. If a country does not have a tech to be stolen, a random bonus will be applied by using base_bonus as a base. 1.9

Characters

These are the character-related effects in the country scope. For effects in character scope, see § Character scope.

Character-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
set_nationality target_country = <country> / <variable>
The target country.

character = <character> The character to transfer.

set_nationality = {
    target_country = TZN
    character = OMA_sultan
}
Switches the specified character to the specified country. If you wish to change the nationality of a specific character, and the country getting the effect doesn't have the character recruited already, use the
every_possible_country = {
    limit = { has_character = ID }
    random_character = {
        limit = { is_character = ID }
        set_nationality = TAG
    }
}

command to call them up. Only necessary in 1.11 and beyond.

1.11
retire_character <character>
retire_character = GER_Character_Token
Retires the character, removing every role they hold and making them disappear from the game. Country scope only. The character cannot be re-recruited after retiring. 1.11
set_character_name character = <character>
The character to modify.

name = <localisation key>
The new name of the character.

set_character_name = {
	character = my_character
	name = my_name
}
Sets the new name for the target character. Can also be used in character scope. 1.11
character_list_tooltip limit = { <triggers> }
Triggers that must be fulfilled to show up in the list.

random_select_amount = <int>
Upper bound on the characters that may be shown.

character_list_tooltip = {
	limit = {
        has_character_flag = SOV_targeted_for_purge_flag
    }
    random_select_amount = 4
}
Displays a list of every character meeting the specified limitation and recruited by the current country. 1.11
add_trait character = <character>
The character to modify.

slot = <slot> Slot of the character. Necessary for advisors.
ideology = <sub-ideology> Ideology type of the character. Necessary for country leaders.
trait = <trait>
The trait to add.

add_trait = {
     character = TAG_jane_smith
     slot = political_advisor
     trait = really_good_boss
}
add_trait = {
     character = TAG_my_leader
     ideology = liberalism
     trait = field_of_gar
}
Adds the specified country leader trait to the character. Can also be used in character scope. Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon. The character slot can be the character's name or id. Using name is recommended because 1.11 made id obsolete. 1.11
remove_trait character = <character>
The character to modify.

slot = <slot> Slot of the character. Necessary for advisors.
ideology = <sub-ideology> Ideology type of the character. Necessary for country leaders.
trait = <trait>
The trait to remove.

remove_trait = {
    character = TAG_jane_smith
    slot = political_advisor
    trait = really_good_boss
}
remove_trait = {
     character = TAG_my_leader
     ideology = liberalism
     trait = field_of_gar
}
Removes the specified trait from the character. Can also be used in character scope. Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon. The character slot can be the character's name or id. Using name is recommended because 1.11 made id obsolete. 1.11

Unit leaders

Unit leader-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
create_corps_commander name = <string>
The name of the leader.

picture = <string>OR
portrait_path = <string>OR
gfx = <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.
legacy_id = <int>
The legacy ID used for the unit leader. Optional.

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. Deprecated, recommended to use add_corps_commander_role instead when possible. The created corps commander will not be able to have a portrait if assigned to be a minister via officer corps, causing errors. 1.0
create_field_marshal name = <string>
The name of the leader.

picture = <string>OR
portrait_path = <string>OR
gfx = <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.
legacy_id = <int>
The legacy ID used for the unit leader. Optional.

create_field_marshal = {
	name = "Maurice Gamelin"
	portrait_path = "GFX_portrait_FRA_maurice_gamelin"
	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. Deprecated, recommended to use add_field_marshal_role instead when possible. The created field marshal will not be able to have a portrait if assigned to be a minister via officer corps, causing errors. 1.0
create_navy_leader name = <string>
The name of the leader.

picture = <string>OR
portrait_path = <string>OR
gfx = <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.
maneuvering_skill = <int>The maneuvering skill of the leader.
coordination_skill = <int>The coordination skill of the leader.
traits = { <trait> }
The traits the leader spawns with.
female = <bool>
The gender of the leader.
legacy_id = <int>
The legacy ID used for the unit leader. Optional.

create_navy_leader = {
	name = "François Darlan"
	gfx = "GFX_portrait_FRA_francois_darlan"
	traits = { superior_tactician }
	skill = 3
	attack_skill = 2
	defense_skill = 4
	maneuvering_skill = 3
	coordination_skill = 2
}
Creates a naval leader for the current scope with the specified attributes. Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. Deprecated, recommended to use add_naval_commander_role instead when possible. The created admiral will not be able to have a portrait if assigned to be a minister via officer corps, causing errors. 1.0
remove_unit_leader <id>
The id of the unit leader.
remove_unit_leader = 70
Removes the specified unit leader by their legacy ID. Does not work with the character ID. Instead, remove_unit_leader_role within the scope of the character is recommended when possible. 1.0
add_corps_commander_role character = <character>
The character to modify.

<...>
Army leader role definition

add_corps_commander_role = {
    Character = GER_Character_token
    skill = 4
    attack_skill = 2
    defense_skill = 3
    planning_skill = 3
    logistics_skill = 5
}
Sets the specified character to also act as a corps commander. Can also be used in character scope. 1.11
add_field_marshal_role character = <character>
The character to modify.

<...>
Army leader role definition

add_field_marshal_role = {
  character = GER_Character_token
  skill = 4
  attack_skill = 2
  defense_skill = 3
  planning_skill = 3
  logistics_skill = 5
}
Sets the specified character to also act as a field marshal. Can also be used in character scope. 1.11
add_naval_commander_role character = <character>
The character to modify.

<...>
Navy leader role definition

add_naval_commander_role = {
  Character = GER_Character_token
  skill = 4
  attack_skill = 2
  defense_skill = 3
  planning_skill = 3
  logistics_skill = 5
}
Sets the specified character to also act as an admiral. Can also be used in character scope. 1.11
show_unit_leaders_tooltip <character>
The character whose name is to be shown.
show_unit_leaders_tooltip = TAG_my_leader
Shows the name of the specified character as a tooltip. 1.11

Country leaders

Country leader-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
create_country_leader name = <string>
The name of the leader.

desc = <string>
The description of the leader.
picture = <spriteType>
The graphical reference to the leader portrait.
expire = <string>
When the leader dies in history.
ideology = <string>
The sub-ideology of the country leader. Does not accept regular ideologies.
female = <bool>
The gender of the leader.
Traits scope
<trait>
The trait to add. Can add multiple.

create_country_leader = {
	name = AFG_mohammed_zahir_shah
	desc = "POLITICS_MOHAMMED_ZAHIR_SHAH_DESC"
	picture = GFX_AFG_mohammed_zahir_shah
	expire = "1965.1.1"
	ideology = despotism
	traits = {
	}
}
  The portrait uses a spriteType, defined within /Hearts of Iron IV/interface/*.gfx.

Sub-ideologies are defined in /Hearts of Iron IV/common/ideologies.
Deprecated. Recommended to use add_country_leader_role instead when possible.

1.0
add_country_leader_role character = <character>
The character to modify.

country_leader = { ... }
Country leader role definition
promote_leader = <bool>
Will promote the leader to be the leader of the assigned party. Optional, defaults to false.

add_country_leader_role = {
    character = GER_character_token
    promote_leader = yes
    country_leader = {
        ideology = fascism_ideology
        expire = "1965.1.1.1"
        traits = { war_industrialist }
    }
}
Sets the specified character to also act as a country leader, promoting to the party leader if specified. Can also be used in character scope. Does absolutely nothing if the character already has a country leader role in the ideology group. 1.11
promote_character <character>
The character to promote.

OR
character = <character>
The character to promote.
ideology = <ideology type>
The ideology type used by the country leader role.

promote_character = GER_erwin_rommel
promote_character = {
    character = GER_erwin_rommel
    ideology = nazism
}
Promotes a character to the leader of their political party. Can also be used in character scope. If the character has multiple country leader roles, specifying the ideology type is mandatory. Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon. 1.11
remove_country_leader_role character = <character>
The character to modify.

ideology = <string>
The ideology type of the character.

remove_country_leader_role = {
    character = GER_Character_Token
    ideology = socialism
}
Removes a country leader role from a character. Can also be used in character scope. Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon. 1.11
kill_ideology_leader <ideology>
Ideology.
kill_ideology_leader = communism
Kills the country leader of the designated ideology for the current scope.   1.9
retire_ideology_leader <ideology>
Ideology.
retire_ideology_leader = fascism
Retires and removes the country leader of the ideology party for the current scope.   1.9
kill_country_leader <bool>
Boolean.
kill_country_leader = yes
Kills the country leader for the current scope.   1.0
retire_country_leader <bool>
Boolean.
retire_country_leader = yes
Retires and removes the country leader as head of their party for the current scope.   1.0
set_country_leader_ideology <government>
The government to set.
set_country_leader_ideology = socialism
Changes the country leader's government type for the current scope. Creates no tooltip. 1.0
set_country_leader_description ideology = <ideology>
The ideology of the country leader, optional.

desc = <localisation key>
The new description.

set_country_leader_description = {
	ideology = neutrality
	desc = LOC_KEY
}
Changes the country leader's description. Must use a localisation key from any /Hearts of Iron IV/localisation/*.yml file, putting the description in quotes will not work. Localisation for more info 1.9.1
set_country_leader_name ideology = <ideology>
The ideology of the country leader, optional.

name = <localisation key>
The new name.

set_country_leader_name = {
	ideology = neutrality
	name = LOC_KEY
}
Changes the country leader's name. 1.9.1
set_country_leader_portrait ideology = <ideology>
The ideology of the country leader, optional.

portrait = <sprite name>
The new portrait.

set_country_leader_portrait = {
	ideology = neutrality
	portrait = GFX_IMAGE_NAME
}
Changes the country leader's portrait. The portrait must be defined in /Hearts of Iron IV/interface/*.gfx 1.9.1
add_country_leader_trait <trait>
The trait to add.
add_country_leader_trait = nationalist_symbol
Adds the specified trait to the current country's country leader. Traits are found in /Hearts of Iron IV/common/country_leader/*.txt files. 1.0
remove_country_leader_trait <trait>
The trait to remove.
remove_country_leader_trait = nationalist_symbol
Removes the specified trait from the current scope's country leader. Traits are found in /Hearts of Iron IV/common/country_leader/*.txt files. 1.0
swap_ruler_traits Similar to swap_ideas. Removes one trait and adds another.
swap_ruler_traits = { remove = <trait> add = <trait> }
Swaps traits. Use swap_country_leader_traits in character scope. 1.6

Advisors

Advisor-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
activate_advisor <character>
The character to activate.
activate_advisor = GER_character_token_air_chief
Hires an advisor, placing them into their respective slot. 1.11
deactivate_advisor <character>
The character to deactivate.
deactivate_advisor = GER_character_token_air_chief
Dismisses an advisor from their respective slot, leaving it empty. 1.11
add_advisor_role character = <character>
The character to modify.

advisor = { ... }
Advisor role definition
activate = <bool>
Will activate the advisor (add them directly when the command is run to the countries government). Optional, defaults to false.

add_advisor_role = {
    character = GER_Character_token
    activate = yes
    advisor = {
        slot = air_chief
        cost = 50
        idea_token = GER_character_token_air_chief
        traits = {
            air_chief_ground_support_2
        }
    }
}
Sets the specified character to also act as an advisor, activating if specified. Can also be used in character scope. Trigger and effect blocks (such as allowed and on_add) cannot be added within advisor definitions created this way. 1.11
remove_advisor_role character = <character>
Specifies the character if the effect is executed in country scope.

slot = <int>
The slot where to remove the advisor slot from.

remove_advisor_role = {
  character = "SOV_genrikh_yagoda"
  slot = political_advisor
}
Removes the specified advisor role from the character. Can also be used in character scope. 1.11
set_can_be_fired_in_advisor_role character = <character>
The character to modify.

slot = <slot>
The slot of the character to modify.
value = <bool>
The value to set.

set_can_be_fired_in_advisor_role = {
    character = BHR_important_advisor
    value = no
}
Changes the can_be_fired attribute of the advisor, preventing the player from dismissing the advisor. Can also be used in character scope. 1.12.8

MIOs

These are the MIO-related effects in the country scope. For effects in military industrial organisation scope, see § MIO scope.

MIO-related country-scoped effects:
Name Parameters Examples Description Notes Version Added
show_mio_tooltip <MIO>
MIO to display.
show_mio_tooltip = my_mio
Displays a tooltip that shows the name of the MIO and its initial trait (if present). Doesn't change the availability of the MIO directly. 1.13
unlock_mio_policy_tooltip <policy>
Policy to display.

OR
policy = <policy>
Policy to display.
show_modifiers = <bool>
Whether the trait's modifiers should be shown in the tooltip. Defaults to true.

unlock_mio_policy_tooltip = my_policy_1
unlock_mio_policy_tooltip = {
    policy = my_policy_2
    show_modifiers = no
}
Displays a tooltip that says that the policy is made available. Doesn't change the availability of the policy directly. 1.13
add_mio_policy_cost policy = <policy>
Policy to modify.

value = <int>
Amount in political power to add.

add_mio_policy_cost = {
    policy = my_policy
    value = 10
}
Modifies the base cost of a MIO policy. The base amount is capped at 0 from below. 1.13
set_mio_policy_cost policy = <policy>
Policy to modify.

value = <int>
Amount in political power to set.

set_mio_policy_cost = {
    policy = my_policy
    value = 100
}
Modifies the base cost of a MIO policy. Cannot be negative. 1.13
add_mio_policy_cooldown policy = <policy>
Policy to modify.

value = <int>
Amount in days to add.

add_mio_policy_cooldown = {
    policy = my_policy
    value = 10
}
Modifies the base length of a MIO policy cooldown. The base amount is capped at 0 from below. 1.13
set_mio_policy_cooldown policy = <policy>
Policy to modify.

value = <int>
Amount in days to set.

set_mio_policy_cooldown  = {
    policy = my_policy
    value = 100
}
Modifies the base length of a MIO policy cooldown. Cannot be negative. 1.13

History

These effects can only be used within history files, failing when used outside. However, they're considered effects anyway rather than history arguments, as they can be used in if statements.

Effects to be used in country history files:
Name Parameters Examples Description Notes Version Added
recruit_character <character>
recruit_character = GER_Character_token
Initially assigns the specified character to the current country. 1.11
generate_character token_base = <string>
Mandatory, acts as the character token.

name = <localisation key>
The name used for the character. Generates a random name if not set.

generate_character = {
    token_base = army_chief_defensive_1
    name = funny_name
    advisor = {
        slot = air_chief
        cost = 50
        idea_token = GER_character_token_air_chief
        traits = {
            air_chief_ground_support_2
        }
        allowed = {
            always = yes
        }
    }
}
Generates a character for current country. If used to create an advisor, the idea token of the advisor role will be the token_base and idea_token (defaulting to the slot if the idea token is not set) concatenated, with an underscore as a separator. In the provided example, the idea token will be army_chief_defensive_1_GER_character_token_air_chief; if idea_token wasn't present, it'd be army_chief_defensive_1_air_chief. 1.11
set_oob <order of battle>
The name of the file used for the order of battle without the .txt extension.
set_oob = BHR_1936
Sets the order of battle to be used for the current country's divisions, overriding every other non-naval and non-air order of battle. Orders of battle are defined in /Hearts of Iron IV/history/units/*.txt files. 1.0
set_naval_oob <order of battle>
The name of the file used for the order of battle without the .txt extension.
set_naval_oob = BHR_1936_naval_legacy
Sets the order of battle to be used for the current country's divisions, overriding every other naval order of battle. Orders of battle are defined in /Hearts of Iron IV/history/units/*.txt files. 1.0
set_air_oob <order of battle>
The name of the file used for the order of battle without the .txt extension.
set_air_oob = ITA_1936_air_bba
Sets the order of battle to be used for the current country's divisions, overriding every other air order of battle. Orders of battle are defined in /Hearts of Iron IV/history/units/*.txt files. 1.12
set_keyed_oob key = <string>
The key used for the file.

name = <order of battle>
The name of the file used for the order of battle without the .txt extension.

set_keyed_oob = {
    key = naval
    name = BHR_1936_mtg
}
Sets the order of battle to be used for the current country's divisions, overriding every other keyed order of battle that uses the same key. Orders of battle are defined in /Hearts of Iron IV/history/units/*.txt files. 1.0

State scope

The effects here must be used within a state scope.

General

General state-scoped effects:
Name Parameters Examples Description Notes Version Added
state_event id = <event>
The event to fire.

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

state_event = {
    id = my_event.1
    days = 10
    random = 50
    random_days = 10
    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.

OR
flag = <flag>
The flag to set.
days = <int>
Sets the flag to last for the specified amount of days. Optional.
value = <int>
The new value of the flag on the scale from -2 147 483 648 to 2 147 483 647.

set_state_flag = my_flag
set_state_flag = {
    flag = my_flag
    days = 123
    value = 1
}
Defines a state flag. No tooltip is shown. The flag in this effect is used in the meaning of 'boolean flag', used to store information. 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. No tooltip is shown. 1.0
modify_state_flag flag = <flag>
The flag to modify.

value = <value>
The value to add to the flag. Defaults to 0.
days = <int>
The amount of days that the flag should last for before being cleared. Optional, defaults to permanent.

modify_state_flag = {
    flag = my_flag
    value = 3
}
Adds an integer value to a flag. The flag must be already set. 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 <country> / <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 <country> / <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 <country> / <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 <country> / <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 total population to the current state. Note that when using negative manpower it will, besides reducing the population, also add directly to the recruitable manpower of the state. Which will increase your manpower 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. Can also be used in country scope. 1.0
set_border_war <bool>
Boolean.
set_border_war = yes
Enables Border War status for the current state. Used for the state-based border wars, represented with orange stripes, see § Border wars for the border wars that simulate combat on a border between two countries. On the end of the border war, the on_border_war_lost on action is fired for the state that where the border war was lost. 1.0
create_unit division = <division string>
The division string.

owner = <country>
The owner of the division.
prioritize_location = <province>
If possible, this province within the state gets used. Optional.
allow_spawning_on_enemy_provs = yes
Allows the units to be created on provinces owned by the division owner's enemy. Defaults to false.
count = <int>
The amount of units to create. Defaults to 1.
id = <int>
The ID to identify the unit. Only used in delete_unit.
country_score = { ... }
A MTTH block deciding the province in the state where the division should spawn, evaluates in the scope of the controller. Defaults to prioritising owner's controlled provinces first and then owner's allies.
The following arguments go within division = "":

name = \"<string>\"
The name of the division.
division_template = \"<string>\"
The template to be used by the division.
start_experience_factor = <double>
Experience of the division, with 0 being none and 1 being full training. Defaults to 1.
start_equipment_factor = <double>
Equipment stockpile of the division. Defaults to 1.
start_manpower_factor = <double>
Manpower stockpile of the division. Defaults to 1.
create_unit = {
    division = "name = \"Infantry Division\" division_template = \"Infantry Division\" start_experience_factor = 0.5"
    owner = GER
}
create_unit = {
    division = "name = \"Artie\" division_template = \"Artillery Division\" start_manpower_factor = 0.3"
    owner = BHR
    count = 3
    allow_spawning_on_enemy_provs = yes
    country_score = {
        base = 3
        modifier = {
            factor = 2
            tag = OMA
        }
    }
    id = 123
}
Adds the specified division to the current state. The division string must be on one line. A linebreak in the middle of division = "..." will break the effect and result in no units being spawned.

Can only be used within a state scope, such as capital_scope. The effect will do nothing when put into a country's scope.

Equipment factor cannot be set to zero. If set to zero, it will be treated as a 1. Created equipment will be the latest available to the country.

1.3
teleport_armies limit = { <triggers> }
The condition that must be true for the owner of the armies for them to teleport.

to_state_array = <array>
The state array the armies will get teleported to.
to_province = <ID>
The province the armies will get teleported to.
to_state = <ID>
The state the armies will get teleported to.

teleport_armies = {
    limit = {
        has_war_together_with = ROOT
    }
    to_state_array = owned_controlled_states
}
Teleports all armies in the specified state if the owner of the armies meets the condition. Only define one of to_state_array, to_state, or to_province. If none is specified, it defaults to the capital. 1.9
add_province_modifier static_modifiers = { <modifiers> }
The list of modifiers.
province = <id>The province to apply the modifiers to.provinces = {}Scope for selecting multiple provinces. The following arguments have to go inside it:
id = <id>The ID of the province. Multiple can be specified.
all_provinces = yesSelects all provinces to which the limitations apply. The following arguments require it: limit_to_coastal = yes Limits the selection of provinces to only coastal ones.
limit_to_border = yes Limits the selection of provinces to only ones bordering a different country.
limit_to_naval_base = yes Limits the selection of provinces to only ones that have a naval base.
limit_to_victory_point = yes Limits the selection of provinces to only ones that have a victory point, or a city, in them.
add_province_modifier = {
	static_modifiers = { mod_modifier_1 mod_modifier_2 }
	province = 1234
}
add_province_modifier = {

static_modifiers = { mod_modifier_1 mod_modifier_2 } province = { id = 1234 id = 4321 }

}
add_province_modifier = {

static_modifiers = { mod_modifier_1 mod_modifier_2 } province = { all_provinces = yes limit_to_coastal = yes limit_to_border = yes limit_to_naval_base = yes limit_to_victory_point = yes }

}
Adds a province modifier to the specified provinces in this state. Province modifiers are defined in /Hearts of Iron IV/common/modifiers/*.txt 1.6
remove_province_modifier static_modifiers = { <modifiers> }
The list of modifiers.
province = <id>The province to apply the modifiers to.provinces = {}Scope for selecting multiple provinces. The following arguments have to go inside it:
id = <id>The ID of the province. Multiple can be specified.
all_provinces = yesSelects all provinces to which the limitations apply. The following arguments require it: limit_to_coastal = yes Limits the selection of provinces to only coastal ones.
limit_to_border = yes Limits the selection of provinces to only ones bordering a different country.
limit_to_naval_base = yes Limits the selection of provinces to only ones that have a naval base.
limit_to_victory_point = yes Limits the selection of provinces to only ones that have a victory point, or a city, in them.
remove_province_modifier = {
	static_modifiers = { mod_modifier_1 mod_modifier_2 }
	province = 1234
}
remove_province_modifier = {

static_modifiers = { mod_modifier_1 mod_modifier_2 } province = { id = 1234 id = 4321 }

}
remove_province_modifier = {

static_modifiers = { mod_modifier_1 mod_modifier_2 } province = { all_provinces = yes limit_to_coastal = yes limit_to_border = yes limit_to_naval_base = yes limit_to_victory_point = yes }

}
Removes a province modifier to the specified provinces in this state. Province modifiers are defined in /Hearts of Iron IV/common/modifiers/*.txt 1.6
add_victory_points Add victory points to a province
add_victory_points = {
	province = 1234
	value = 10
}
Adds victory points to a province. Accepts negative values 1.10
set_victory_points Set the victory points of a province
set_victory_points = {
	province = 1234
	value = 10
}
Sets the number of victory point in a province. Accepts negative values 1.10
set_state_province_controller controller = <tag>
The new controller of the province.

limit = { <triggers> }
The triggers that must be fulfilled by the province's current controller to be transferred to the new controller.

set_state_province_controller = {
    controller = POL
    limit = {
        OR = {
            tag = GER
            is_in_faction_with = GER
        }
    }
}
Changes the controller of all provinces within that state controlled by countries that meet triggers to the specified country.   1.9
transfer_state_to <country>
Country to transfer the state to.
transfer_state_to = JAM
Sets owner and controller of the state to the given country 1.11
set_state_owner_to <country>
Country to set the owner (but not the controller) of the state to.
set_state_owner_to = JAM
Sets the owner of the state to the given country Use transfer_state_to unless the control specifically shouldn't be given. 1.11
set_state_controller_to <country>
Country to set the controller (but not the owner) of the state to.
set_state_controller_to = ITA
Sets the controller of the state to the given country 1.11

Buildings

Building-related state-scoped effects:
Name Parameters Examples Description Notes Version Added
add_extra_state_shared_building_slots <int> / <variable>
The amount of slots to add or remove.
add_extra_state_shared_building_slots = 2
Changes the number of shared building slots for the current state. Shared buildings slots being the ones used for multiple building types, such as military or civilian factories. This is in contrast to non-shared slots, such as those used by radio stations or air bases, which only can be changed globally with technologies. 1.0
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 within the state that meet each limit. Used in the province scope.
id = <id>
Affect the specified province ID. Used in the province scope, will apply for each province if inserted multiple times. limit_to_coastal = <bool>
Affect only coastal provinces within the selection. Used in the province scope.
limit_to_naval_base = <bool>
Affect only provinces that have naval bases built. Used in the province scope.
limit_to_border = <bool>
Affect only provinces that lie on a border between countries. Used in the province scope.
limit_to_border_country = <country>
Affect only provinces that border a specific other country. Used in the province scope.
limit_to_victory_point = <int>/<bool>
Affect only provinces that meet the victory point amount prerequisite. If yes is used in place of a number, any amount of victory points works. Used in the province scope.
limit_to_supply_node = <bool>
Affect only provinces that have a supply node. 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.

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
        limit_to_victory_point > 1
    }
}
add_building_construction = {
    type = bunker
    level = 1
    instant_build = yes
    province = 2999
}
Starts construction in the current state for the specified building. For provincial buildings, must be done within the scope of the state that contains the province even if done on a specific province. If the controller country doesn't have an order of battle assigned within the history file, the buildings will not show up within the production menu until a recalculation of buildings, such as by changing consumer goods or reloading a savefile.

Can only be used within a state scope, such as random_owned_controlled_state. The effect will do nothing when put into a country's scope.

For the list of building IDs present in the base game, see Building modding#Types.

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 within the state that meet each limit. Used in the province scope.
id = <id>
Affect the specified province ID. Used in the province scope, will apply for each province if inserted multiple times. limit_to_coastal = <bool>
Affect only coastal provinces within the selection. Used in the province scope.
limit_to_naval_base = <bool>
Affect only provinces that have naval bases built. Used in the province scope.
limit_to_border = <bool>
Affect only provinces that lie on a border between countries. Used in the province scope.
limit_to_border_country = <country>
Affect only provinces that border a specific other country. Used in the province scope.
limit_to_victory_point = <int>/<bool>
Affect only provinces that meet the victory point amount prerequisite. If yes is used in place of a number, any amount of victory points works. Used in the province scope.
limit_to_supply_node = <bool>
Affect only provinces that have a supply node. 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.

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) For provincial buildings, must be done within the scope of the state that contains the province even if done on a specific province. 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

Resistance and compliance

Resistance-related state-scoped effects:
Name Parameters Examples Description Notes Version Added
add_compliance <int> / <variable>
The amount to add.
add_compliance = 30
Adds compliance to the specified state.   1.9
add_resistance <int> / <variable>
The amount to add.
add_resistance = 30
Adds resistance to the specified state.   1.9
add_resistance_target <int> / <variable>
The amount to add.
add_resistance_target = 30
Increases resistance target in the specified state.   1.9
add_resistance_target id = <int>
The ID of the target increase.
amount = <int>/<variable>
The amount to increase the resistance target by.
occupied = <country>
Will only apply the increase if the the occupied country is the specified scope.
occupier = <country>
Will only apply the increase if the the occupier is the specified scope.
days = <int>/<variable>
If set, the resistance target will only be increased for the specified amount of days.
tooltip = <string>
The tooltip to show in the resistance target tooltip.
add_resistance_target = {
    id = 123
    amount = 30
    occupied = ENG
    occupier = GER
    days = 365
    tooltip = my_localisation_key
}
Increases resistance target in the specified state.   1.9
cancel_resistance <bool>
Boolean.
cancel_resistance = yes
Cancels resistance activity for the current state.   1.9
force_disable_resistance <country>
The target country.
force_disable_resistance = GER
Disables resistance for the scoped state when the occupier is the specified country.   1.9
force_disable_resistance clear = <bool>
If set to yes, will clear resistance.
occupier = <country>
Resistance will be disabled if the occupier is the specified scope.
occupied = <country>
Resistance will be disabled if the occupied country is the specified scope.
force_disable_resistance = {
    clear = yes
    occupier = GER
    occupied = ENG
}
Disables resistance for the scoped state when the occupier is the specified country.   1.9
force_enable_resistance <country>
The target country.
force_enable_resistance = GER
Enables resistance for the scoped state when the occupier is the specified country. Does not start resistance by itself, only removes the checks forcefully disabling it. Use with start_resistance in order to immediately start resistance. 1.9
force_enable_resistance clear = <bool>
If set to yes, will clear resistance.
occupier = <country>
Resistance will be enabled if the occupier is the specified scope.
occupied = <country>
Resistance will be enabled if the occupied country is the specified scope.
force_enable_resistance = {
    clear = yes
    occupier = GER
    occupied = ENG
}
Enables resistance for the scoped state when the occupier is the specified country. Does not start resistance by itself, only removes the checks forcefully disabling it. Use with start_resistance in order to immediately start resistance. 1.9
remove_resistance_target <int> / <variable>
The id of the resistance target to remove. (Must be set with add_resistance_target)
remove_resistance_target = 30
Removes a set resistance target increase in the specified state. Has no tooltip. 1.9
set_compliance <int> / <variable>
The amount to set the compliance to.
set_compliance = 30
Sets compliance in the specified state.   1.9
set_resistance <int> / <variable>
The amount to set the resistance to.
set_resistance = 30
Sets resistance in the specified state. The resistance should be enabled in the state, either via start_resistance or through the in-game process. Occassionally it may take a tick for resistance to start after the controllership change, so it's preferable to do so on states that are given to the country immediately before this gets executed, such as if this is executed in country history. 1.9
start_resistance <bool>/<country>
Whether to start resistance or not. If using a country as the parameter, the state will only start resistance if occupied by the target country.
start_resistance = POL
start_resistance = yes
Starts resistance in the specified state. If used on a state that normally can't start resistance, use alongside with force_enable_resistance. 1.9
set_garrison_strength <0-1>
The new garrison strength.
set_garrison_strength = 0.5
Sets the strength of the garrison in the specified state. 1.9
set_occupation_law <law ID>
The new occupation law enacted by the previous scope or default_law.
GER = { every_controlled_state = { set_occupation_law = military_governor_occupation } } # Changes GER's occupation law for every controlled state.
Sets the occupation law of the state. PREV will be the country for whom the occupation law will be changed. If PREV is not a country, nothing changes. If PREV doesn't occupy the state, nothing happens until it does. If using default_law, resets to the law set by the country's occupation. 1.12

Character scope

The effects here must be used within a character scope.

General

General character-scoped effects:
Name Parameters Examples Description Notes Version Added
set_character_flag <flag>
An unique string to identify the character flag with.

OR
flag = <flag>
The flag to set.
days = <int>
Sets the flag to last for the specified amount of days. Optional.
value = <int>
The new value of the flag on the scale from -2 147 483 648 to 2 147 483 647.

set_character_flag = my_flag
set_character_flag = {
    flag = my_flag
    days = 123
    value = 1
}
Defines a character flag. No tooltip is shown. The flag in this effect is used in the meaning of 'boolean flag', used to store information. 1.11
set_character_name <localisation key>
The name to use.
set_character_name = GER_my_cool_flag
Changes the character's name to the specified localisation key's value. 1.11
modify_character_flag flag = <flag>
The flag to modify.

value = <value>
The value to add to the flag. Defaults to 0.
days = <int>
The amount of days that the flag should last for before being cleared. Optional, defaults to permanent.

modify_character_flag = {
    flag = my_flag
    value = 3
}
Adds an integer value to a flag. The flag must be already set. 1.11
clr_character_flag
clr_character_flag = <bool>
Clears a character flag 1.11
retire <bool>
Boolean>
retire = yes
Retires the current character (removing them).   1.5
set_nationality <country> / <variable>
The target country.
set_nationality = GER
Switches the current character to the specified country, giving them the character. If you wish to change the nationality of a specific character, and the country getting the effect doesn't have the character recruited already, use the
every_possible_country = {
    limit = { has_character = ID }
    random_character = {
        limit = { is_character = ID }
        set_nationality = TAG
    }
}

command to call them up. Only necessary in 1.11 and beyond.

1.5
set_portraits character = <character>
The character name. Optional if in character scope.

Army scope: small = <sprite>
The sprite used as an advisor. large = <sprite>
The sprite used as a general.
Character scope:large = <sprite>
The sprite used as a country leader.

set_portraits = {
    character = my_character
    army = { small ="MySmallCharacterGFX" }
    civilian = { large ="MyLargeCharacterGFX" }
}
Changes the specified portraits of a character. Sprites are defined within /Hearts of Iron IV/interface/*.gfx files. 1.11
add_trait slot = <slot> Slot of the character. Necessary for advisors.

ideology = <sub-ideology> Ideology type of the character. Necessary for country leaders.
trait = <trait>
The trait to add.

add_trait = {
    slot = political_advisor
    trait = really_good_boss
}
add_trait = {
    ideology = liberalism
    trait = field_of_gar
}
Adds the specified country leader trait to the character. Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon. The character slot can be the character's name or id. Using name is recommended because 1.11 made id obsolete. 1.11
remove_trait slot = <slot> Slot of the character. Necessary for advisors.

ideology = <sub-ideology> Ideology type of the character. Necessary for country leaders.
trait = <trait>
The trait to remove.

remove_trait = {
    slot = political_advisor
    trait = really_good_boss
}
remove_trait = {
    ideology = liberalism
    trait = field_of_gar
}
Removes the specified trait from the character. Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon. The character slot can be the character's name or id. Using name is recommended because 1.11 made id obsolete. 1.11
add_corps_commander_role <...>
Army leader role definition
add_corps_commander_role = {
    skill = 4
    attack_skill = 2
    defense_skill = 3
    planning_skill = 3
    logistics_skill = 5
}
Sets the specified character to also act as a corps commander. 1.11
add_field_marshal_role <...>
Army leader role definition
add_field_marshal_role = {
  skill = 4
  attack_skill = 2
  defense_skill = 3
  planning_skill = 3
  logistics_skill = 5
}
Sets the specified character to also act as a field marshal. 1.11
add_naval_commander_role <...>
Navy leader role definition
add_naval_commander_role = {
  skill = 4
  attack_skill = 2
  defense_skill = 3
  planning_skill = 3
  logistics_skill = 5
}
Sets the specified character to also act as an admiral. 1.11
add_country_leader_role character = <character>
The character to modify.

country_leader = { ... }
Country leader role definition
promote_leader = <bool>
Will promote the leader to be the leader of the assigned party. Optional, defaults to false.

add_country_leader_role = {
    character = GER_character_token
    promote_leader = yes
    country_leader = {
        ideology = fascism_type
        expire = "1965.1.1.1"
        traits = { war_industrialist }
    }
}
Sets the specified character to also act as a country leader, promoting to the party leader if specified. Does nothing if the character already has a country leader role in the ideology group. 1.11
promote_character <bool>
Boolean.

OR
<ideology type>
The ideology type used by the country leader role.

promote_character = yes
promote_character = liberalism
Promotes a character to the leader of their political party. If the character has multiple country leader roles, specifying the ideology type is mandatory. Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon. 1.11
remove_country_leader_role ideology = <string>
The ideology type of the character.
remove_country_leader_role = {
    ideology = socialism
}
Removes a country leader role from a character. Ideology type refers to a sub-type of an ideology group assigned to characters, commonly referred to as sub-ideologies in community jargon. 1.11
add_advisor_role advisor = { ... }
Advisor role definition

activate = <bool>
Will activate the advisor (add them directly when the command is run to the countries government). Optional, defaults to false.

add_advisor_role = {
    activate = yes
    advisor = {
        slot = air_chief
        cost = 50
        idea_token = GER_character_token_air_chief
        traits = {
            air_chief_ground_support_2
        }
    }
}
Sets the specified character to also act as an advisor, activating if specified. Trigger and effect blocks (such as allowed and on_add) cannot be added within advisor definitions created this way. 1.11
remove_advisor_role slot = <int>
The slot where to remove the advisor slot from.
remove_advisor_role = {
  slot = political_advisor
}
Removes the specified advisor role from the character. 1.11
set_can_be_fired_in_advisor_role slot = <slot>
The slot of the character to modify.

value = <bool>
The value to set.

set_can_be_fired_in_advisor_role = {
    slot = political_advisor
    value = no
}
Changes the can_be_fired attribute of the advisor, preventing the player from dismissing the advisor. 1.12.8

Unit leaders

These can only be used with characters of the unit leader type.

General unit leader-scoped effects:
Name Parameters Examples Description Notes Version Added
unit_leader_event id = <event>
The event to fire.

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

unit_leader_event = {
    id = my_event.1
    days = 10
    random = 50
    random_days = 10
}
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. Deprecated. Use set_character_flag instead. No tooltip is shown. 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. Deprecated. Use clr_character_flag instead. No tooltip is shown. 1.5
modify_unit_leader_flag flag = <flag>
The flag to modify.

value = <value>
The value to add to the flag. Defaults to 0.
days = <int>
The amount of days that the flag should last for before being cleared. Optional, defaults to permanent.

modify_unit_leader_flag = {
    flag = my_flag
    value = 3
}
Adds an integer value to a flag. The flag must be already set. Deprecated. Use modify_character_flag instead. 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
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 files. 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 files. 1.0
add_random_trait <trait>
The trait to add.
add_random_trait = { old_guard brilliant_strategist inflexible_strategist }
Adds a random trait from the list to the character. Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt files. 1.5
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 files. 1.5
replace_unit_leader_trait       Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt files. 1.5
remove_exile_tag Remove the exile tag on an army leader, making them no longer be considered exile leaders.
remove_exile_tag = yes
Removes a leaders exile tag.   1.6
gain_xp <int>
gain_xp = 5
Adds experience to the current unit leader, promoting to the next skill level if applicable. Cannot be used with negatives. 1.9
remove_unit_leader <bool>
remove_unit_leader = yes
Removes the current unit leader. 1.0
remove_unit_leader_role <bool>
Boolean.
remove_unit_leader_role = yes
Removes every unit leader role from the character 1.11

Country leaders

These can only be used with characters of the country leader type.

Country leader-scoped effects:
Name Parameters Examples Description Notes Version Added
add_country_leader_trait <trait>
The trait to add.

OR:
ideology = <sub-ideology>
The sub-ideology of the country leader role to which the trait is added.
trait = <trait>
The trait to add.

add_country_leader_trait = nationalist_symbol
add_country_leader_trait = {
    ideology = marxism
    trait = anti_communist
}
Adds the specified trait to the current character. Traits are found in /Hearts of Iron IV/common/country_leader/*.txt files. The former only if the character has one country leader role. 1.11
remove_country_leader_trait <trait>
The trait to remove.

OR:
ideology = <sub-ideology>
The sub-ideology of the country leader role to which the trait is added.
trait = <trait>
The trait to remove.

remove_country_leader_trait = nationalist_symbol
remove_country_leader_trait = {
    ideology = marxism
    trait = anti_communist
}
Removes the specified trait from the current character. Traits are found in /Hearts of Iron IV/common/country_leader/*.txt files. The former only if the character has one country leader role. 1.11
swap_country_leader_traits remove = <trait>
Trait to remove

add = <trait>
Trait to add
ideology = <sub-ideology>
Sub-ideology of the leader where to swap traits.

swap_country_leader_traits = {
    remove = nationalist_symbol
    add = anti_communist
    ideology = marxism
}
Swaps traits of the current character. Use swap_ruler_traits in country scope. 1.11

Combat

Combat-related unit leader-scoped effects:
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>
How many skill levels to add.
add_logistics = 1
Adds logistics skill to the current unit leader.   1.5
add_planning <int>
How many skill levels to add.
add_planning = 1
Adds planning skill to the current unit leader.   1.5
add_defense <int>
How many skill levels to add.
add_defense = 1
Adds defense skill to the current unit leader.   1.5
add_attack <int>
How many skill levels to add.
add_attack = 1
Adds attack skill to the current unit leader.   1.5
add_coordination <int>
How many skill levels to add.
add_coordination = 1
Adds coordination skill to the current navy leader. 1.5
add_maneuver <int>
How many skill levels to add.
add_maneuver = 1
Adds maneuver skill to the current navy 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

Operatives

Operative-scoped effects:
Name Parameters Examples Description Notes Version Added
add_nationality <tag>
The country to set the nationality to.
add_nationality = GER
Adds the nationality to the current operative.   1.9
capture_operative captured_by = <tag>
By which country to get captured.

ignore_death_chance = <bool>
Whether to ignore the death chance on capture (no by default).

capture_operative = {
    captured_by = POL
    ignore_death_chance = yes
}
Makes the current operative be captured by a specific country. 1.9
force_operative_leader_into_hiding <bool>
force_operative_leader_into_hiding = yes
Forces the current operative into hiding. 1.9
free_operative captured_by = <tag>
The country that captured the operative.
free_operative = { captured_by = POL }
Frees the current operative. 1.9
harm_operative_leader <int>
How much to harm the operative.
harm_operative_leader = 12
Harms the current operative. The value is subject to modifiers. 1.9
kill_operative killed_by = <tag>
The country that'll kill the operative.
kill_operative = { killed_by = POL }
Kills the current operative. 1.9
turn_operative turned_by = <tag>
The country to which the operative defects.
turn_operative = {
    turned_by = PREV
}
Turns the current operative against their own country, transferring them to the specified country. This counts as the operative dying and will trigger the corresponding On action. Logs an error if used against your own operative. 1.9
operative_leader_event id = <event>
The event to fire.

days = <int> / <variable>
Fires the event in the specified number of days. Optional.
hours = <int> / <variable>
Fires the event in the specified number of hours. Optional.
random = <int> / <variable>
Adds a random number (between 0 and random, inclusive) of hours to the scheduled fire time. Optional.
random_days = <int> / <variable>
Adds a random number (between 0 and random_days, inclusive) of days to the scheduled fire time. Optional.
originator = <tag>
The originator of the event. Optional, defaults to owner of operative.
recipient = <tag>
The recipient of the event. Optional, defaults to owner of operative.
set_from = <tag>
Sets the scope of FROM in scripted localization. Optional.
set_from_from = <tag>
Sets the scope of FROM.FROM in scripted localization. Optional.
set_root = <tag>
Sets the scope of ROOT in scripted localization. Optional.

operative_leader_event = {
    id = my_event.1
	originator = POL
	recipient = GER
    days = 10
    random = 50
    random_days = 10
	set_from = ENG
	set_root = SOV
	set_from_from = FRA
}
Fires the specified event for the operative. Uses a special interface displaying the current operative 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.9

Division scope

The effects here must be used within a division scope.

Division-scoped effects:
Name Parameters Examples Description Notes Version Added
destroy_unit <bool>
Boolean.
destroy_unit = yes
Destroys the currently-scoped division. 1.12
add_history_entry key = <localisation key>
The name of the entry.

subject = "<string>"
Logged entry. Never shown to the player.
allow = <bool>
Whether a medal can be awarded to the division over the history entry.

add_history_entry = {
    key = my_history_entry
    subject = "Test entry"
    allow = no
}
Creates an entry within the command history of a division. 1.12
change_division_template <string>
The name of the division.
change_division_template = {
    division_template = "New template"
}
Changes the template of the division to the specified one. 1.12
add_random_valid_trait_from_unit <character>
Character to grant the trait to.
add_random_valid_trait_from_unit = FROM
Adds a random valid unit trait to a unit leader. Only possible to use if the division scope is the same as the ROOT scope. 1.12
add_unit_medal_to_latest_entry unit_medals = <medal ID>
The medal to add.
add_unit_medal_to_latest_entry = {
    unit_medals = my_medal
}
Adds the specified medal to the latest entry within the unit's history. 1.12
add_divisional_commander_xp <decimal>
Experience to add.
add_divisional_commander_xp = 10
Adds the specified amount of experience to the divisional commander. 1.12
reseed_division_commander <int>
The seed to use.
reseed_division_commander = 760
Re-randomises the division commander using the given seed. Does not have a tooltip. 1.12
set_unit_organization <decimal>
The level to set to.
set_unit_organization = 0.3
Changes the organisation of the unit. On the scale from 0 to 1. 1.13

MIO scope

The effects here must be used within a military industrial organisation scope.

MIO-scoped effects:
Name Parameters Examples Description Notes Version Added
add_mio_funds <int>
Funds to add.
add_mio_funds = 1000
Adds funds to the MIO. If the amount goes above the "Size Up" limit, the MIO will automatically gains sizes. The amount of funds is capped at 0 from below. 1.13
set_mio_funds <int>
Amount to set.
set_mio_funds = 1000
Sets the funds of a MIO to the certain level. If the amount goes above the "Size Up" limit, the MIO will automatically gains sizes. Cannot be negative. 1.13
add_mio_funds_gain_factor <decimal>
Amount to add.
add_mio_funds_gain_factor = 0.1
Changes the base multiplier to MIO's funds. The multiplier is capped at 0 from below. 1.13
set_mio_funds_gain_factor <decimal>
Amount to set.
set_mio_funds = 0.1
Changes the base multiplier to MIO's funds. Cannot be negative. 1.13
add_mio_size <int>
Amount to add.
add_mio_size = 2
Adds sizes to the MIO. Funds will not be changed by the effect. Cannot be negative. 1.13
add_mio_size_up_requirement_factor <decimal>
Amount to add.
add_mio_size_up_requirement_factor = 0.1
Changes the base multiplier to the requirement to size up a MIO. The multiplier is capped at 0 from below. 1.13
set_mio_size_up_requirement_factor <decimal>
Amount to set.
set_mio_size_up_requirement_factor = 0.1
Changes the base multiplier to the requirement to size up a MIO. Cannot be negative. 1.13
add_mio_task_capacity <int>
Amount to add.
add_mio_task_capacity = 2
Changes the base maximum task capacity of the MIO. If the capacity is reduced to below the amount of assigned tasks, they'll be turned allowed. The base amount is capped at 0 from below. Doesn't instantly apply. 1.13
set_mio_task_capacity <int>
Amount to set.
set_mio_task_capacity = 2
Changes the base maximum task capacity of the MIO. If the capacity is reduced to below the amount of assigned tasks, they'll be turned allowed. Cannot be negative. Doesn't instantly apply. 1.13
add_mio_research_bonus <decimal>
Amount to add.
add_mio_research_bonus = 0.3
Changes the base research bonus of the MIO. The base amount is capped at 0 from below. 1.13
set_mio_research_bonus <decimal>
Amount to set.
set_mio_research_bonus = 0.3
Changes the base research bonus of the MIO. Cannot be negative. 1.13
set_mio_name_key <localisation key>
The new name.
set_mio_name_key = mio_new_name
Changes the name of the MIO. May also refer to a scripted localisation definition, which'll be evaluated in MIO's scope. 1.13
set_mio_icon <sprite>
The new sprite.
set_mio_icon = GFX_new_mio_icon
Changes the MIO's icon. 1.13
add_mio_design_team_assign_cost <decimal>
Amount to add.
add_mio_design_team_assign_cost = 0.3
Changes the base political power cost of the MIO to assign research. The base amount is capped at 0 from below. 1.13
set_mio_design_team_assign_cost <decimal>
Amount to set.
set_mio_design_team_assign_cost = 0.3
Changes the base political power cost of the MIO to assign research. Cannot be negative. 1.13
add_mio_industrial_manufacturer_assign_cost <decimal>
Amount to add.
add_mio_industrial_manufacturer_assign_cost = 0.3
Changes the base political power cost of the MIO to assign production lines. The base amount is capped at 0 from below. 1.13
set_mio_industrial_manufacturer_assign_cost <decimal>
Amount to set.
set_mio_industrial_manufacturer_assign_cost = 0.3
Changes the base political power cost of the MIO to assign production lines. Cannot be negative. 1.13
add_mio_design_team_change_cost <decimal>
Amount to add.
add_mio_design_team_change_cost = 0.3
Changes the base experience cost of the MIO to assign to equipment by a percentage. The base amount is capped at 0 from below. Rounded down, e.g. 0.3 with a cost of 5 should result in 6.5, but becomes 6 instead. 1.13
set_mio_design_team_change_cost <decimal>
Amount to set.
set_mio_design_team_change_cost = 0.3
Changes the base experience cost of the MIO to assign to equipment by a percentage. Cannot be negative. Rounded down, e.g. 0.3 with a cost of 5 should result in 6.5, but becomes 6 instead. 1.13
unlock_mio_trait_tooltip <trait>
Trait to display.

OR
trait = <trait>
Trait to display.
show_modifiers = <bool>
Whether the trait's modifiers should be shown in the tooltip. Defaults to true.

unlock_mio_trait_tooltip = my_trait_1
unlock_mio_trait_tooltip = {
    trait = my_trait_2
    show_modifiers = no
}
Displays a tooltip that says that the trait is made available. Doesn't change the availability of the trait directly. 1.13
complete_mio_trait <trait>
Trait to complete.

OR
trait = <trait>
Trait to complete.
show_modifiers = <bool>
Whether the trait's modifiers should be shown in the tooltip. Defaults to true.

complete_mio_trait = my_trait_1
complete_mio_trait = {
    trait = my_trait_2
    show_modifiers = no
}
Completes the specified MIO trait. Automatically adds 1 size to the MIO. No checks are placed on the trait. 1.13
set_mio_flag <flag>
An unique string to identify the MIO flag with.

OR
flag = <flag>
The flag to set.
days = <int>
Sets the flag to last for the specified amount of days. Optional.
value = <int>
The new value of the flag on the scale from -2 147 483 648 to 2 147 483 647.

set_mio_flag = my_flag
set_mio_flag = {
    flag = my_flag
    days = 123
    value = 1
}
Defines a MIO flag. No tooltip is shown. 1.13
clr_mio_flag <flag>
The unique string of a country flag to clear.
clr_mio_flag = my_flag
Clears a defined MIO flag.   1.13
modify_mio_flag flag = <flag>
The flag to modify.

value = <value>
The value to add to the flag. Defaults to 0.
days = <int>
The amount of days that the flag should last for before being cleared. Optional, defaults to permanent.

modify_mio_flag = {
    flag = my_flag
    value = 3
}
Adds an integer value to a flag. The flag must be already set. 1.13

Other scopes

The effects here must be used within a scope that's specified within the notes.

Otherwise-scoped effects:
Name Parameters Examples Description Notes Version Added
execute_operation_coordinated_strike amount = <int>
How many times the operation will get executed within the days set in the operation.
execute_operation_coordinated_strike = {
    amount = 12
}
All prepared Port Strike and Strategic Bombing in the target region will execute multiple times without air defence being able to intercept them. Can only be used within operations. 1.9
cancel_purchase_contract <bool>
Boolean.
cancel_purchase_contract = yes
Cancels the current purchase contract. Can only be used within the purchase contract scope. 1.13

Flow control

These scopes are used within effect scopes to control the execution of effects.

If statements

An if statement allows an execution of effects to only be done if certain triggers are met. Conditional statements are represented with the if = { ... } effect. limit = { ... } inside of the if statement serves as a trigger block that defines the conditions when it should be executed, and everything else directly inside of if = { ... } is interpreted as the effects that should be executed if the condition is true.

For example, the following will add 10% 稳定度稳定度 to the country this is executed on if it has positive 政治点数政治点数 and below 90% stability:

if = {
    limit = {
        has_political_power > 0
        stability < 0.9
    }
    add_stability = 0.1
}

If the limit is not met, then none of the effects inside will be executed. If it is, then each one will be. If the limit is omitted, it defaults to being always true.

The effects must be inside of the if statement to be tied to the limit. For example, this will always give 100 政治点数政治点数, regardless of what country is played:

if = {
    limit = { tag = BHR }
}                         # Closes if = { ... }. Since no effects are inside, this means that the if statement does absolutely nothing
add_political_power = 100 # Outside of if = { ... }, so it will always give 100 political power, even if not playing as BHR

Optionally, else_if = { ... } (with limit = { ... } serving in a similar fashion) and else = { ... } can be added. If the initial limit within if = { ... } is false, it moves on to the next else_if = { ... }, checking the limit there. If the limit there is false, then it moves on to the next one, until hitting an end or an else = { ... }.
Two variants exist: nested and unnested. In the first case, the else_if or else is put directly inside of the preceding if or else_if, while in the second case it's put right after. In case of overlap, unnested if statements are preferred. Here is an example using unnested if statements:

if = {
    limit = {
        stability < 0.3 # If stability is below 30%, add 30%.
    }
    add_stability = 0.3
}
else_if = {
    limit = {
        stability < 0.6 # Otherwise, if it's below 60% (i.e. 30-59%), add 20%
    }
    add_stability = 0.2
}
else = {
    add_stability = 0.1 # If there's 60-100% stability, add 10%
}

Within the tooltip, only effects that would be executed are shown. The effects within an unfulfilled if statement (or an else/else_if that's not read due to the if statement being met) will be hidden from the player, and so will the trigger. In order to avoid player confusion, custom effect tooltips can be used to tell the player what this effect block would do, such as being used within an else.

Random effects

If you want an effect to have a random chance to be done or have nothing happen otherwise, the random = { ... } block is the simplest way to accomplish that:

random = {
    chance = 80
    add_stability = 0.4
    add_war_support = 0.3
}

This in particular will have an 80% chance to add 40% stability and 30% war support and, accordingly, a 20% chance to do nothing. The chance here is on the scale from 0 to 100.

If you want the game to choose between effect blocks, random_list can be used instead. For example, if you wanted an effect to randomly given the player one out of four bonuses, you'd do the following:

random_list = {
    10 = {
        add_stability = 0.5
    }
    10 = {
        add_manpower = 10000
    }
    10 = {
        add_war_support = 0.5
    }
    10 = {
        army_experience = 100
    }
}

The number is not the chance, but the weight for each option, as they don't have to add up to 100 or any number. An option with the weight of 20 is twice as likely to be picked as the option with the chance of 10, for instance. In total, the probability for an option to be picked is equal to the weight of the option divided by the sum of all weights.

It is also possible to use modifiers (akin to MTTH blocks) to affect the weight of each possible random effect or to use variables as chances.

random_list = {
    30 = {
        modifier = {
            factor = 1.3
            has_country_flag = inward_perfect_flag
        }
        add_stability = 0.5
    }
    25 = {
        add_manpower = 10000
    }
    20 = {
        add_war_support = 0.5
    }
    my_variable = { # Taking "my_variable" as the variable's name, both "var:my_variable" and "my_variable" are valid options, left up to the developer's preference.
        army_experience = 100
    }
}

If the country flag inward_perfect_flag is set, it'll multiply the above chance of 30 by 1.3 to get 39. Meanwhile, my_variable will take the value of the according temp variable or the current scope's variable as the weight of the option.

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

This is only for decisions. Elsewhere, random seed is unfixed by default, making this argument unnecessary to set to "no".

Tooltip manipulation

参见:Localisation

The "tooltip" in this case refers to the text shown to the player in-game that explains what the effect block changes within the game, such as "+50 政治点数政治点数".

There are 3 ways to edit the tooltip within an effect block:

  • hidden_effect = { ... } is used in order to hide the effects within from the tooltip, making their execution not get shown to the player.
  • effect_tooltip = { ... } is, instead, used in order to put the effects into the tooltip without actually executing them.
  • custom_effect_tooltip = my_localisation_key is used in order to put an arbitrary paragraph of text as an effect that will get executed.

For example, this sample focus' completion reward utilises all three:

completion_reward = { 
    hidden_effect = {
        every_subject_country = { country_event = my_event.1 }
    }
    custom_effect_tooltip = send_event_to_subjects_tt
    effect_tooltip = {
        add_political_power = 100
    }
    custom_effect_tooltip = reject_war_tt
}

In this case, send_event_to_subjects_tt and reject_war_tt are localisation keys defined within any /Hearts of Iron IV/localisation/english/*_l_english.yml file encoded with UTF-8-BOM, assuming the English language.

 send_event_to_subjects_tt: "Sends a demand to our every subject.\nIf they agree, we get the following for each subject:"
 reject_war_tt: "If they reject the demand, we gain a wargoal against them."

In-game, this will appear as such:

Effect:

Sends a demand to our every subject.
If they agree, we get the following for each subject:
Political Power: +100
If they reject the demand, we gain a wargoal against them.

Noticably, the effect that fires the country event gets hidden from the tooltip. After completing the focus, the only thing that happens is that every subject country receives an event with the ID of my_event.1, the country does not immediately gain 100 political power.

Meta effects

Meta effects allow you to use non-dynamic effects (the ones that do not accept modifiers and can only use static tokens or constant values) as if they were accepting variables.

add_equipment_to_stockpile = {
    type = infantry_equipment_2
    amount = eq_amount
}

In the effect shown above, amount of equipment added is dynamic and can be set using the variable "eq_amount". However, this effect does not let you use a variable as equipment type. You can not store "infantry_equipment_2" in a variable and use it here.

However, meta effects will let you use variables and scripted localization within them to build effects as if they were texts and run them. Let's make previous effect accept equipment type and equipment level as variables stored in "eq_type" and "eq_level".

set_variable = { eq_type = 1 } # Sets the equipment type to "1", which determines the equipment given using scripted localisation, included below
set_variable = { eq_amount = 10 } # Sets the amount of equipment given to 10
set_variable = { eq_level = 2 } # Sets the equipment level to 2, which is used directly in the meta effect, no scripted localisation required

meta_effect = { # The actual meta effect. This can go anywhere you need it: in a decision, in a scripted effect, in a scripted GUI click effect, etc...
    text = {
        add_equipment_to_stockpile = {
            type = [EQ_TYPE]_[EQ_LEVEL]
            amount = eq_amount
        }
    }
    EQ_LEVEL = "[?eq_level|.0]" # Gets the "eq_level" variable and saves it as "EQ_LEVEL" for the meta effect to use
    EQ_TYPE = "[This.GetEquipmentName]" # Gets the equipment type from scripted localisation, included below, based on the "eq_type" variable, and saves it as "EQ_TYPE" for the meta effect to use
}
# The scripted localization for the "eq_type" variable, which goes in a scripted localisation file
defined_text = { # Since the "eq_type" variable in this example is equal to 1, the equipment given by the effect is "artillery_equipment"
    name = GetEquipmentName
    text = {
        trigger = {
            check_variable = { eq_type = 0 }
        }
        localization_key = "infantry_equipment"
    }
    text = {
        trigger = {
            check_variable = { eq_type = 1 }
        }
        localization_key = "artillery_equipment"
    }
}

As you can see, we have created a meta_effect that takes two arguments. These arguments will be used replacing the parameters [EQ_TYPE] and [EQ_LEVEL] inside the meta effect. EQ_LEVEL will be replaced by [?eq_level|.0] which is the integer value of eq_level (in this case 2.000 becomes 2). EQ_TYPE is a bit more complicated, it is being replaced by a scripted localization. This scripted localization will check eq_type variable and depending on its value it will return the key token for the equipment. If it is 0, it will return "infantry_equipment". If it is 1, it will return "artillery_equipment".

So the final result is [EQ_TYPE] is being replaced by "artillery_equipment" and [EQ_LEVEL] is being replaced by "2" and in the end our effect will be built as:

add_equipment_to_stockpile = {
    type = artillery_equipment_2
    amount = eq_amount
}

which will give you 10 artillery_equipment_2.

debug = yes can be added to meta effects. Which will print the final effect to game.log when the effect is executed and make debugging easier.

Scripted effects

Scripted effects serve a similar purpose to functions in that they can be defined in /Hearts of Iron IV/common/scripted_effects/*.txt and then used elsewhere as a shortened version. A scripted effect will never run by itself and requires being used as an effect elsewhere to be executed. Alongside that, the game allows the creation of custom console commands, which are scripted effects.

A scripted effect is defined simply as

scripted_effect_name = {
	<effects>
}

This example can be used as an effect in regular code as scripted_effect_name = yes.

Scripted effects can be accessed in console by typing e scripted_effect_name to run them.

To create a custom console command, the scripted effect's name should begin with d_. The console command itself does not include d_, so d_test_command would be run in console as test_command
In custom console commands, the country running the command is FROM, while ROOT is the selected country, state, or character. Anything entered after the console command, separated by spaces like test_command 123 321 GER is added to the 'args' temp array. An example of a scripted effect which will transfer every state entered as an argument to the country that runs the console command is

d_transfer_states = {
	for_each_scope_loop = {
		array = args
		FROM = {
			transfer_state = PREV
		}
	}
}

used like transfer_states 123 321

Useful scripted effects

These scripted effects are defined in base game and might be useful to keep in the mod to cut down on the amount of code. As scripted effects, all of these use a boolean value as argument.

Base game scripted effects:
Name Scope Example Description Notes
instantiate_collaboration_government Country
instantiate_collaboration_government = yes
Creates a collaboration government, with the current scope as overlord. The target of the collaboration government is stored in the country_to_initiate temp variable.
upgrade_economy_law Country
upgrade_economy_law = yes
Switches the economy law one level towards total mobilisation. If already on total mobilisation, adds 150 政治点数政治点数. Must be adjusted manually for new laws.
gain_random_agency_upgrade Country
gain_random_agency_upgrade = yes
Grants a random available intelligence agency upgrade. Only results in an agency being created if one doesn't exist.
add_ruling_to_dem Country
add_ruling_to_dem = yes
All of the ruling party's popularity gets added to the 民主主义民主主义 ideology group. Requires manual adjustment if new ideologies are added. See also: add_ruling_to_fas, add_ruling_to_com, add_ruling_to_neu
remove_any_country_role_from_character Character
remove_any_country_role_from_character = yes
Removes all advisor roles from the current scope. Requires manual adjustment if new slots are added.
increase_state_category State
increase_state_category = yes
Changes the state category to the next one that contains more building slots. Has no effect on small islands, megalopolises, or large_city (Dense Urban Region). city (Urban Region) gets upgraded straight to Metropolis, skipping large_city.
lerp Any
lerp = yes
Creates the lerp_result regular variable with [math]\displaystyle{ result := a + (b-a)\cdot x }[/math] [math]\displaystyle{ a }[/math], [math]\displaystyle{ b }[/math], and [math]\displaystyle{ x }[/math] are stored as lerp_a, lerp_b, lerp_x temp variables. [math]\displaystyle{ x }[/math] is clamped between 0 and 1.
store_core_states_on_game_start Country
store_core_states_on_game_start = yes
Stores the current core states of the current scope in an array in ROOT's scope. The created array will be named core_states_at_game_start. Intended to be called in country history only once.