条件:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.13
无编辑摘要
 
(未显示6个用户的6个中间版本)
第1行: 第1行:
{{Version|1.5}}
{{Version|1.13}}
{{需要翻译|译者=霜泽图书馆}}
'''Conditions''' (also known as '''Triggers''') are used to check whether certain conditions are fulfilled in the game's current state or not, without being able to change anything in the game's state.{{cref|a}} These return a [[wp:Boolean_data_type|boolean]] (true or false), which may be interpreted by the block where it's used. Usually blocks that allow using triggers are an [[#AND|AND]] unless stated otherwise, which would instantly stop execution upon receiving a single false statement and return false.


'''条件'''(也叫触发器)用来在效果发生时进行判定。当一个触发器返回真值,效果就会实施,否则就会停止。一些触发器,包括默认的AND触发器,允许相互嵌套以创建更复杂的表达。
The list of triggers may be outdated. A complete, but unsorted, list of triggers can be found in {{path|documentation/triggers_documentation.html}} or {{path|documentation/triggers_documentation.md}}. As of 1.12.14, this file was last updated in the version 1.11.4.


==任意作用域==
<!--is_operation_type is a trigger that exists according to documentation, but it's never used in-game. Please check.
{{SVersion|1.9}}
The following seem to be related localisation keys:
TRIGGER_IS_NOT_OPERATION:0 "Is not operation of $OPERATION|H$"
TRIGGER_IS_OPERATION:0 "Is operation of $OPERATION|H$"
!-->


这些触发器不依赖任何特定的作用域。
== Operators ==
{{SVersion|1.13}}


{| class="wikitable sortable" width="100%"
Every trigger uses one of the three operators: The equality sign <code>=</code> or the comparison signs <code>></code> and <code><</code>.
! width="10%" | 名称
 
! width="25%" | 参数类型
The equality sign can either mean strict equality (Unlike previous games in the series where it checked for being equal or greater than) or can serve as a way to introduce a block of additional triggers, as in <code>has_opinion = { target = GRE value < -10 }</code>. The comparison signs serves as strict comparison: <code>has_political_power > 100</code> will not be true if the country has exactly 100 political power, for instance.
! width="25%" | 样例
 
! width="20%" | 描述
Not all triggers support the equality sign or comparison signs. See the details for each trigger in the notes for it. If not stated otherwise, the trigger only supports the equality sign.
! width="15%" | 注释
 
! width="5%" | 加入的版本
==Context scopes==
|-
{{SVersion|1.13}}
|always
 
|<code><bool></code><br>布尔型。
There are three general scopes all triggers operate in:
|<pre>always = yes</pre>
*country
|总是返回真值或假值,在debug时很有用。
*state
|
*character
|1.0
 
|-
They give context to a trigger by stating what the trigger is checking against.
 
Each country acts as a sub-scope of the general country scope, i.e. <code>GER = { }</code> will check only against Germany, whereas <code>any_country</code> will check against all countries. Likewise for states and characters.
 
Triggers won't work in scopes they are not assigned to. Country triggers will not work for states or vice-versa.
 
==Scopes==
{{Main|Scopes}}
These don't serve as triggers, but rather as scopes that change for whom the triggers are being checked. Each one also serves as an [[#AND|AND statement]].
===Trigger scopes===
{{#lsth:Scopes|Trigger scopes}}
===Dual scopes===
{{#lsth:Scopes|Dual scopes}}
 
==Flow control tools==
{{Main|Scopes#Flow control tools}}
These are triggers that serve as more of a way to establish a connection in how triggers are evaluated. Each one serves as a trigger scope with additional arguments and can be used regardless of scope.
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Flow control tools:}}<br/>
! width="10%" | Name
! width="25%" | Additional parameters
! width="25%" | Examples
! width="20%" | Description
! width="15%" | Notes
! width="5%" | Version Added
|-id="AND"
|AND
|AND
| 触发器。
|None
|<pre>AND = {
|<pre>AND = {
    original_tag = GER
    original_tag = GER
    has_stability > 0.5
    has_stability > 0.5
}</pre>
}</pre>
| 如果下属的触发器中有任意为假,则返回假值,否则返回真值。计算在第一个出现假值的下属触发器处停止。
|Returns false if any sub-trigger returns false, true otherwise. Evaluation stops at the first false sub-trigger.
| 几乎所有需要触发器的地方都使用隐式AND触发器。
|Only necessary within [[#OR|OR statements]] and [[#NOT|NOT statements]], as everything else is implicitly AND.
|1.0
|1.0
|-
|-id="OR"
|OR
|OR
| 触发器。
|None
|<pre>OR = {
|<pre>OR = {
    original_tag = ENG
    original_tag = ENG
    original_tag = USA
    original_tag = USA
}</pre>
}</pre>
| 如果下属的触发器中有任意为真,则返回真值,否则返回假值。计算在第一个出现真值的下属触发器处停止。
|Returns true if any sub-trigger returns true, false otherwise. Evaluation stops at the first true sub-trigger.
|
|
|1.0
|1.0
|-
|-id="NOT"
|NOT
|NOT
| 触发器。
|None
|<pre>NOT = {
|<pre>NOT = {
    has_stability > 0.5
    has_stability > 0.5
    has_war_support > 0.5
    has_war_support > 0.5
}</pre>
}</pre>
| 如果下属的触发器中有任意为真,则返回假值,否则返回真值。计算在第一个出现真值的下属触发器处停止。
|Returns false if any sub-trigger returns true, true otherwise. Evaluation stops at the first true sub-trigger.
|
|Equivalent to a NOR rather than a NAND.
|1.0
|1.0
|-
|-id="count_triggers"
|count_triggers
|count_triggers
|<code>amount = <int></code><br><br>触发器。
|<code>amount = <int></code><br> The amount of triggers that need to be fulfilled.
|<pre>count_triggers = {
|<pre>count_triggers = {
    amount = 2
    amount = 2
第61行: 第92行:
    12 = { state_population = 100000 }
    12 = { state_population = 100000 }
}</pre>
}</pre>
| 对所有下属触发器的运算结果(假=0 ,真=1 )加和。如果和大于等于 <code>amount</code> 所要求的值则返回真。
|Sums the results of all sub-triggers (false=0, true=1) and returns true if the sum is at least <code>amount</code>.
|
|
|1.5
|1.5
|-
|-id="if"
|if
|if
|<code>limit = <AND-trigger></code><br />
|<code>limit = <trigger block></code><br>
条件。
<code>else_if = <if-trigger></code><br>
<code>else_if = <if-trigger></code><br />
Alternative condition. Optional.<br>
替代条件。可选。<br />
<code>else = <AND-trigger></code><br>
<code>else = <AND-trigger></code><br />
Final alternative condition. Optional.
最终替代条件。可选。<br>
<br />触发器。
|<pre>if = {
|<pre>if = {
    limit = {
    limit = {
第78行: 第107行:
    }
    }
    has_political_power > 100
    has_political_power > 100
    else = {
}
      has_war_support > 0.5
else_if = {
    limit = {
      has_dlc = "Waking the Tiger"
    }
    }
}</pre>
   has_war_support > 0.5
| 如果<code>limit</code> 为真,下面的触发器被当做是一个AND触发器。如果<code>limit</code> 为假,<code>else_if</code> 会按顺序尝试判断,最终到<code>else</code> 语句(如果存在的话)'' 否则返回真''
}
|<code>else_if</code> <code>else</code> 也可以直接跟在if触发器的后面,而不是嵌套。
else = {
   always = no
}
</pre>
|If <code>limit</code> is true, the sub-triggers are evaluated like an AND-trigger. If <code>limit</code> is false, <code>else_if</code> blocks are tried in sequence and finally <code>else</code> (if present). ''Otherwise true is returned''.
|Both nested (As in inside of <code>if = { ... }</code>) and unnested (As in the example) <code>else</code> and <code>else_if</code> exist. In case of overlap, unnested is preferred.
 
Can be useful for tooltip management: same as in effects, if the limit is unmet, nothing appears. If it is met, then the limit is hidden while the condition outside of the limit appears in the tooltip.
 
<code>if = { limit = { trigger_1 = yes } trigger_2 = yes }</code> is equivalent to <code>OR = { NOT = { trigger_1 = yes } trigger_2 = yes }</code>, but generates a different tooltip.
|1.0
|1.0
|-
|-id="hidden_trigger"
|hidden_trigger
|hidden_trigger
| 触发器。
|None
|<pre>hidden_trigger = {
|<pre>hidden_trigger = {
    country_exists = GER
    country_exists = GER
}</pre>
}</pre>
| 与AND触发器类似,但是不会出现在提示条中。
|Hides the triggers from the tooltip shown to the player.
|
|Also serves as an [[#AND|AND statement]].
|
|1.0
|-
|-id="custom_trigger_tooltip"
|custom_trigger_tooltip
|custom_trigger_tooltip
|<code>tooltip = <string></code><br><br>触发器。
|<code>tooltip = <string></code><br/>The localisation key to use.
|<pre>custom_trigger_tooltip = {
|<pre>custom_trigger_tooltip = {
    tooltip = sunrise_invasion_tt
    tooltip = sunrise_invasion_tt
第105行: 第145行:
    }
    }
}</pre>
}</pre>
| 和AND触发器类似,但是提示文字会显示<code>tooltip</code> 的内容。在样例中是<code>sunrise_invasion_tt</code> (在本地化文件中定义)。
|Hides the triggers from the tooltip shown to the player and instead uses the specified localisation key.
|Also serves as an [[#AND|AND statement]]. When required to be false (as with [[#NOT|NOT]]), the game will use the same localisation key but with <code>_NOT</code> appended (as in <code>sunrise_invasion_tt_NOT</code> in the example). If it doesn't exist, the same tooltip as for being true will get re-used, possibly causing player confusion.
|1.0
|}
 
== Any scope ==
{{SVersion|1.13}}
 
These triggers do not require any particular scope.
=== General ===
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|General any-scoped triggers:}}<br/>
! width="10%" | Name
! width="25%" | Parameters
! width="25%" | Examples
! width="20%" | Description
! width="15%" | Notes
! width="5%" | Version Added
|-id="always"
|always
|<code><bool></code><br>Boolean.
|<pre>always = yes</pre>
|Always returns true or false. Useful for debugging.
|
|
|
|1.0
|-
|-id="has_global_flag"
|has_global_flag
|has_global_flag
|<code><string></code><br> 要检查的flag。
|<code><string></code><br>The flag to check.
|<pre>has_global_flag = my_flag</pre>
|<pre>has_global_flag = my_flag</pre>
| 检查某一特定flag是否已被设定。
|Checks if the specified flag has been set.
|
|
|1.0
|1.0
|-
|-id="has_global_flag"
|has_global_flag
|has_global_flag
|<code>flag = <string></code><br> 要检查的flag。<br>
|<code>flag = <string></code><br>The flag to check.<br>
<code>value = <int></code><br> 要检查的flag值。可选。<br>
<code>value = <int></code><br>The flag value to check for. Optional.<br>
<code>date = <date></code><br> 要检查的flag创建的日期。可选。<br>
<code>date = <date></code><br>The flag creation date to check for. Optional.<br>
<code>days = <int></code><br> 要检查的flag存在的天数。可选。
<code>days = <int></code><br>The duration the flag existed for. Optional.
|<pre>
|<pre>
has_global_flag = {
has_global_flag = {
第129行: 第191行:
}
}
</pre>
</pre>
| 比较特定flag上次设定的日期,设定后存在的天数,和/ 或flag值。
|Compares the specified flag's last set date, days since last set, and/or value.
| 如果没有设定,值的比较默认为<code>>0</code> <code>value</code> 限制在-32768 和32767之间。
|If not set, the value comparison is <code>>0</code>. <code>value</code> is limited between -32768 and 32767.
|1.0
|1.0
|-
|-id="has_dlc"
|has_dlc
|has_dlc
|<code><string></code><br> 要检查的DLC名。
|<code><string></code><br>The DLC name to check for.
|<pre>has_dlc = "Waking the Tiger"</pre>
|<pre>has_dlc = "Waking the Tiger"</pre>
| 检查特定DLC是否已开启。
|Checks if the specified DLC is enabled.
|
|
|1.0
|1.0
|-
|-id="has_start_date"
|has_start_date
|has_start_date
|<code><date></code><br> 要检查的日期。
|<code><date></code><br>The date to check for.
|<pre>has_start_date > 1950.01.01</pre>
|<pre>has_start_date > 1950.01.01</pre>
| 检查特定日期是否是当前游戏的开始日期。
|Checks if the specified date was the start date used for the current game.
| 必须使用> < 运算符。
|Year.Month.Day
Must use either > or < operators.
|1.0
|1.0
|-
|-id="date"
|date
|date
|<code><date></code><br> 要检查的日期。
|<code><date></code><br>The date to check for.
|<pre>date < 1950.01.01</pre>
|<pre>date < 1950.01.01</pre>
| 检查指定的日期是否与当前的日期相对应。
|Checks if the specified date against the current date.
| 必须使用> < 运算符。
|Year.Month.Day
Must use either > or < operators.
|1.0
|1.0
|-
|-id="difficulty"
|difficulty
|difficulty
|<code><int></code><br> 难度值。
|<code><int></code><br>The difficulty value.
|<pre>difficulty > 0</pre>
|<pre>difficulty > 0</pre>
| 检查指定的难度是否与当前的难度相对应。
|checks if the specified difficulty against the current difficulty.
| 必须使用> < 运算符。
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="has_any_custom_difficulty_setting"
|has_any_custom_difficulty_setting
|has_any_custom_difficulty_setting
|<code><bool></code><br> 布尔型。
|<code><bool></code><br>Boolean.
|<pre>has_any_custom_difficulty_setting = yes</pre>
|<pre>has_any_custom_difficulty_setting = yes</pre>
| 检查任何国家是否有自定义难度选项正在使用。
|Checks if any custom difficulty setting is changed from their default value.
|
|Custom difficulty in this case refers to {{path|common/difficulty_settings/*.txt}}, used in base game to strengthen a specific country.
|1.0
|1.0
|-
|-id="has_custom_difficulty_setting"
|has_custom_difficulty_setting
|has_custom_difficulty_setting
|<code><string></code><br> 要检查的设置。
|<code><string></code><br>The setting to check.
|<pre>has_custom_difficulty_setting = custom_diff_strong_sov</pre>
|<pre>has_custom_difficulty_setting = custom_diff_strong_sov</pre>
|
|Checks if the specified custom difficulty setting is changed from the default value.
|
|Custom difficulty in this case refers to {{path|common/difficulty_settings/*.txt}}, used in base game to strengthen a specific country.
|1.0
|1.0
|-
|-id="game_rules_allow_achievements"
|game_rules_allow_achievements
|game_rules_allow_achievements
|<code><bool></code><br> 布尔型。
|<code><bool></code><br>Boolean.
|<pre>game_rules_allow_achievements = yes</pre>
|<pre>game_rules_allow_achievements = yes</pre>
| 检查是否所有使用中的游戏规则允许完成成就。
|Checks if all of the active game rule options allow achievements.
|
|
|1.9
|1.9
|-
|-id="country_exists"
|country_exists
|country_exists
|<code><scope> / <variable></code><br> 要检查的国家。
|<code><scope> / <variable></code><br>The country to check.
|<pre>country_exists = GER</pre>
|<pre>country_exists = GER</pre>
| 检查特定国家目前是否在游戏中存在。
|Checks if the specified country currently exists in game.
|
|1.0
|1.0
|-
|-id="is_ironman"
|is_ironman
|is_ironman
|<code><bool></code><br> 布尔型。
|<code><bool></code><br>Boolean.
|<pre>is_ironman = yes</pre>
|<pre>is_ironman = yes</pre>
| 检查当前游戏是否处于铁人模式。
|Checks if the current game is running in Ironman mode.
|
|
|1.0
|1.0
|-
|-id="is_historical_focus_on"
|is_historical_focus_on
|is_historical_focus_on
|<code><bool></code><br> 布尔型。
|<code><bool></code><br>Boolean.
|<pre>is_historical_focus_on = yes</pre>
|<pre>is_historical_focus_on = yes</pre>
| 检查当前游戏是否处于历史国策开启的模式。
|Checks if the current game is running with Historical Focuses on.
|
|
|1.0
|1.0
|-
|-id="is_tutorial"
|is_tutorial
|is_tutorial
|<code><bool></code><br> 布尔型。
|<code><bool></code><br>Boolean.
|<pre>is_tutorial = yes</pre>
|<pre>is_tutorial = yes</pre>
| 检查当前游戏是否处于教程模式。
|Checks if the current game is running in Tutorial mode.
|
|
|1.0
|1.0
|-
|-id="is_debug"
|is_debug
|is_debug
|<code><bool></code><br> 布尔型。
|<code><bool></code><br>Boolean.
|<pre>is_debug = yes</pre>
|<pre>is_debug = yes</pre>
| 检查当前游戏是否处于debug模式(用-debug 模式启动游戏)。
|Checks if game is in debug mode (launched with -debug argument).
|
|
|1.9
|1.9
|-
|-id="threat"
|threat
|threat
|<code><float></code><br> 要检查的值。
|<code><float></code><br>The amount to check for.
|<pre>threat > 0.5</pre>
|<pre>threat > 0.5</pre>
| 检查世界紧张度是否达到某个特定的值。
|Checks if World Tension is above the specified amount.
| 必须使用> < 运算符。
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="has_game_rule"
|has_game_rule
|has_game_rule
|<code><string></code><br> 要检查的游戏规则<br>
|<code><string></code><br>The game rule to check for.<br>
<code><string> / <bool></code><br> 检查为真/假的选项<br>
<code><string> / <bool></code><br>The option to check.<br>
|<pre>has_game_rule = { rule = GER_can_remilitarize_rhineland option = yes }</pre>
|<pre>has_game_rule = { rule = GER_can_remilitarize_rhineland option = yes }</pre>
| 检查一个游戏规则是否设定成特定的选项。
|Checks if a game rule is set to a particular option.
|
|
|1.5
|1.5
|}
|}


== 国家作用域==
===Variables===
{{SVersion|1.5}}
{{SVersion|1.13}}


Can be used in '''country''' scope.
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
 
|+ {{nowrap|Variable-related triggers:}}<br/>
===总览===
! width="10%" |Name
{{SVersion|1.5}}
 
{| class="wikitable sortable" width="100%"
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Parameters
! width="25%" |Examples
! width="25%" |Examples
第247行: 第308行:
! width="15%" |Notes
! width="15%" |Notes
! width="5%" |Version Added
! width="5%" |Version Added
|-
|-id="has_variable"
|exists
|has_variable
|<code><bool></code><br> 是否存在
|<code><variable></code><br>The variable to check.
|<pre>exists = yes</pre>
|<pre>has_variable = my_var</pre>
|Checks if the current scope exists in game.
|Checks if the specified variable exists for the current scope.
|
|
|1.0
|1.5
|-
|-id="check_variable"
|tag
|check_variable
|<code><scope> / <variable></code><br>指向某个国家
|<code>var = <variable></code><br>The variable to check.<br>
|<pre>tag = GER</pre>
<code>value = <float> / <variable></code><br>The value to check for.<br>
<pre>tag = var:my_country</pre>
<code>compare = <type></code><br>The type of comparison. Optional, can use < or > instead.
|Checks if the current scope is the specified country.
|<pre>
|
check_variable = {
|1.0
    var = my_var
|-
    value = 10
|original_tag
   compare = greater_than_or_equals
|<code><scope> / <variable></code><br>指向某个国家
}
|<pre>original_tag = GER</pre>
</pre>
<pre>original_tag = var:my_country</pre>
<pre>
|Checks if the current scope was ever the specified country.
check_variable = {
|
    my_var > 10
|1.0
|-
|is_ai
|<code><bool></code><br>是否为AI
|<pre>is_ai = yes</pre>
|Checks if the current scope is AI.
|
|1.0
|-
|has_country_flag
|<code><string></code><br>The flag to check.
|<pre>has_country_flag = my_flag</pre>
|Checks if the current scope has the specified flag.
|
|1.0
|-
|has_country_flag
|<code>flag = <string></code><br>The flag to check.<br>
<code>value = <int></code><br>The flag value to check for. Optional.<br>
<code>date = <date></code><br>The flag creation date to check for. Optional.<br>
<code>days = <int></code><br>The duration the flag existed for. Optional.
|<pre>
has_country_flag = {
    flag = my_flag
    days > 30
   date > 1936.6.1
    value > 0
}
}
</pre>
</pre>
|Compares the specified flag's last set date, days since last set, and/or value.
|Check the specified variable for the current scope.
|If not set, the value comparison is <code>>0</code>. <code>value</code> is limited between -32768 and 32767.
|Possible compare types:
|1.0
*less_than
|-
*less_than_or_equals
|has_cosmetic_tag(拥有显示tag)
*greater_than
|<code><string></code><br>指向某个显示tag(对应效果中的更改显示tag)
*greater_than_or_equals
|<pre>has_cosmetic_tag = SOV_custom</pre>
*equals
|Checks if the current scope has the specified cosmetic tag active.
*not_equals
|
|1.5
|1.5
|-
|}
|has_decision
 
|<code><string></code><br>The decision to check.
Remember that variables need to refer to the scope they were set in. This means you can't check a country variable in a state scope without scoping the variable
|<pre>has_decision = my_decision</pre>
 
|Checks if the current scope has the specified decision activated.
For example, to get the country variable whilst in a state scope, you'd do the following:
|
 
|1.5
<pre>
|-
<country> = {
|has_dynamic_modifier
   <state> = {
|<code>modifier = <string></code><br>The dynamic_modifier to check. <br>
     limit = {
<code>scope = <scope></code><br> The country to check. Optional, if the original modifier has been targeted.
       check_variable = { from.my_country_var > 0.0 }
|<pre>has_dynamic_modifier = {
     }
   modifier = my_dynamic_modifier
    }
    scope = GER
}
}
</pre>
</pre>
|Checks if the current scope has the specified dynamic modifier activated.
 
|
See [[Variables]] for more information.
|1.6
 
|-
=== Debugging ===
|has_active_mission
These are usable as both effects and triggers and are used for debugging, with the player never seeing them.
|<code><string></code><br>The mission to check.
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|<pre>has_active_mission = my_mission</pre>
|+ {{nowrap|Debugging-helpful triggers:}}<br/>
|Checks if the current scope has the specified mission active.
! width="10%" |Name
|
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="log"
|log
|<code><string></code><br />What to log. Supports dynamic localisation.<br/>
|<pre>log = "Added [?temp_add] to [THIS.GetTag]'s variable [?THIS.varvalue]"</pre>
|Appends an entry into the game.log and, if open, the console when evaluating the trigger.
|game.log is stored within {{path|logs/}} in the [[Modding|user directory]]
|1.5
|-id="print_variables"
|print_variables
|<code>print_global = <bool></code><br />Print global variables. Defaults to <code>no</code>.<br />
<code>var_list = <list></code><br />The variables to print. Defaults to all variables.<br />
<code>file = <string></code>The file path to log to. Defaults to "variable_dump". Does not include the <code>.log</code> extension.<br />
<code>text = <string></code>Text to prepend. Defaults to "No Header".<br />
<code>append = <bool></code>Whether to append to the file instead of overwrite. Defaults to <code>yes</code>
|<pre>print_variables = {
   var_list = { myvar1 myvar2 }
   file = "my_dump_file"
   text = "my header"
}</pre>
|Dumps the specified variables from the current scope and optionally the global scope into a log file with the specified name.
|The log will be within {{path|logs/variable_dumps/}} in the [[Modding|user directory]]. See also [[Variables#Debugging|debugging variables]].
|1.5
|1.5
|-
|has_focus_tree
|<code><string></code><br>The focus tree to check.
|<pre>has_focus_tree = soviet_tree</pre>
|Checks if the current scope has the specified focus tree.
|
|1.3
|-
|has_completed_focus(完成国策)
|<code><string></code><br>指定某个国策是否完成
|<pre>has_completed_focus = my_focus</pre>
|Checks if the current scope has the specified focus completed.
|
|1.0
|-
|focus_progress
|<code>focus = <string></code><br>The focus to check.<br>
<code>progress = <string></code><br>The progress to check for.
|<pre>focus_progress = {
   focus = my_focus
   progress > 0.5
}
</pre>
|Checks if the specified focus has been completed the specified percent for the current scope.
|Must use either > or < operators for progress.
|1.0
|}
|}


===政治===
== Country scope ==
{{SVersion|1.5}}
{{SVersion|1.13}}
 
Can be used in '''country''' scope.


{| class="wikitable sortable" width="100%"
=== General ===
! width="10%" |Name
{{SVersion|1.13}}
! width="25%" |Parameters
 
! width="25%" |Examples
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
! width="20%" |Description
|+ {{nowrap|General country-scoped triggers:}}<br/>
! width="15%" |Notes
! width="10%" | Name
! width="5%" |Version Added
! width="25%" | Parameters
|-
! width="25%" | Examples
|has_political_power
! width="20%" | Description
|<code><float></code><br>The amount to check for.
! width="15%" | Notes
|<pre>has_political_power > 100</pre>
! width="5%" | Version Added
|Checks if the current scope has the specified amount of political power.
|-id="exists"
|Must use either > or < operators.
|exists
|<code><bool></code><br>Boolean.
|<pre>exists = yes</pre>
|Checks if the current scope exists in game.
|
|1.0
|-id="tag"
|tag
|<code><scope> / <variable></code><br>The country to check.
|<pre>tag = GER</pre>
<pre>tag = var:my_country</pre>
|Checks if the current scope is the specified country.
|Only checks the actual tag while excluding dynamic countries, see [[#original_tag|original_tag]] if they should be included.
|1.0
|-id="original_tag"
|original_tag
|<code><scope> / <variable></code><br>The country to check.
|<pre>original_tag = GER</pre>
<pre>original_tag = var:my_country</pre>
|Checks if the current scope originates from the specified country.
|This also includes dynamic countries: civil war breakaways and countries created via [[Effect#create_dynamic_country|create_dynamic_country]]. True for the original country.
|1.0
|1.0
|-
|-id="is_ai"
|political_power_daily
|is_ai
|<code><float> / <variable></code><br>The amount to check for.
|<code><bool></code><br>Boolean.
|<pre>political_power_daily > 1</pre>
|<pre>is_ai = yes</pre>
|Checks if the current scope has the specified amount of daily political power gain.
|Checks if the current scope is AI.
|Must use either > or < operators.
|1.5
|-
|political_power_growth
|<code><float> / <variable></code><br>The amount to check for.
|<pre>political_power_growth > 1</pre>
|Checks if the current scope has the specified amount of daily political power gain.
|Must use either > or < operators.
|1.5
|-
|command_power
|<code><float> / <variable></code><br>The amount to check for.
|<pre>command_power > 1</pre>
|Checks if the current scope has the specified amount of command power.
|Must use either > or < operators.
|1.5
|-
|command_power_daily
|<code><float> / <variable></code><br>The amount to check for.
|<pre>command_power_daily > 1</pre>
|Checks if the current scope has the specified amount of daily command power gain.
|Must use either > or < operators.
|1.5
|-
|has_war_support
|<code><float> / <variable></code><br>The amount to check for.
|<pre>has_war_support > 0.5</pre>
|Checks if the current scope has the specified percentage of War Support.
|Must use either > or < operators.
|1.5
|-
|has_stability
|<code><float> / <variable></code><br>The amount to check for.
|<pre>has_stability > 0.5</pre>
|Checks if the current scope has the specified percentage of Stability.
|Must use either > or < operators.
|1.5
|-
|<ideology>
|<code><ideology> = <float></code><br>The amount of the ideology to check for.
|<pre>fascism > 0.5</pre>
|Checks if the current scope has the specified ideology above the specified amount.
|
|
|1.0
|1.0
|-
|-id="has_collaboration"
|has_government
|has_collaboration
|<code><string></code><br>The ideology to check for.
|<code>target = <country></code><br>The country to check.<br/>
|<pre>has_government = fascism</pre>
<code>value <> <decimal></code><br/>The value of the collaboration on the 0-1 scale.
|Checks if the current scope ruling party is the specified ideology.
|<pre>has_collaboration = {
   target = GER
   value > 0.5
}</pre>
|Checks if the current scope has a collaboration level in the target scope.
|The target is occupied by the current scope. Must use < or > in the value argument.
|1.9
|-id="has_country_flag"
|has_country_flag
|<code><string></code><br>The flag to check.
|<pre>has_country_flag = my_flag</pre>
|Checks if the current scope has the specified flag.
|
|
|1.0
|1.0
|-
|-id="has_country_flag"
|has_elections
|has_country_flag
|<code><bool></code><br>Boolean.
|<code>flag = <string></code><br>The flag to check.<br>
|<pre>has_elections = yes</pre>
<code>value = <int></code><br>The flag value to check for. Optional.<br>
|Checks if the current scope holds elections.
<code>date = <date></code><br>The flag creation date to check for. Optional.<br>
|
<code>days = <int></code><br>The duration the flag existed for. Optional.
|<pre>
has_country_flag = {
   flag = my_flag
   days > 30
   date > 1936.6.1
   value > 0
}
</pre>
|Compares the specified flag's last set date, days since last set, and/or value.
|If not set, the value comparison is <code>>0</code>. <code>value</code> is limited between -32768 and 32767.
|1.0
|1.0
|-
|-id="has_cosmetic_tag"
|is_staging_coup
|has_cosmetic_tag
|<code><bool></code><br>Boolean.
|<code><string></code><br>The cosmetic tag to check.
|<pre>is_staging_coup = yes</pre>
|<pre>has_cosmetic_tag = SOV_custom</pre>
|Checks if the current scope is staging a coup.
|Checks if the current scope has the specified cosmetic tag active.
|
|
|1.3
|1.5
|-
|-id="has_event_target"
|is_target_of_coup
|has_event_target
|<code><bool></code><br>Boolean.
|<code><event target></code><br>The event target to check.
|<pre>is_target_of_coup = yes</pre>
|<pre>has_event_target = my_var</pre>
|Checks if the current scope is the target of a coup.
|Checks if the current scope is assigned as the specified event target.
|
|
|1.0
|1.0
|-
|-id="has_decision"
|has_civil_war
|has_decision
|<code><bool></code><br>Boolean.
|<code><string></code><br>The decision to check.
|<pre>has_civil_war = yes</pre>
|<pre>has_decision = my_decision</pre>
|Checks if the current scope has a civil war active.
|Checks if the current scope has the specified decision activated.
|
|
|1.0
|1.5
|-
|-id="has_dynamic_modifier"
|civilwar_target
|has_dynamic_modifier
|<code><scope></code><br>The target country.
|<code>modifier = <string></code><br>The dynamic_modifier to check. <br>
|<pre>civilwar_target = GER</pre>
<code>scope = <scope></code><br> The country to check. Optional, if the original modifier has been targeted.
|Checks if the specified country is a target of a civil war.
|<pre>has_dynamic_modifier = {
|
    modifier = my_dynamic_modifier
|1.0
   scope = GER
|-
|has_manpower_for_recruit_change_to
|<code>value = <float></code><br>The amount to check for.
<code>group = <group></code><br>The group to check for.
|<pre>has_manpower_for_recruit_change_to = {
   value > 0.05
   group = mobilization_laws
}</pre>
|Checks if the current scope has the specified amount of manpower for changing the specified idea group.
|'''Must''' use either > or < operators as = operator checks for the '''exact''' value
|1.0
|-
|has_country_leader
|<code>id = <int></code><br>The id to check for. Optional.<br>
<code>name = <string></code><br>The name to check for. Optional.<br>
<code>ruling_only = yes</code><br>Limit check to ruling only.
|<pre>has_country_leader = {
    id = 10
}
}
</pre>
</pre>
<pre>
|Checks if the current scope has the specified dynamic modifier activated.
has_country_leader = {
   name = "John Smith"
   ruling_only = yes
}
</pre>
|Checks if the current scope has the specified country leader.
|
|
|1.3
|1.6
|-
|-id="has_active_mission"
|has_rule
|has_active_mission
|<code><string></code><br>The rule to check for.
|<code><string></code><br>The mission to check.
|<pre>has_active_mission = my_mission</pre>
|Checks if the current scope has the specified mission active.
|
|
<pre>
|1.5
has_rule = {
|-id="has_focus_tree"
    can_create_factions
|has_focus_tree
|<code><string></code><br>The focus tree to check.
|<pre>has_focus_tree = soviet_tree</pre>
|Checks if the current scope has the specified focus tree.
|
|1.3
|-id="has_completed_focus"
|has_completed_focus
|<code><string></code><br>The focus to check.
|<pre>has_completed_focus = my_focus</pre>
|Checks if the current scope has the specified focus completed.
|
|1.0
|-id="focus_progress"
|focus_progress
|<code>focus = <string></code><br>The focus to check.<br>
<code>progress = <string></code><br>The progress to check for.
|<pre>focus_progress = {
    focus = my_focus
   progress > 0.5
}
}
</pre>
</pre>
|Checks if the current scope has the specified country rule.
|Checks if the specified focus has been completed the specified percent for the current scope.
|
|Must use either > or < operators for progress.
|1.6
|1.0
|}
|-id="has_country_custom_difficulty_setting"
 
|has_country_custom_difficulty_setting
===建筑===
|<code><bool></code><br>Boolean.
{{SVersion|1.5}}
|<pre>has_country_custom_difficulty_setting = yes</pre>
 
|Checks if the any custom difficulty setting targeting the current scope is changed from the default value.
{| class="wikitable sortable" width="100%"
|Custom difficulty in this case refers to {{path|common/difficulty_settings/*.txt}}, used in base game to strengthen a specific country.
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-
|<building>
|<code><building> = <int></code><br>The amount of the specified building to to check for.
|<pre>arms_factory > 10</pre>
|Checks if the current scope has the specified amount of the specified building.
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="has_terrain"
|num_of_military_factories
|has_terrain
|<code><terrain></code><br>Terrain.
|<pre>has_terrain = urban</pre>
|Checks if the current scope has any provinces of the specified terrain.
|Only can be used in country scope.
|1.11
|-id="is_dynamic_country"
|is_dynamic_country
|<code><bool></code><br/>Boolean.
|<pre>is_dynamic_country = yes</pre>
|Checks if the current scope is a dynamic country.
|Dynamic countries include those generated in civil wars as well as those generated with the create_dynamic_country effect, such as collaboration governments.
|1.11
|-id="num_of_supply_nodes"
|num_of_supply_nodes
|<code><int></code><br>The amount to check for.
|<pre>num_of_supply_nodes > 10</pre>
|Checks if the current scope has the specified amount of supply nodes under control.
|Can only use < or > operators.
|1.11
|-id="has_completed_custom_achievement"
|has_completed_custom_achievement
|<code>mod = <mod ID></code><br>The mod where the achievement is from.<br/>
<code>achievement = <achievement ID></code><br/>The name of the achievement.
|<pre>has_completed_custom_achievement = {
   mod = my_mod_unique_id
   achievement = my_achievement_token
}</pre>
|Checks if the player controlling the current scope has completed the specified custom achievement.
|The achievement (including the ID of the mod it's from) is defined within {{path|common/achievements/*.txt}} files<ref>[[forum:1544899|[Modding] Achievement for mods]]<br/>[[forum:1544901|Tutorial to write achievements files in your mod]]</ref>. The achievement could be completed during a previous session, not necessarily the current one.<br/>
If the mod defining the achievement is not loaded, the trigger evaluates as false.
|1.12.5
|-id="resource_count_trigger"
|<resource> (resource_count_trigger)
|<code><int></code><br>The amount to check for.
|<code><int></code><br>The amount to check for.
|<pre>num_of_military_factories > 10</pre>
|<pre>tungsten > 10
|Checks if the current scope has the specified amount of military factories.
</pre>
|Must use either > or < operators.
|Checks if the current scope has the specified amount of the specified resource.
|Must use either > or < operators for amount.
|-id="has_resources_in_country"
|has_resources_in_country
|<code>resource = <resource></code><br>The resource to check for.<br>
<code>amount = <int></code><br>The amount to check for.<br/>
<code>extracted = <bool></code><br/>Limits the checked resources only to those gained from the state's base value and multiplicative modifiers on top of it if true. Optional, defaults to false.<br/>
<code>buildings = <bool></code><br/>Limits the checked resources only to those gained from the state's modifiers applied by buildings. Optional, defaults to false.
|<pre>
has_resources_in_country = {
   resource = oil
   amount > 10
   extracted = yes
}
</pre>
|Checks if the current scope has the specified amount of the specified resource in reserve.
|Must use either > or < operators for amount. 'In reserve' means that it's not spent on equipment production or exports.
|1.12
|}
 
=== Politics ===
{{SVersion|1.13}}
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Political country-scoped triggers:}}<br/>
! width="10%" | Name
! width="25%" | Parameters
! width="25%" | Examples
! width="20%" | Description
! width="15%" | Notes
! width="5%" | Version Added
|-id="ideology_support_trigger"
|<ideology> (ideology_support_trigger)
|<code><ideology> = <float> / <variable></code><br>The amount of the ideology to check for.
|<pre>fascism > 0.5</pre>
<pre>democratic > party_popularity@communism</pre>
|Checks if the current scope has popularity of the specified ideology above the specified amount.
|
|1.0
|1.0
|-
|-id="has_political_power"
|num_of_civilian_factories
|has_political_power
|<code><int></code><br>The amount to check for.
|<code><float></code><br>The amount to check for.
|<pre>num_of_civilian_factories > 10</pre>
|<pre>has_political_power > 100</pre>
|Checks if the current scope has the specified amount of civilian factories.
|Checks if the current scope has the specified amount of political power.
|Must use either > or < operators.
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="political_power_daily"
|num_of_naval_factories
|political_power_daily
|<code><int></code><br>The amount to check for.
|<code><float> / <variable></code><br>The amount to check for.
|<pre>num_of_naval_factories > 10</pre>
|<pre>political_power_daily > 1</pre>
|Checks if the current scope has the specified amount of dockyards.
|Checks if the current scope has the specified amount of daily political power gain.
|Must use either > or < operators.
|Must use either > or < operators.
|1.0
|1.5
|-
|-id="political_power_growth"
|num_of_available_military_factories
|political_power_growth
|<code><int></code><br>The amount to check for.
|<code><float> / <variable></code><br>The amount to check for.
|<pre>num_of_available_military_factories > 10</pre>
|<pre>political_power_growth > 1</pre>
|Checks if the current scope has the specified amount of available military factories.
|Checks if the current scope has the specified amount of daily political power gain.
|Must use either > or < operators.
|Must use either > or < operators.
|1.0
|1.5
|-
|-id="command_power"
|num_of_available_civilian_factories
|command_power
|<code><int></code><br>The amount to check for.
|<code><float> / <variable></code><br>The amount to check for.
|<pre>num_of_available_civilian_factories > 10</pre>
|<pre>command_power > 1</pre>
|Checks if the current scope has the specified amount of available civilian factories.
|Checks if the current scope has the specified amount of command power.
|Must use either > or < operators.
|Must use either > or < operators.
|1.0
|1.5
|-
|-id="command_power_daily"
|num_of_available_naval_factories
|command_power_daily
|<code><int></code><br>The amount to check for.
|<code><float> / <variable></code><br>The amount to check for.
|<pre>num_of_available_naval_factories > 10</pre>
|<pre>command_power_daily > 1</pre>
|Checks if the current scope has the specified amount of available dockyards.
|Checks if the current scope has the specified amount of daily command power gain.
|Must use either > or < operators.
|Must use either > or < operators.
|1.0
|1.5
|-
|-id="has_war_support"
|num_of_factories
|has_war_support
|<code><int></code><br>The amount to check for.
|<code><float> / <variable></code><br>The amount to check for.
|<pre>num_of_factories > 10</pre>
|<pre>has_war_support > 0.5</pre>
|Checks if the current scope has the specified amount of military, civilian or dockyard factories.
|Checks if the current scope has the specified percentage of War Support.
|Must use either > or < operators.
|Must use either > or < operators.
|1.0
|1.5
|-
|-id="has_stability"
|num_of_civilian_factories_available_for_projects
|has_stability
|<code><int></code><br>The amount to check for.
|<code><float> / <variable></code><br>The amount to check for.
|<pre>num_of_civilian_factories_available_for_projects > 10</pre>
|<pre>has_stability > 0.5</pre>
|Checks if the current scope has the specified amount of civilian factories usable for projects.
|Checks if the current scope has the specified percentage of Stability.
|Must use either > or < operators.
|Must use either > or < operators.
|1.5
|1.5
|-
|-id="has_government"
|ic_ratio
|has_government
|<code>tag = <scope></code><br>The country to check.
|<code><ideology></code><br>The ideology group to check for.<br/>
<code>ratio = <float></code><br>The ratio to check for.
'''OR'''<br/>
|<pre>
<code><country></code><br/>The country to compare with.
ic_ratio = {
|<pre>has_government = fascism</pre>
   tag = GER
<pre>has_government = ROOT</pre>
   ratio > 0.5
|Checks if the ruling party of the current scope meets the requirements of being either the specified ideology group or having the same ideology group as the specified country.
}
|
</pre>
|Checks if the current scope has the specified ratio of factories with the target country.
|Must use either > or < operators for ratio.
|1.0
|1.0
|-
|-id="has_elections"
|has_damaged_buildings
|has_elections
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>has_damaged_buildings = yes</pre>
|<pre>has_elections = yes</pre>
|Checks if the current scope has any damanged buildings in their states.
|Checks if the current scope holds elections.
|
|
|1.0
|1.0
|-
|-id="is_staging_coup"
|has_built
|is_staging_coup
|<code>type = <building></code><br>The building to check for.
|<code><bool></code><br>Boolean.
<code>value = <int></code><br>The amount to check for.
|<pre>is_staging_coup = yes</pre>
|<pre>
|Checks if the current scope is staging a coup.
has_built = {
|
   type = arms_factory
|1.3
   value > 10
|-id="is_target_of_coup"
}
|is_target_of_coup
</pre>
|<code><bool></code><br>Boolean.
|Checks if the current scope has built the specified building the specified number of times.
|<pre>is_target_of_coup = yes</pre>
|Must use either > or < operators for value.
|Checks if the current scope is the target of a coup.
|1.0
|}
 
===科技===
{{SVersion|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
|-
|has_tech
|<code><string></code><br>The technology to check for.
|<pre>has_tech = my_technology</pre>
|Checks if the current scope has the specified technology.
|
|
|1.0
|1.0
|-
|-id="has_civil_war"
|is_researching_technology
|has_civil_war
|<code><string></code><br>The technology to check for.
|<code><bool></code><br>Boolean.
|<pre>is_researching_technology = my_tech</pre>
|<pre>has_civil_war = yes</pre>
|Checks if the current scope is currently researching the specified technology.
|Checks if the current scope has a civil war active.
|
|
|1.0
|1.0
|-
|-id="civilwar_target"
|can_research
|civilwar_target
|<code><string></code><br>The technology to check for.
|<code><scope></code><br>The target country.
|<pre>can_research = my_tech</pre>
|<pre>civilwar_target = GER</pre>
|Checks if the current scope can start researching the specified technology.
|Checks if the specified country is a target of a civil war.
|
|
|1.0
|1.0
|-
|-id="has_manpower_for_recruit_change_to"
|original_research_slots
|has_manpower_for_recruit_change_to
|<code><int></code><br>The amount to check for.
|<code>value = <float></code><br>The amount to check for.
|<pre>original_research_slots > 3</pre>
<code>group = <group></code><br>The group to check for.
|Checks if the current scope had the specified amount of slots at game start.
|<pre>has_manpower_for_recruit_change_to = {
|Must use either > or < operators.
   value > 0.05
   group = mobilization_laws
}</pre>
|Checks if the current scope has the specified amount of manpower for changing the specified idea group.
|'''Must''' use either > or < operators as = operator checks for the '''exact''' value
|1.0
|1.0
|-
|-id="has_rule"
|amount_research_slots
|has_rule
|<code><int></code><br>The amount to check for.
|<code><string></code><br>The rule to check for.
|<pre>amount_research_slots > 3</pre>
|Checks if the current scope has the specified amount of research slots.
|Must use either > or < operators.
|1.3
|-
|is_in_tech_sharing_group
|<code><string></code><br>The group to check for.
|<pre>is_in_tech_sharing_group = us_research</pre>
|Checks if the current scope is in the specified technology sharing group.
|
|
|1.3
|-
|num_tech_sharing_groups
|<code><int></code><br>The amount to check for.
|<pre>num_tech_sharing_groups > 3</pre>
|Checks if the current scope is in the specified amount of technology sharing groups.
|Must use either > or < operators.
|1.3
|-
|has_tech_bonus
|<code>technology = <string></code><br>The technology to check for. Optional.<br>
<code>category = <string></code><br>The category to check for. Optional.<br>
|<pre>has_tech_bonus = {
   technology = my_tech
</pre>
<pre>
<pre>
has_tech_bonus = {
has_rule = can_create_factions
   category = my_category
}
</pre>
</pre>
|Checks if the current scope has a technology bonus in the specified category, or for the specific technology.
|Checks if the current scope has the specified country rule.
|
|
|1.3
|1.6
|-
|-id="has_casualties_war_support"
|land_doctrine_level
|has_casualties_war_support
|<code><int></code><br>The amount to check for.
|<code><float> / <variable></code><br>The amount to check for.
|<pre>land_doctrine_level > 2</pre>
|<pre>has_casualties_war_support < 0</pre>
|Checks if the current scope has the specified amount of land doctrine technologies.
|Checks if the current scope has the specified percentage of war support from own combat casualties.
|Must use either > or < operators.
|1.12
|-id="has_convoys_war_support"
|has_convoys_war_support
|<code><float> / <variable></code><br>The amount to check for.
|<pre>has_convoys_war_support < 0</pre>
|Checks if the current scope has the specified percentage of war support from own convoys sunk.
|Must use either > or < operators.
|1.12
|-id="has_bombing_war_support"
|has_bombing_war_support
|<code><float> / <variable></code><br>The amount to check for.
|<pre>has_bombing_war_support < 0</pre>
|Checks if the current scope has the specified percentage of war support from own states bombed by the enemy.
|Must use either > or < operators.
|Must use either > or < operators.
|1.0
|1.12
|}
|}


=== 国家精神===
=== Balance of power ===
{{SVersion|1.5}}
{{SVersion|1.13}}<!-- This is transcluded onto [[Balance of power modding]]!-->
 
<noinclude>Balances of power are stored within {{path|common/bop/*.txt}} files.
{| class="wikitable sortable" width="100%"
</noinclude>
! width="10%" |Name
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
! width="25%" |Parameters
|+ {{nowrap|Balance of power-related country-scoped triggers:}}<br/>
! width="25%" |Examples
! width="10%" | Name
! width="20%" |Description
! width="25%" | Parameters
! width="15%" |Notes
! width="25%" | Examples
! width="5%" |Version Added
! width="20%" | Description
|-
! width="15%" | Notes
|has_idea
! width="5%" | Version Added
|<code><string></code><br>The idea to check for.
|-id="has_power_balance"
|<pre>has_idea = my_idea</pre>
|has_power_balance
|Checks if the current scope has the specified idea.
|<code>id = <bop ID></code><br>The balance to check for.
|<pre>has_power_balance = {
   id = TAG_my_bop
}</pre>
|Checks if the current scope has the specified balance of power active.
|
|
|-
|1.12
|has_idea_with_trait
|-id="has_any_power_balance"
|<code><string></code><br>The trait to check for.
|has_any_power_balance
|<pre>has_idea_with_trait = my_trait</pre>
|<code><bool></code><br>Boolean.
|Checks if the current scope has any ideas with the specified trait.
|<pre>has_any_power_balance = yes</pre>
|Checks if the current scope has any balance of power active.
|
|
|1.12
|-id="power_balance_value"
|power_balance_value
|<code>id = <bop ID></code><br>The balance to check in.<br/>
<code>value = <float></code><br/>The value to check for.
|<pre>power_balance_value = {
   id = TAG_my_bop
   value > 0.7
}</pre>
|Checks if the current scope has the specified value within the balance of power.
|Either =, >, or < operators are allowed.
|1.12
|-id="power_balance_daily_change"
|power_balance_daily_change
|<code>id = <bop ID></code><br>The balance to check in.<br/>
<code>value = <float></code><br/>The value to check for.
|<pre>power_balance_daily_change = {
   id = TAG_my_bop
   value < -0.01
}</pre>
|Checks if the current scope's balance of power changes each day by the specified value.
|Either =, >, or < operators are allowed.
|1.12
|-id="power_balance_weekly_change"
|power_balance_weekly_change
|<code>id = <bop ID></code><br>The balance to check in.<br/>
<code>value = <float></code><br/>The value to check for.
|<pre>power_balance_weekly_change = {
   id = TAG_my_bop
   value < -0.01
}</pre>
|Checks if the current scope's balance of power changes each week by the specified value.
|Either =, >, or < operators are allowed.
|1.12
|-id="is_power_balance_in_range"
|is_power_balance_in_range
|<code>id = <bop ID></code><br>The balance to check in.<br/>
<code>range = <range ID></code><br/>The range to check for.
|<pre>is_power_balance_in_range = {
   id = TAG_my_bop
   range > TAG_my_bop_right_range
}</pre>
|Checks if the current scope's balance of power value lies within the specified range.
|Ranges are defined within the balance of power. Can use either =, >, and < operators. In case of > or <, the comparison is 'strict', i.e. excluding the range itself.
|1.12
|-id="is_power_balance_side_active"
|is_power_balance_side_active
|<code>id = <bop ID></code><br>The balance to check in.<br/>
<code>side = <side ID></code><br/>The side to check.
|<pre>is_power_balance_side_active = {
   id = TAG_my_bop
   side = TAG_my_bop_right_range
}</pre>
|Checks if the specified balance of power has a side active.
|Sides are defined within the balance of power. "Active" means that the side is among those that are currently visible instead of relying on the current value.
|1.12
|-id="has_power_balance_modifier"
|has_power_balance_modifier
|<code>id = <bop ID></code><br>The balance to check in.<br/>
<code>modifier = <modifier ID></code><br/>The [[Static modifiers|static modifier]].
|<pre>has_power_balance_modifier = {
   id = TAG_my_bop
   modifier = TAG_my_bop_modifier
}</pre>
|Checks if the current scope's balance of power value activates a modifier.
|BoP modifiers are defined within {{path|common/modifiers/*.txt}} files, while they're activated in the balance of power definition.
|1.12
|}
=== Buildings ===
{{SVersion|1.13}}
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Building-related country-scoped triggers:}}<br/>
! width="10%" | Name
! width="25%" | Parameters
! width="25%" | Examples
! width="20%" | Description
! width="15%" | Notes
! width="5%" | Version Added
|-id="building_count_trigger"
|<building> (building_count_trigger)
|<code><int></code><br>The amount of the specified building to to check for.
|<pre>arms_factory > 10</pre>
|Checks if the current scope has the specified amount of the specified building.
|Must use either > or < operators. Works in the state scope as well, unlike the other triggers.
|1.0
|1.0
|-
|-id="num_of_military_factories"
|has_available_idea_with_traits
|num_of_military_factories
|<code>idea = <string></code><br>The trait to check for.
|<code><int></code><br>The amount to check for.
<code>limit = <int></code><br>The amount to check for.
|<pre>num_of_military_factories > 10</pre>
|<pre>has_available_idea_with_traits = {
|Checks if the current scope has the specified amount of military factories.
   idea = my_trait
|Must use either > or < operators.
   limit = 1
}
</pre>
|Checks if the current scope has the specified amount of ideas with the specified trait.
|
|1.0
|1.0
|-
|-id="num_of_civilian_factories"
|amount_taken_ideas
|num_of_civilian_factories
|<code>amount = <int></code><br>The amount to check for.
|<code><int></code><br>The amount to check for.
<code>slots = { <string> }</code><br>The slot type.
|<pre>num_of_civilian_factories > 10</pre>
|<pre>
|Checks if the current scope has the specified amount of civilian factories.
amount_taken_ideas = {
|Must use either > or < operators.
   amount > 3
   slots = {
     political_advisor
   }
}
</pre>
|Checks if the current scope has the specified amount of ideas of the specified slot type.
|Slots types are found in {{path|common/idea_tags/*.txt}}.
|1.0
|1.0
|}
|-id="num_of_naval_factories"
 
|num_of_naval_factories
===外交===
|<code><int></code><br>The amount to check for.
{{SVersion|1.5}}
|<pre>num_of_naval_factories > 10</pre>
 
|Checks if the current scope has the specified amount of dockyards.
{| class="wikitable sortable" width="100%"
|Must use either > or < operators.
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-
|is_major
|<code><bool></code><br>Boolean.
|<pre>is_major = yes</pre>
|Checks if the current scope is considered a Major.
|
|1.0
|1.0
|-
|-id="num_of_available_military_factories"
|is_in_faction_with
|num_of_available_military_factories
|<code><scope> / <variable></code><br>The country to check for.
|<code><int></code><br>The amount to check for.
|<pre>is_in_faction_with = GER</pre>
|<pre>num_of_available_military_factories > 10</pre>
<pre>is_in_faction_with = var:country</pre>
|Checks if the current scope has the specified amount of available military factories.
|Checks if the current scope is in a faction with the specified country.
|Must use either > or < operators.
|
|1.0
|1.0
|-
|-id="num_of_available_civilian_factories"
|is_in_faction
|num_of_available_civilian_factories
|<code><bool></code><br>Boolean.
|<code><int></code><br>The amount to check for.
|<pre>is_in_faction = yes</pre>
|<pre>num_of_available_civilian_factories > 10</pre>
|Checks if the current scope is in a faction.
|Checks if the current scope has the specified amount of available civilian factories.
|
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="num_of_available_naval_factories"
|is_faction_leader
|num_of_available_naval_factories
|<code><bool></code><br>Boolean.
|<code><int></code><br>The amount to check for.
|<pre>is_faction_leader = yes</pre>
|<pre>num_of_available_naval_factories > 10</pre>
|Checks if the current scope is the leader of a faction.
|Checks if the current scope has the specified amount of available dockyards.
|
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="num_of_factories"
|num_faction_members
|num_of_factories
|<code><int></code><br>The amount to check for.
|<code><int></code><br>The amount to check for.
|<pre>num_faction_members > 1</pre>
|<pre>num_of_factories > 10</pre>
|Checks if the faction of the current scope has the specified amount of members.
|Checks if the current scope has the specified amount of military, civilian or dockyard factories.
|Must use either > or < operators.
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="num_of_controlled_factories"
|has_non_aggression_pact_with
|num_of_controlled_factories
|<code><scope> / <variable></code><br>The country to check for.
|<code><int></code><br>The amount to check for.
|<pre>has_non_aggression_pact_with = GER</pre>
|<pre>num_of_controlled_factories > 10</pre>
|Checks if the current scope has a non-aggression pact with the specified country.
|Checks if the current scope has the specified amount of military, civilian or dockyard factories under control.
|
|Must use either > or < operators.
|1.11
|-id="num_of_owned_factories"
|num_of_owned_factories
|<code><int></code><br>The amount to check for.
|<pre>num_of_owned_factories > 10</pre>
|Checks if the current scope has the specified amount of military, civilian or dockyard factories under owned states.
|Must use either > or < operators.
|1.11
|-id="num_of_civilian_factories_available_for_projects"
|num_of_civilian_factories_available_for_projects
|<code><int></code><br>The amount to check for.
|<pre>num_of_civilian_factories_available_for_projects > 10</pre>
|Checks if the current scope has the specified amount of civilian factories usable for projects.
|Must use either > or < operators.
|1.5
|-id="ic_ratio"
|ic_ratio
|<code>tag = <scope></code><br>The country to check.
<code>ratio = <float></code><br>The ratio to check for.
|<pre>
ic_ratio = {
   tag = GER
   ratio > 0.5
}
</pre>
|Checks if the current scope has the specified ratio of factories with the target country.
|Must use either > or < operators for ratio.
|1.0
|1.0
|-
|-id="has_damaged_buildings"
|is_guaranteed_by
|has_damaged_buildings
|<code><scope> / <variable></code><br>The country to check for.
|<code><bool></code><br>Boolean.
|<pre>is_guaranteed_by = GER</pre>
|<pre>has_damaged_buildings = yes</pre>
|Checks if the current scope has been guaranteed by the specified country.
|Checks if the current scope has any damanged buildings in their states.
|
|
|1.0
|1.0
|-
|-id="has_built"
|has_guaranteed
|has_built
|<code><scope> / <variable></code><br>The country to check for.
|<code>type = <building></code><br>The building to check for.
|<pre>has_guaranteed = GER</pre>
<code>value = <int></code><br>The amount to check for.
|Checks if the current scope has guaranteed the specified country.
|<pre>
has_built = {
   type = arms_factory
   value > 10
}
</pre>
|Checks if the current scope has built the specified building the specified number of times.
|Must use either > or < operators for value.
|1.0
|}
 
=== Technology ===
{{SVersion|1.13}}
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Technology-related country-scoped triggers:}}<br/>
! width="10%" | Name
! width="25%" | Parameters
! width="25%" | Examples
! width="20%" | Description
! width="15%" | Notes
! width="5%" | Version Added
|-id="has_tech"
|has_tech
|<code><string></code><br>The technology to check for.
|<pre>has_tech = my_technology</pre>
|Checks if the current scope has the specified technology.
|
|
|1.0
|1.0
|-
|-id="is_researching_technology"
|has_military_access_to
|is_researching_technology
|<code><scope> / <variable></code><br>The country to check for.
|<code><string></code><br>The technology to check for.
|<pre>has_military_access_to = GER</pre>
|<pre>is_researching_technology = my_tech</pre>
|Checks if the current scope has military access to the specified country.
|Checks if the current scope is currently researching the specified technology.
|
|
|1.0
|1.0
|-
|-id="can_research"
|gives_military_access_to
|can_research
|<code><scope> / <variable></code><br>The country to check for.
|<code><string></code><br>The technology to check for.
|<pre>gives_military_access_to = GER</pre>
|<pre>can_research = my_tech</pre>
|Checks if the current scope gives military to the specified country.
|Checks if the current scope can start researching the specified technology.
|
|
|1.0
|1.0
|-
|-id="original_research_slots"
|is_neighbor_of
|original_research_slots
|<code><scope> / <variable></code><br>The country to check for.
|<code><int></code><br>The amount to check for.
|<pre>is_neighbor_of = GER</pre>
|<pre>original_research_slots > 3</pre>
|Checks if the current scope is a neighbor of the specified country.
|Checks if the current scope had the specified amount of slots at game start.
|
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="amount_research_slots"
|is_owner_neighbor_of
|amount_research_slots
|<code><scope> / <variable></code><br>The country to check for.
|<code><int></code><br>The amount to check for.
|<pre>is_owner_neighbor_of = GER</pre>
|<pre>amount_research_slots > 3</pre>
|Checks if the current scope is a neighbor of the specified country with their core territory only.
|Checks if the current scope has the specified amount of research slots.
|Must use either > or < operators.
|1.3
|-id="is_in_tech_sharing_group"
|is_in_tech_sharing_group
|<code><string></code><br>The group to check for.
|<pre>is_in_tech_sharing_group = us_research</pre>
|Checks if the current scope is in the specified technology sharing group.
|
|
|1.0
|1.3
|-
|-id="num_tech_sharing_groups"
|is_puppet_of(被某国傀儡)
|num_tech_sharing_groups
|<code><scope> / <variable></code><br> 指向傀儡该国的国家
|<code><int></code><br>The amount to check for.
|<pre>is_puppet_of = GER</pre>
|<pre>num_tech_sharing_groups > 3</pre>
|Checks if the current scope is a puppet of the specified country.
|Checks if the current scope is in the specified amount of technology sharing groups.
|Must use either > or < operators.
|1.3
|-id="has_tech_bonus"
|has_tech_bonus
|<code>technology = <string></code><br>The technology to check for. Optional.<br>
<code>category = <string></code><br>The category to check for. Optional.<br>
|<pre>has_tech_bonus = {
   technology = my_tech
}</pre>
<pre>
has_tech_bonus = {
   category = my_category
}
</pre>
|Checks if the current scope has a technology bonus in the specified category, or for the specific technology.
|
|
|1.3
|-id="land_doctrine_level"
|land_doctrine_level
|<code><int></code><br>The amount to check for.
|<pre>land_doctrine_level > 2</pre>
|Checks if the current scope has the specified amount of land doctrine technologies.
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="num_researched_technologies"
|is_subject_of
|num_researched_technologies
|<code><scope> / <variable></code><br>The country to check for.
|<code><int></code><br>The amount to check for.
|<pre>is_subject_of = GER</pre>
|<pre>num_researched_technologies > 10</pre>
|Checks if the current scope is a subject of the specified scope.
|Checks how many technologies the target has researched.
|
|1.0
|-
|is_puppet(是否被傀儡)
|<code><bool></code><br>Boolean.
|<pre>is_puppet = yes</pre>
|Returns true if the current country has an autonomy level with <code>is_puppet = yes</code>, false otherwise.
|
|1.0
|-
|is_subject
|<code><bool></code><br>Boolean.
|<pre>is_subject = yes</pre>
|Checks if the current scope is a subject.
|
|1.0
|-
|num_subjects
|<code><int></code><br>The amount to check for.
|<pre>num_subjects > 3</pre>
|Checks if the current scope has the specified amount of subjects.
|Must use either > or < operators.
|Must use either > or < operators.
|1.3
|1.3
|-
|}
|has_autonomy_state
 
|<code><string></code><br>The autonomy state to check for.
=== Ideas ===
|<pre>has_autonomy_state = autonomy_dominion</pre>
{{SVersion|1.13}}
|Checks if the current scope is in the specified autonomous state.
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Idea-related country-scoped triggers:}}<br/>
! width="10%" | Name
! width="25%" | Parameters
! width="25%" | Examples
! width="20%" | Description
! width="15%" | Notes
! width="5%" | Version Added
|-id="has_idea"
|has_idea
|<code><string></code><br>The idea to check for.
|<pre>has_idea = my_idea</pre>
|Checks if the current scope has the specified idea.
|
|-id="has_idea_with_trait"
|has_idea_with_trait
|<code><string></code><br>The trait to check for.
|<pre>has_idea_with_trait = my_trait</pre>
|Checks if the current scope has any ideas with the specified trait.
|
|
|1.0
|1.0
|-
|-id="has_allowed_idea_with_traits"
|compare_autonomy_state
|has_allowed_idea_with_traits
|<code><string></code><br>The autonomy state to check for.
|<code>idea = <string></code><br>The trait to check for.<br>
|<pre>compare_autonomy_state > autonomy_dominion</pre>
<code>limit = <int></code><br>The amount to check for.<br>
|Checks if the current scope autonomy state is less or greater than the specified autonomy state.
<code>characters = <bool></code><br>If set, will only run this on characters.<br>
|Must use either > or < operators.
<code>ignore = { <ideas> }</code><br>If set, ignores the ideas inside. Optional.<br>
|1.0
|<pre>has_available_idea_with_traits = {
|-
   idea = my_trait
|compare_autonomy_progress_ratio
    limit = 1
|<code><float></code><br>The amount to check for.
    ignore = { generic_head_of_intelligence }
|<pre>compare_autonomy_progress_ratio > 0.5</pre>
|Checks if the current scope autonomy progress is at the specified ratio.
|Must use either > or < operators.
|1.3
|-
|has_opinion_modifier
|<code><string></code><br>The opinion modifier to check for.
|<pre>has_opinion_modifier = my_modifier</pre>
|Checks if the current scope has the specified opinion modifier.
|
|1.0
|-
|has_opinion
|<code>target = <scope></code><br>The country to check for.
<code>value = <float></code><br>The amount to check for.
|<pre>
has_opinion = {
    target = GER
    value = 100
}
}
</pre>
</pre>
|Checks if the current scope has the specified opinion with the specified country.
|Checks if the current scope has the specified amount of ideas with the specified trait.
|Must use either > or < operators.
|ignore = idea_name works for 1 idea.
|1.0
|1.9.1
|-
|-id="has_available_idea_with_traits"
|has_relation_modifier
|has_available_idea_with_traits
|<code>target = <scope></code><br>The country to check for.
|<code>idea = <string></code><br>The trait to check for.<br>
<code>modifier = <modifier></code><br>The modifier to check for.
<code>limit = <int></code><br>The amount to check for.<br>
<code>characters = <bool></code><br>If set, will only run this on characters.<br>
<code>ignore = { <ideas> }</code><br>If set, ignores the ideas inside. Optional.<br>
|<pre>has_available_idea_with_traits = {
   idea = my_trait
   limit = 1
   ignore = { generic_head_of_intelligence }
}
</pre>
|Checks if the current scope has the specified amount of ideas with the specified trait.
|ignore = idea_name works for 1 idea.
|1.0
|-id="amount_taken_ideas"
|amount_taken_ideas
|<code>amount = <int></code><br>The amount to check for.
<code>slots = { <string> }</code><br>The slot type.
|<pre>
|<pre>
has_relation_modifier = {
amount_taken_ideas = {
    target = GER
    amount > 3
    modifier = my_modifier
   slots = {
     political_advisor
    }
}
}
</pre>
</pre>
|Checks if the current scope has the specified relation modifier with the specified country.
|Checks if the current scope has the specified amount of ideas of the specified slot type. Excludes spirits, hidden ideas, and laws.
|Slots types are found in {{path|common/idea_tags/*.txt}}.
|1.4
|}
 
=== Diplomacy ===
{{SVersion|1.13}}
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Diplomatic country-scoped triggers:}}<br/>
! width="10%" | Name
! width="25%" | Parameters
! width="25%" | Examples
! width="20%" | Description
! width="15%" | Notes
! width="5%" | Version Added
|-id="is_major"
|is_major
|<code><bool></code><br>Boolean.
|<pre>is_major = yes</pre>
|Checks if the current scope is considered a Major.
|
|
|1.0
|1.0
|-
|-id="is_ally_with"
|all_allied_country
|is_ally_with
|triggers
|<code><scope> / <variable></code><br>The country to check for.
|<pre>all_allied_country = {
|<pre>is_ally_with = GER</pre>
   has_stability > 0.8
<pre>is_ally_with = var:country</pre>
}</pre>
|Checks if the current scope is an ally (Faction members or subject-master relation).
|Returns true if THIS is in a faction where all other countries fulfill the sub-triggers; false otherwise. Evaluation stops early if any ally fails the check.
|Within the trigger PREV is the country doing the check and THIS is the ally.
|
|
|-
|1.0
|any_allied_country
|-id="is_in_faction_with"
|triggers
|is_in_faction_with
|<pre>any_allied_country = {
|<code><scope> / <variable></code><br>The country to check for.
   has_stability > 0.8
|<pre>is_in_faction_with = GER</pre>
}</pre>
<pre>is_in_faction_with = var:country</pre>
|Returns true if THIS is in a faction where at least one other country fulfills the sub-triggers; false otherwise. Evaluation stops early if any ally passes the check.
|Checks if the current scope is in a faction with the specified country.
|Within the trigger PREV is the country doing the check and THIS is the ally.
|
|
|-
|1.0
|any_neighbor_country
|-id="is_in_faction"
|triggers
|is_in_faction
|<pre>any_neighbor_country = {
|<code><bool></code><br>Boolean.
   has_stability > 0.8
|<pre>is_in_faction = yes</pre>
}</pre>
|Checks if the current scope is in a faction.
|Returns true if at least one other country that controls a province adjacent to a province controlled by THIS fulfills the sub-triggers; false otherwise. Evaluation stops early if any neighbor passes the check.
|Within the trigger PREV is the country doing the check and THIS is the neighbor.
|
|
|-
|1.0
|all_neighbor_country
|-id="is_faction_leader"
|triggers
|is_faction_leader
|<pre>all_neighbor_country = {
   has_stability > 0.8
}</pre>
|Returns false if any other country that controls a province adjacent to a province controlled by THIS fails the sub-triggers; true otherwise. Evaluation stops early if any neighbor fails the check.
|Within the trigger PREV is the country doing the check and THIS is the neighbor. The list of neighbor countries is pre-calculated.
|
|-
|any_home_area_neighbor_country
|triggers
|<pre>any_home_area_neighbor_country = {
   has_stability > 0.8
}</pre>
|Returns true if THIS has a home area and at least one country controlling an adjacent area to it fulfills the sub-triggers; false otherwise. The home area is the largest contiguous area controlled by THIS that contains at least one province of its capital state. Evaluation stops early if any neighbor passes the check.
|Within the trigger PREV is the country doing the check and THIS is the neighbor.
|
|}
 
===战争===
{{SVersion|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
|-
|has_war
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>has_war = yes</pre>
|<pre>is_faction_leader = yes</pre>
|Checks if the current scope is at war.
|Checks if the current scope is the leader of a faction.
|
|
|1.0
|1.0
|-
|-id="is_spymaster"
|has_war_with
|is_spymaster
|<code><scope> / <variable></code><br>The country to check for.
|<code><bool></code><br>Boolean.
|<pre>has_war_with = GER</pre>
|<pre>is_spymaster = yes</pre>
<pre>has_war_with = var:country</pre>
|Checks if the current scope is the spymaster of a faction.
|Checks if the current scope is at war with the specified country.
|
|
|1.9
|-id="num_faction_members"
|num_faction_members
|<code><int></code><br>The amount to check for.
|<pre>num_faction_members > 1</pre>
|Checks if the faction of the current scope has the specified amount of members.
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="has_non_aggression_pact_with"
|has_offensive_war_with
|has_non_aggression_pact_with
|<code><scope> / <variable></code><br>The country to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>has_offensive_war_with = GER</pre>
|<pre>has_non_aggression_pact_with = GER</pre>
|Checks if the current scope is in an offensive war against the specified country.
|Checks if the current scope has a non-aggression pact with the specified country.
|
|
|1.0
|1.0
|-
|-id="is_guaranteed_by"
|has_defensive_war_with
|is_guaranteed_by
|<code><scope> / <variable></code><br>The country to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre></pre>
|<pre>is_guaranteed_by = GER</pre>
|Checks if the current scope is in an defensive war against the specified country.
|Checks if the current scope has been guaranteed by the specified country.
|
|
|1.0
|1.0
|-
|-id="has_guaranteed"
|has_offensive_war
|has_guaranteed
|<code><bool></code><br>Boolean.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>has_offensive_war = yes</pre>
|<pre>has_guaranteed = GER</pre>
|Checks if the current scope is in an offensive war.
|Checks if the current scope has guaranteed the specified country.
|
|
|1.0
|1.0
|-
|-id="has_military_access_to"
|has_defensive_war
|has_military_access_to
|<code><bool></code><br>Boolean.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>has_defensive_war = yes</pre>
|<pre>has_military_access_to = GER</pre>
|Checks if the current scope is in a defensive war.
|Checks if the current scope has military access to the specified country.
|
|
|1.0
|1.0
|-
|-id="gives_military_access_to"
|has_war_together_with
|gives_military_access_to
|<code><scope> / <variable></code><br>The country to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>has_war_together_with = GER</pre>
|<pre>gives_military_access_to = GER</pre>
|Checks if the current scope is in a war alongside the specified country.
|Checks if the current scope gives military to the specified country.
|
|
|1.0
|1.0
|-
|-id="is_neighbor_of"
|surrender_progress
|is_neighbor_of
|<code><float> / <variable></code><br>The amount to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>surrender_progress > 0.1</pre>
|<pre>is_neighbor_of = GER</pre>
|Checks if the current scope has the specified amount of surrender progress.
|Checks if the current scope is a neighbor of the specified country.
|Must use either > or < operators.
|
|1.0
|1.0
|-
|-id="is_owner_neighbor_of"
|any_war_score
|is_owner_neighbor_of
|<code><float></code><br>The amount to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>any_war_score > 10</pre>
|<pre>is_owner_neighbor_of = GER</pre>
|Checks if the current scope has the specified amount of '''war progress''' (not war participation)<ref>[[forum:1124460|How does any_war_score work?]]</ref> in any war.
|Checks if the current scope is a neighbor of the specified country with their core territory only.
|Must use either > or < operators.
|
|1.0
|-id="is_puppet_of"
|is_puppet_of
|<code><scope> / <variable></code><br>The country to check for.
|<pre>is_puppet_of = GER</pre>
|Checks if the current scope is a puppet of the specified country.
|A "puppet" is an autonomous state that has <code>is_puppet = yes</code> in its definition within {{path|common/autonomous_states/}}. For any subject type, see [[#is_subject_of|is_subject_of]].
|1.0
|-id="is_subject_of"
|is_subject_of
|<code><scope> / <variable></code><br>The country to check for.
|<pre>is_subject_of = GER</pre>
|Checks if the current scope is a subject of the specified scope.
|
|1.0
|-id="is_puppet"
|is_puppet
|<code><bool></code><br>Boolean.
|<pre>is_puppet = yes</pre>
|Returns true if the current country is a puppet.
|A "puppet" is an autonomous state that has <code>is_puppet = yes</code> in its definition within {{path|common/autonomous_states/}}. For any subject type, see [[#is_subject|is_subject]].
|1.0
|1.0
|-
|-id="is_subject"
|has_capitulated
|is_subject
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>has_capitulated = yes</pre>
|<pre>is_subject = yes</pre>
|Checks if the current scope has capitulated.
|Checks if the current scope is a subject.
|
|
|1.0
|1.0
|-
|-id="has_subject"
|has_border_war_with
|has_subject
|<code><scope> / <variable></code><br>The country to check for.
|<code><bool></code><br>Boolean.
|<pre>has_border_war_with = GER</pre>
|<pre>has_subject = GRE</pre>
|Checks if the current scope has a border war with the specified country.
|Checks if the country has for subject the given country.
|
|
|1.5
|1.0
|-
|-id="num_subjects"
|has_border_war_between
|num_subjects
|<code>attacker = <scope> / <variable></code><br>The state to check for.
|<code><int></code><br>The amount to check for.
<code>defender = <scope> / <variable></code><br>The state to check for.
|<pre>num_subjects > 3</pre>
|<pre>has_border_war_between = {
|Checks if the current scope has the specified amount of subjects.
   attacker = 1
|Must use either > or < operators.
   defender = 2
|1.3
}
|-id="has_autonomy_state"
</pre>
|has_autonomy_state
|Checks if their is a border war between the two specified states.
|<code><string></code><br>The autonomy state to check for.
|<pre>has_autonomy_state = autonomy_dominion</pre>
|Checks if the current scope is in the specified autonomous state.
|
|
|1.5
|1.0
|-
|-id="compare_autonomy_state"
|has_border_war
|compare_autonomy_state
|<code><bool></code><br>Boolean.
|<code><string></code><br>The autonomy state to check for.
|<pre>has_border_war = yes</pre>
|<pre>compare_autonomy_state > autonomy_dominion</pre>
|Checks if the current scope has a border war active.
|Checks if the current scope's autonomy state <code>min_freedom_level</code> is less or greater than that of the specified autonomy state. The special value "autonomy_free" compares as greater than any autonomy state. If the current scope is not a subject, it is treated as greater than any autonomy state (including "autonomy_free"). With <code>=</code>, checks if the current scope is in the specified autonomous state.
|
|
|1.5
|-
|has_added_tension_amount
|<code><float> / <variable></code><br>The amount to check for.
|<pre>has_added_tension_amount = 10</pre>
|Checks if the current scope has caused the specified amount of World Tension.
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="compare_autonomy_progress_ratio"
|has_wargoal_against
|compare_autonomy_progress_ratio
|<code><scope> / <variable></code><br>The country to check for.
|<code><float></code><br>The amount to check for.
|<pre>has_wargoal_against = GER</pre>
|<pre>compare_autonomy_progress_ratio > 0.5</pre>
|Checks if the current scope has any wargoal against the specified country.
|Checks if the current scope autonomy progress is at the specified ratio. If the current scope is not a subject, the ratio is 1.
|
|1.3
|-id="has_opinion_modifier"
|has_opinion_modifier
|<code><string></code><br>The opinion modifier to check for.
|<pre>has_opinion_modifier = my_modifier</pre>
|Checks if the current scope has the specified opinion modifier.
|
|
|1.0
|1.0
|-
|-id="has_opinion"
|has_wargoal_against
|has_opinion
|<code>target = <scope> / <variable></code><br>The country to check for.<br>
|<code>target = <scope></code><br>The country to check for.
<code>type = <string></code><br>The type of wargoal to check for.
<code>value = <float></code><br>The amount to check for.
|<pre>has_wargoal_against = {
|<pre>
    target = FROM
has_opinion = {
    type = take_state
    target = GER
    value > 50
}
}
</pre>
</pre>
|Checks if the current scope has a specific wargoal type against the specified country.
|Checks if the current scope has the specified opinion with the specified country.
|
|Must use either > or < operators.
|1.8
|1.0
|-
|-id="has_relation_modifier"
|is_justifying_wargoal_against
|has_relation_modifier
|<code><scope> / <variable></code><br>The country to check for.
|<code>target = <scope></code><br>The country to check for.
|<pre>is_justifying_wargoal_against = GER</pre>
<code>modifier = <modifier></code><br>The modifier to check for.
|Checks if the current scope is justifying a wargoal against the specified country.
|<pre>
has_relation_modifier = {
   target = GER
   modifier = my_modifier
}
</pre>
|Checks if the current scope has the specified relation modifier with the specified country.
|
|
|1.0
|1.0
|-
|-id="has_legitimacy"
|has_annex_war_goal
|has_legitimacy
|<code><scope> / <variable></code><br>The country to check for.
|<code><int></code><br>Amount to check.
|<pre>has_annex_war_goal = GER</pre>
|<pre>has_legitimacy > 50</pre>
|Checks if the current scope has the Annex wargoal against the specified country.
|Checks how much legitimacy the current government in exile has.
|Must use either > or < operators. Legitimacy ranges from 0 to 100.
|1.6
|-id="is_exile_host"
|is_exile_host
|<code><bool></code><br>Boolean.
|<pre>is_exile_host = yes</pre>
|Checks if the current country is hosting an exile.
|
|
|1.0
|1.6
|-
|-id="is_hosting_exile"
|any_claim
|is_hosting_exile
|<code><bool></code><br>Boolean.
|<code><tag></code><br>Country.
|<pre>any_claim = yes</pre>
|<pre>is_hosting_exile = POL</pre>
|Checks if the current scope has any claims on another country.
|Checks if the current country is hosting a specific exile.
|
|
|1.0
|1.6
|-
|-id="is_government_in_exile"
|is_in_peace_conference
|is_government_in_exile
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>is_in_peace_conference = yes</pre>
|<pre>is_government_in_exile = yes</pre>
|Checks if the current scope is in a Peace Conference.
|Checks if the current country is exiled in a different country.
|
|
|1.0
|1.6
|-
|-id="is_exiled_in"
|any_enemy_country
|is_exiled_in
|triggers
|<code><tag></code><br>Country to be exiled in.
|<pre>any_enemy_country = {
|<pre>is_exiled_in = POL</pre>
    has_stability > 0.8
|Checks if the current country is exiled in a specific country.
|
|1.6
|-id="received_expeditionary_forces"
|received_expeditionary_forces
|<code>sender = <tag></code><br>Country which sent forces.
<code>value <> <int></code><br/>Amount of forces.
|<pre>received_expeditionary_forces = {
    sender = POL
   value > 10
}</pre>
}</pre>
|Returns true if any country is at war with THIS, exists, and fulfills the sub-triggers; false otherwise. Evaluation stops at the first true sub-trigger.
|Checks if the current country received X units in expeditions from the specified country.
|Within the trigger PREV is the country doing the check and THIS is the enemy.
|
|1.6
|-id="can_declare_war_on"
|can_declare_war_on
|<code><tag></code><br>Country to check.
|<pre>can_declare_war_on = POL</pre>
|Checks if the current scope is able to declare war on the specified country.
|
|1.9
|-id="foreign_manpower"
|foreign_manpower
|<code><int></code><br>Amount to check.
|<pre>foreign_manpower > 10000</pre>
|Checks how much foreign manpower we have received for garrisoning.
|Must use either > or < operators.
|1.9
|-id="is_embargoed_by"
|is_embargoed_by
|<code><scope></code><br>Amount to check.
|<pre>is_embargoed_by = USA</pre>
|Checks if the current scope is embargoed by the specified country.
|
|
|-
|1.12
|all_enemy_country
|-id="is_embargoing"
|triggers
|is_embargoing
|<pre>all_enemy_country = {
|<code><scope></code><br>Amount to check.
   has_stability > 0.8
|<pre>is_embargoing = CUB</pre>
}</pre>
|Checks if the current scope is embargoing the specified country.
|Returns false if any country is at war with THIS, exists, and fails the sub-triggers; true otherwise. Evaluation stops at the first false sub-trigger.
|Within the trigger PREV is the country doing the check and THIS is the enemy.
|
|
|1.12
|}
|}


=== 地区===
=== War ===
{{SVersion|1.5}}
{{SVersion|1.13}}


{| class="wikitable sortable" width="100%"
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
! width="10%" |Name
|+ {{nowrap|War-related country-scoped triggers:}}<br/>
! width="25%" |Parameters
! width="10%" | Name
! width="25%" |Examples
! width="25%" | Parameters
! width="20%" |Description
! width="25%" | Examples
! width="15%" |Notes
! width="20%" | Description
! width="5%" |Version Added
! width="15%" | Notes
|-
! width="5%" | Version Added
|controls_state(控制省份)
|-id="has_war"
|<code><scope> / <variable></code><br> 当前国家是否控制某个省份
|has_war
|<pre>controls_state = 39</pre>
|<code><bool></code><br>Boolean.
<pre>controls_state = var:state</pre>
|<pre>has_war = yes</pre>
|Checks if the current scope has control of the specified state.
|Checks if the current scope is at war.
|
|
|1.0
|1.0
|-
|-id="has_war_with"
|owns_state
|has_war_with
|<code><scope> / <variable></code><br>The state to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>owns_state = 39</pre>
|<pre>has_war_with = GER</pre>
|Checks if the current scope owns the specified state.
<pre>has_war_with = var:country</pre>
|Checks if the current scope is at war with the specified country.
|
|
|1.0
|1.0
|-
|-id="has_offensive_war_with"
|num_of_controlled_states
|has_offensive_war_with
|<code><int></code><br>The amount to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>num_of_controlled_states = 5</pre>
|<pre>has_offensive_war_with = GER</pre>
|Checks if the current scope has the specified amount of controlled states.
|Checks if the current scope is in an offensive war against the specified country.
|Must use either > or < operators.
|
|1.0
|1.0
|-
|-id="has_defensive_war_with"
|num_occupied_states
|has_defensive_war_with
|<code><int></code><br>The amount to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>num_occupied_states = 5</pre>
|<pre>has_defensive_war_with = GER</pre>
|Checks if the current scope has the specified amount of occupied states.
|Checks if the current scope is in an defensive war against the specified country.
|Must use either > or < operators.
|
|1.0
|1.0
|-
|-id="has_offensive_war"
|has_full_control_of_state
|has_offensive_war
|<code><scope> / <variable></code><br>The state to check for.
|<code><bool></code><br>Boolean.
|<pre>has_full_control_of_state = 39</pre>
|<pre>has_offensive_war = yes</pre>
|Checks if the current scope has control and ownership of the specified state.
|Checks if the current scope is in an offensive war.
|
|
|1.3
|1.0
|-
|-id="has_defensive_war"
|has_resources_amount
|has_defensive_war
|<code>resource = <string></code><br>The resource to check for.<br>
|<code><bool></code><br>Boolean.
<code>amount = <int></code><br>The amount to check for.<br>
|<pre>has_defensive_war = yes</pre>
<code>state = <scope></code><br>The estate to check for. Defaults to the current state in a state scope.
|Checks if the current scope is in a defensive war.
|<pre>
|
has_resources_amount = {
|1.0
   resource = oil
|-id="has_war_together_with"
   amount > 10
|has_war_together_with
   state = 49
|<code><scope> / <variable></code><br>The country to check for.
}
|<pre>has_war_together_with = GER</pre>
</pre>
|Checks if the current scope is in a war alongside the specified country.
|Checks if the specified state has the specified amount of the specified resource.
|
|Must use either > or < operators for amount.
|1.0
|1.3
|-id="has_war_with_major"
|-
|has_war_with_major
|any_owned_state
|<code><bool></code><br>Boolean.
|triggers (state scope)
|<pre>has_war_with_major = yes</pre>
|<pre>any_owned_state = {
|Checks if the current scope is at war with any other country that is considered major.
   is_coastal = yes
}</pre>
|Returns true if at least one state controlled by THIS passes the sub-triggers; false otherwise. Evaluation stops early when a state passes the check.
|The sub-triggers are evaluated with a state scope for each owned state.
|
|
|-
|1.12
|all_owned_state
|-id="has_war_with_wargoal_against"
|triggers (state scope)
|has_war_with_wargoal_against
|<pre>all_owned_state = {
|<code>target = <scope> / <variable></code><br>The country to check for.<br/>
    is_controlled_by = ROOT
<code>type = <wargoal></code><br/>The wargoal to check for. Optional.
|<pre>has_war_with_wargoal_against = {
    target = ENG
   type = independence_wargoal
}</pre>
}</pre>
|Returns false if any state controlled by THIS fails the sub-triggers; true otherwise. Evaluation stops early when a state fails the check.
|Checks if the current scope is at war with the specified country with the specified wargoal being active.
|The sub-triggers are evaluated with a state scope for each owned state.
|Wargoals are stored within {{path|common/wargoals/*.txt}} files. If no wargoal is specified, checks for ''any'' wargoal. Joining an ally in their war does not count as a wargoal.
|
|1.12
|}
|-id="surrender_progress"
 
|surrender_progress
===军事===
|<code><float> / <variable></code><br>The amount to check for.
{{SVersion|1.5}}
|<pre>surrender_progress > 0.1</pre>
 
|Checks if the current scope has the specified amount of surrender progress.
{| class="wikitable sortable" width="100%"
|Must use either > or < operators.
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-
|has_army_experience
|<code><float> / <variable></code><br>The amount to check for.
|<pre>has_army_experience = 10</pre>
<pre>has_army_experience = var:number</pre>
|Checks if the current scope has the specified amount of Army experience.
|'''Must''' use either > or < operators as = operator checks for the '''exact''' value
|1.3
|-
|has_air_experience
|<code><float> / <variable></code><br>The amount to check for.
|<pre>has_air_experience = 10</pre>
|Checks if the current scope has the specified amount of Air experience.
|'''Must''' use either > or < operators as = operator checks for the '''exact''' value
|1.3
|-
|has_navy_experience
|<code><float> / <variable></code><br>The amount to check for.
|<pre>has_navy_experience = 10</pre>
|Checks if the current scope has the specified amount of Navy experience.
|'''Must''' use either > or < operators as = operator checks for the '''exact''' value
|1.3
|-
|has_unit_leader
|<code><int></code><br>The id to check for.
|<pre>has_unit_leader = 1</pre>
|Checks if the current scope has a unit leader with the specified id.
|
|1.0
|1.0
|-
|-id="any_war_score"
|has_manpower
|any_war_score
|<code><float> / <variable></code><br>The amount to check for.
|<code><float></code><br>The amount to check for.
|<pre>has_manpower = 1000</pre>
|<pre>any_war_score > 10</pre>
|Checks if the current scope has the specified amount of manpower.
|Checks if the current scope has the specified amount of '''war progress''' (not war participation)<ref>[[forum:1124460|How does any_war_score work?]]</ref> in any war.
|'''Must''' use either > or < operators as = operator checks for the '''exact''' value
|1.0
|-
|has_army_manpower
|<code>size = <int></code><br>The amount to check for.
|<pre>has_army_manpower = {
   size > 1000
</pre>
|Checks if the current scope has an army using the specified amount of manpower.
|Must use either > or < operators.
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="has_capitulated"
|manpower_per_military_factory
|has_capitulated
|<code><float></code><br>The amount to check for.
|<code><bool></code><br>Boolean.
|<pre>manpower_per_military_factory > 1000</pre>
|<pre>has_capitulated = yes</pre>
|Checks if the current scope has the specified manpower times their number of military factories.
|Checks if the current scope has capitulated.
|Must use either > or < operators.
|
|1.0
|1.0
|-
|-id="days_since_capitulated"
|num_divisions
|days_since_capitulated
|<code><int></code><br>The amount to check for.
|<code><int></code><br>Amount of days.
|<pre>num_divisions > 5</pre>
|<pre>days_since_capitulated > 10</pre>
|Checks if the current scope has the specified amount of divisions.
|Checks the amount of days since the target last capitulated.
|Must use either > or < operators.
|If the target never capitulated, the amount of days is extremely large. <!-- Needs testing, the amount of days since the 1st of January of the year 2? Documentation doesn't say--> Recommended to combine with has_capitulated.
|1.3
|1.9
|-
|-id="has_border_war_with"
|num_of_nukes
|has_border_war_with
|<code><int></code><br>The amount to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>num_of_nukes > 5</pre>
|<pre>has_border_war_with = GER</pre>
|Checks if the current scope has the specified amount of nukes.
|Checks if the current scope has a border war with the specified country.
|Must use either > or < operators.
|
|1.0
|1.5
|-
|-id="has_border_war_between"
|casualties
|has_border_war_between
|<code><int></code><br>The amount to check for.
|<code>attacker = <scope> / <variable></code><br>The state to check for.
|<pre>casualties > 10000</pre>
<code>defender = <scope> / <variable></code><br>The state to check for.
|Checks if the current scope has suffered the specified amount of casualties.
|<pre>has_border_war_between = {
|Must use either > or < operators.
   attacker = 1
|1.0
   defender = 2
|-
}
|amount_manpower_in_deployment_queue
</pre>
|<code><float></code><br>The amount to check for.
|Checks if there is a border war between the two specified states.
|<pre>amount_manpower_in_deployment_queue > 1000</pre>
|Checks if the current scope has the specified amount of manpower in their deployment queue.
|Must use either > or < operators.
|1.5
|-
|has_attache_from
|<code><scope> / <variable></code><br>The country to check for.
|<pre>has_attache_from = GER</pre>
|Checks if the current scope has an attache from the specified scope.
|
|
|1.5
|1.5
|-
|-id="has_border_war"
|has_attache
|has_border_war
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>has_attache = yes</pre>
|<pre>has_border_war = yes</pre>
|Checks if the current scope has an attache.
|Checks if the current scope has a border war active.
|
|
|1.5
|1.5
|-
|-id="has_added_tension_amount"
|is_lend_leasing
|has_added_tension_amount
|<code><float> / <variable></code><br>The amount to check for.
|<pre>has_added_tension_amount > 10</pre>
|Checks if the current scope has caused the specified amount of World Tension.
|Must use either > or < operators.
|1.0
|-id="has_wargoal_against"
|has_wargoal_against
|<code><scope> / <variable></code><br>The country to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>is_lend_leasing = GER</pre>
|<pre>has_wargoal_against = GER</pre>
|Checks if the current scope is lend leasing to the specified scope.
|Checks if the current scope has any wargoal against the specified country.
|
|
|1.0
|1.0
|-
|-id="has_wargoal_against"
|has_template
|has_wargoal_against
|<code><string></code><br>The name of the template.
|<code>target = <scope> / <variable></code><br>The country to check for.<br>
|<pre>has_template = "Infantry Division"</pre>
<code>type = <string></code><br>The type of wargoal to check for.
|Checks if the current scope has a division template of the specified name.
|<pre>has_wargoal_against = {
   target = FROM
   type = take_state
}
</pre>
|Checks if the current scope has a specific wargoal type against the specified country.
|
|
|1.0
|1.8
|-
|-id="is_justifying_wargoal_against"
|has_template_majority_unit
|is_justifying_wargoal_against
|<code><string></code><br>The unit to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>has_template_majority_unit = infantry</pre>
|<pre>is_justifying_wargoal_against = GER</pre>
|Checks if the current scope has a division template composed mostly of the specified unit.
|Checks if the current scope is justifying a wargoal against the specified country.
|
|
|1.0
|1.0
|-
|-id="has_annex_war_goal"
|has_template_containing_unit
|has_annex_war_goal
|<code><string></code><br>The name of the unit.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>has_template_containing_unit = light_armor</pre>
|<pre>has_annex_war_goal = GER</pre>
|Checks if the current scope has a division template contained any of the specified unit.
|Checks if the current scope has the Annex wargoal against the specified country.
|
|
|1.0
|1.0
|-
|-id="any_claim"
|strength_ratio
|any_claim
|<code>tag = <scope></code><br>The country to check for.
|<code><bool></code><br>Boolean.
<code>ratio = <float></code><br>The ratio to check for.
|<pre>any_claim = yes</pre>
|<pre>strength_ratio = {
|Checks if the current scope has any claims on another country.
   tag = GER
|
   ratio > 1
}
</pre>
|Checks if the current scope has the specified strength ratio against the specified country. The ratio is the number of fielded divisions of the current scope divided by those of <code>tag</code> (or 1 if <code>tag</code> has no divisions). The ratio gets increased by 10% if the current scope has a stronger air forces.<ref>[[forum:1356228/#post-26361808]]</ref>
|Any comparison operator after <code>ratio</code> other than > gets interpreted as <.
|1.0
|1.0
|-
|-id="is_in_peace_conference"
|naval_strength_ratio
|is_in_peace_conference
|<code>tag = <scope></code><br>The country to check for.
|<code><bool></code><br>Boolean.
<code>ratio = <float></code><br>The ratio to check for.
|<pre>is_in_peace_conference = yes</pre>
|<pre>naval_strength_ratio = {
|Checks if the current scope is in a peace conference.
|Please test this in-game for 1.12.
|1.0
|-id="controls_province"
|controls_province
|<code><id></code><br>The province to check for.
|<pre>controls_province = 1239</pre>
|Checks if the current scope has control of the specified province.
|
|1.9
|-id="longest_war_length"
|longest_war_length
|<code><int></code><br>Amount of months.
|<pre>longest_war_length > 3</pre>
|Checks how long a country has been at war, in months.
|
|1.14
|-id="war_length_with"
|war_length_with
|<code>tag = <scope> / <variable></code><br>Target country<br>
<code>months = <int></code><br>Amounth of months
|<pre>war_length_with = {
    tag = GER
    tag = GER
    ratio = 1
    months > 3
}
}</pre>
</pre>
|Checks how long a country has been at war with specific country, in months.
|Checks if the current scope has the specified naval strength ratio against the specified country.
|
|1.14
|}
 
=== State ===
{{SVersion|1.13}}
These are state-related triggers in the country scope, not [[#State scope|state-scoped triggers]].
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|State-related country-scoped triggers:}}<br/>
! width="10%" | Name
! width="25%" | Parameters
! width="25%" | Examples
! width="20%" | Description
! width="15%" | Notes
! width="5%" | Version Added
|-id="controls_state"
|controls_state
|<code><scope> / <variable></code><br>The state to check for.
|<pre>controls_state = 39</pre>
<pre>controls_state = var:state</pre>
|Checks if the current scope has control of the specified state.
|
|
|1.0
|1.0
|-
|-id="owns_state"
|alliance_strength_ratio
|owns_state
|<code><float> / <variable></code><br>The ratio to check for.
|<code><scope> / <variable></code><br>The state to check for.
|<pre>alliance_strength_ratio > 0.5</pre>
|<pre>owns_state = 39</pre>
|Checks if the current scope and allies has an army strength higher than the specified ratio against estimated enemy strength.
|Checks if the current scope owns the specified state.
|Must use either > or < operators.
|
|1.0
|1.0
|-
|-id="num_of_controlled_states"
|alliance_naval_strength_ratio
|num_of_controlled_states
|<code><float> / <variable></code><br>The ratio to check for.
|<code><int></code><br>The amount to check for.
|<pre>alliance_naval_strength_ratio > 0.5</pre>
|<pre>num_of_controlled_states > 5</pre>
|Checks if the current scope and allies has an naval strength ratio higher than the specified ratio against estimated enemy strength.
| Checks if the current scope has the specified amount of controlled states.
|Must use either > or < operators.
|Must use either > or < operators.
|1.0
| 1.0
|-
|-id="num_occupied_states"
|enemies_strength_ratio
|num_occupied_states
|<code><float> / <variable></code><br>The ratio to check for.
|<code><int></code><br>The amount to check for.
|<pre>enemies_strength_ratio > 0.5</pre>
|<pre>num_occupied_states > 5</pre>
|Checks if the estimated enemy army strength ratio is higher than the specified ratio.
|Checks if the current scope has the specified amount of occupied states.
|Must use either > or < operators.
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="has_full_control_of_state"
|enemies_naval_strength_ratio
|has_full_control_of_state
|<code><float> / <variable></code><br>The ratio to check for.
|<code><scope> / <variable></code><br>The state to check for.
|<pre>enemies_naval_strength_ratio > 0.5</pre>
|<pre>has_full_control_of_state = 39</pre>
|Checks if the estimated enemy naval strength ratio is higher than the specified ratio.
|Checks if the current scope has total control (100% occupation) of the specified state.
|Must use either > or < operators.
|
|1.0
|1.3
|-
|-id="core_compliance"
|has_army_size
|core_compliance
|<code>size = <float></code><br>The amount to check for.<br>
|<code>occupied_country_tag = <TAG></code><br>The country for which to check compliance.<br>
<code>type = <string></code><br>The type to check for. Optional.<br>
<code>value = <int></code><br>The value to check for.<br>
|<pre>has_army_size = {
|<pre>
    size > 10
core_compliance = {
   type = armor
    occupied_country_tag = ITA
   value > 10
}
}
</pre>
</pre>
|Checks if the current scope has the specified number of divisions, or of a specified type of division.
|Compares the average compliance of core states of the specified country within controlled states of the current scope.
|Types:
|Must use either > or < operators for value.
 
|1.9
*infantry
|-id="core_resistance"
*support
|core_resistance
*artillery
|<code>occupied_country_tag = <TAG></code><br>The country for which to check resistance.<br>
*anti_tank
<code>value = <int></code><br>The value to check for.<br>
*armor
|<pre>
 
core_resistance = {
Must use either > or < operators for size.
    occupied_country_tag = ITA
|1.0
   value > 10
|-
|has_navy_size
|<code>size = <float></code><br>The amount to check for.<br>
<code>type = <string></code><br>The type to check for. Optional.<br>
|<pre>has_navy_size = {
    size > 10
   type = capital_ship
}
}
</pre>
</pre>
|Checks if the current scope has the specified number of ships, or of a specified type of ship.
|Compares the average resistance of core states of the specified country within controlled states of the current scope.
|Types:
| Must use either > or < operators for value.
|1.9
|-id="garrison_manpower_need"
|garrison_manpower_need
|<code><int></code><br>Amount to check.
|<pre>garrison_manpower_need > 10000</pre>
|Checks how much garrison manpower we need for resistance in controlled states.
| Must use either > or < operators.
|1.9
|-id="has_core_occupation_modifier"
|has_core_occupation_modifier
|<code>occupied_country_tag = <scope> / <variable></code><br>The country to check.<br />
<code>modifier = <token></code>The modifier to check.
|<pre>has_core_occupation_modifier = { occupied_country_tag = ITA modifier = token }</pre>
|Checks if the current scope has an occupation modifier for resistance/compliance that applies to our occupied states of a specified country.
|
|1.9
|-id="occupation_law"
|occupation_law
|<code><law ID></code><br>The law to check.
|<pre>POL = { POL = { occupation_law = brutally_oppressive_occupation } }  # Checks POL's default occupation law</pre>
<pre>HOL = { BEL = { occupation_law = foreign_civilian_oversight } }  # Checks HOL's occupation law over BEL</pre>
|Checks the occupation law that's either the default or applied over a specific country.
|Checks [[Scopes#PREV usage|PREV's]] occupation law over the current country. If they're the same scope, checks the default occupation law.
|1.12
|}


*submarine
===Military===
*screen_ship
{{SVersion|1.13}}
*capital_ship
*carrier


Must use either > or < operators for size.
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|1.0
|+ {{nowrap|Military-related country-scoped triggers:}}<br/>
|-
! width="10%" |Name
|has_deployed_air_force_size
! width="25%" |Parameters
|<code>size = <float></code><br>The amount to check for.<br>
! width="25%" |Examples
<code>type = <string></code><br>The type to check for. Optional.<br>
! width="20%" |Description
|<pre>has_deployed_air_force_size = {
! width="15%" |Notes
    size > 10
! width="5%" |Version Added
   type = cas
|-id="has_army_experience"
|has_army_experience
|<code><float> / <variable></code><br>The amount to check for.
|<pre>has_army_experience > 10</pre>
<pre>has_army_experience > var:number</pre>
|Checks if the current scope has the specified amount of Army experience.
|'''Must''' use either > or < operators as = operator checks for the '''exact''' value
|1.3
|-id="has_air_experience"
|has_air_experience
|<code><float> / <variable></code><br>The amount to check for.
|<pre>has_air_experience > 10</pre>
|Checks if the current scope has the specified amount of Air experience.
|'''Must''' use either > or < operators as = operator checks for the '''exact''' value
|1.3
|-id="has_navy_experience"
|has_navy_experience
|<code><float> / <variable></code><br>The amount to check for.
|<pre>has_navy_experience < 10</pre>
| Checks if the current scope has the specified amount of Navy experience.
|'''Must''' use either > or < operators as = operator checks for the '''exact''' value
|1.3
|-id="has_manpower"
|has_manpower
|<code><float> / <variable></code><br>The amount to check for.
|<pre>has_manpower > 1000</pre>
|Checks if the current scope has the specified amount of manpower.
|'''Must''' use either > or < operators as = operator checks for the '''exact''' value
| 1.0
|-id="has_army_manpower"
|has_army_manpower
|<code>size = <int></code><br>The amount to check for.
|<pre>has_army_manpower = {
    size > 1000
}
}
</pre>
</pre>
|Checks if the current scope has the specified number of aircraft, or of a specified type of aircraft.
| Checks if the current scope has an army using the specified amount of manpower.
|Types:
|Must use either > or < operators.
 
*fighter
*cas
*naval_bomber
*interceptor
*suicide
*tactical_bomber
*strategic_bomber
*air_transport
*missile
 
Must use either > or < operators for size.
|1.0
|1.0
|-
|-id="manpower_per_military_factory"
|divisions_in_state
|manpower_per_military_factory
|<code>size = <float></code><br>The amount to check for.<br>
|<code><float></code><br>The amount to check for.
<code>type = <string></code><br>The type to check for. Optional.<br>
|<pre>manpower_per_military_factory > 1000</pre>
<code>state = <scope> / <variable></code><br>The state to check in.
|Checks if the current scope has the specified manpower times their number of military factories.
|<pre>
|Must use either > or < operators.
divisions_in_state = {
   type = infantry
   size > 10
   state = 49
}
</pre>
|Checks if the specified state contains the specified amount of divisions.
|Types:
 
*infantry
*support
*artillery
*anti_tank
*armor
 
Must use either > or < operators for size.
|1.0
|1.0
|-
|-id="conscription_ratio"
|divisions_in_border_state
|conscription_ratio
|<code>size = <float></code><br>The amount to check for.<br>
|<code><float> / <variable></code><br>The ratio to compare with.
<code>type = <string></code><br>The type to check for. Optional.<br>
|<pre>conscription_ratio < 0.2</pre>
<code>state = <scope> / <variable></code><br>The state to check in.<br>
| Checks if the current scope has the specified conscription ratio currently, not to be mixed up with the target conscription ratio.
<code>border_state = <scope> / <variable></code><br>The border state to check in.
|'''Must''' use either > or < operators as = operator checks for the '''exact''' value
|<pre>
|1.9
divisions_in_border_state = {
|-id="current_conscription_amount"
   type = infantry
|current_conscription_amount
   size > 10
|<code><float> / <variable></code><br>The amount to compare with.
   state = 49
|<pre>current_conscription_amount > 2000</pre>
   border_state = var:state
|Checks if the current scope has already conscripted that much manpower.
}
|'''Must''' use either > or < operators as = operator checks for the '''exact''' value
</pre>
|1.9
|Checks if the border provinces between the specified state and border state contain the specified amount of divisions.
|-id="target_conscription_amount"
|Types:
|target_conscription_amount
 
|<code><float> / <variable></code><br>The amount to compare with.
*infantry
|<pre>target_conscription_amount > 2000</pre>
*support
|Checks if the current scope is targeting to conscript that much manpower.
*artillery
|'''Must''' use either > or < operators as = operator checks for the '''exact''' value
*anti_tank
|1.9
*armor
|-id="num_divisions"
 
|num_divisions
Must use either > or < operators for size.
|<code><int></code><br>The amount to check for.
|1.5
|<pre>num_divisions > 5</pre>
|-
|Checks if the current scope has the specified amount of divisions.
|ships_in_state_ports
|Must use either > or < operators.
|<code>size = <float></code><br>The amount to check for.<br>
|1.3
<code>type = <string></code><br>The type to check for. Optional.<br>
|-id="num_of_nukes"
<code>state = <scope> / <variable></code><br>The state to check in.<br>
|num_of_nukes
|<pre>
|<code><int></code><br>The amount to check for.
ships_in_state_ports = {
|<pre>num_of_nukes > 5</pre>
   type = capital_ship
|Checks if the current scope has the specified amount of nukes.
   size > 10
| Must use either > or < operators.
   state = 49
}
</pre>
|Checks if the specified state contains the specified amount of ships, or of ships of the specified type.
|Types:
 
*submarine
*screen_ship
*capital_ship
*carrier
 
Must use either > or < operators for size.
|1.0
|1.0
|-
|-id="casualties"
|has_volunteers_amount_from
|casualties
|<code>tag = <scope></code><br>The country to check for.<br>
|<code><int></code><br>The amount to check for.
<code>count = <int></code><br>The amount to check for.
|<pre>casualties > 10000</pre>
|<pre>
|Checks if the current scope has suffered the specified amount of casualties.
has_volunteers_amount_from = {
|Must use either > or < operators.
   tag = GER
   count > 10
}
</pre>
|Checks if the current scope has recieved volunteers from the specified country of the specified amounts.
|Must use either > or < operators for count.
|1.0
|1.0
|-
|-id="casualties_k"
|estimated_intel_max_piercing
| casualties_k
|<code>tag = <scope></code><br>The country to check for.<br>
|<code><int></code><br>The amount to check for.
<code>value = <float></code><br>The amount to check for.
|<pre>casualties_k > 10</pre>
|<pre>
|Checks if the current scope has suffered the specified amount of casualties in thousands.
estimated_intel_max_piercing = {
| Must use either > or < operators.
   tag = GER
   value > 0.5
}
</pre>
|Checks if the specified scope has the specified amount of piercing based on the current scope's intel.
|Must use either > or < operators for value.
|1.0
|1.0
|-
|-id="casualties_inflicted_by"
|estimated_intel_max_armor
|casualties_inflicted_by
|<code>tag = <scope></code><br>The country to check for.<br>
|<code>opponent = <tag></code><br>The tag that inflicted the casualties.<br />
<code>value = <float></code><br>The amount to check for.
<code>thousands <> <int></code><br /> The amount of casualties in thousands.
|<pre>
|<pre>casualties_inflicted_by = {
estimated_intel_max_armor = {
    opponent = POL
    tag = GER
    thousands > 10
    value > 0.5
}</pre>
}
|Checks if the current scope has suffered the specified amount of casualties in thousands from a specific country.
</pre>
|Must use either > or < operators for thousands.
|Checks if the specified scope has the specified amount of armor based on the current scope's intel.
|1.6
|Must use either > or < operators for value.
|-id="amount_manpower_in_deployment_queue"
|1.0
|amount_manpower_in_deployment_queue
|}
|<code><float></code><br>The amount to check for.
 
|<pre>amount_manpower_in_deployment_queue > 1000</pre>
===装备===
|Checks if the current scope has the specified amount of manpower in their deployment queue.
{{SVersion|1.5}}
|Must use either > or < operators.
 
|1.5
{| class="wikitable sortable" width="100%"
|-id="has_attache_from"
! width="10%" |Name
|has_attache_from
! width="25%" |Parameters
|<code><scope> / <variable></code><br>The country to check for.
! width="25%" |Examples
|<pre>has_attache_from = GER</pre>
! width="20%" |Description
|Checks if the current scope has an attache from the specified scope.
! width="15%" |Notes
|
! width="5%" |Version Added
|1.5
|-
|-id="has_attache"
|stockpile_ratio
|has_attache
|<code>archetype = <string></code><br>The equipment archetype to check for.<br>
|<code><bool></code><br>Boolean.
<code>ratio = <float></code><br>The ratio of equipment to check for.
|<pre>has_attache = yes</pre>
|<pre>
|Checks if the current scope has an attache.
stockpile_ratio = {
|
   archetype = infantry_equipment
   ratio > 0.5
}
</pre>
|Checks if the current scope has stockpiled the specified equipment to the specified ratio against fielded equipment of the same type.
|Must use either > or < operators for ratio. <br> For the convoy equipment which is not fielded as other equipments, ratio shall be not a percentage but a direct amount (for instance 256 convoys)
|1.5
|1.5
|-
|-id="is_lend_leasing"
|has_equipment
|is_lend_leasing
|<code><equipment> = <int> / <variable></code><br>The equipment to check for, and the amount to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>
|<pre>is_lend_leasing = GER</pre>
has_equipment = {
|Checks if the current scope is lend leasing to the specified scope.
   infantry_equipment_1 > 10
|
}
</pre>
|Checks if the current scope has the specified equipment to the specified amount.
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="has_template"
|has_any_license
|has_template
|<code><bool></code><br>Boolean.
|<code><string></code><br>The name of the template.
|<pre>has_any_license = yes</pre>
|<pre>has_template = "Infantry Division"</pre>
|Checks if the current scope has any licenses from other countries.
|Checks if the current scope has a division template of the specified name.
|
|1.0
|-id="has_template_majority_unit"
|has_template_majority_unit
|<code><string></code><br>The unit to check for.
|<pre>has_template_majority_unit = infantry</pre>
|Checks if the current scope has a division template composed mostly of the specified unit.
|
|
|1.0
|1.0
|-
|-id="has_template_containing_unit"
|is_licensing_any_to
|has_template_containing_unit
|<code><scope></code><br>The country to check for.
|<code><string></code><br>The name of the unit.
|<pre>is_licensing_any_to = GER</pre>
|<pre>has_template_containing_unit = light_armor</pre>
|Checks if the current scope is licensing to the specified scope.
|Checks if the current scope has a division template contained any of the specified unit.
|
|
|1.0
|1.0
|-
|-id="strength_ratio"
|is_licensing_to
| strength_ratio
|<code>target = <scope></code><br>The country to check for.
|<code>tag = <scope></code><br>The country to check for.
<code>archetype = <string></code><br>The equipment archetype to check for. Optional.<br>
<code>ratio <> <float></code><br>The ratio to check for.
'''Equipment scope'''<br>
|<pre>strength_ratio = {
<code>type = <string></code><br>The equipment to check for. Optional.<br>
    tag = GER
<code>version = <int></code><br>The variant id of the equipment. Optional.
    ratio > 1
|<pre>
is_licensing_to = {
    target = GER
    archetype = infantry_equipment
}
}
</pre>
</pre>
<pre>
|Checks if the current scope has the specified strength ratio against the specified country. The ratio is the number of fielded divisions of the current scope divided by those of <code>tag</code> (or 1 if <code>tag</code> has no divisions). The ratio gets increased by 10% if the current scope has a stronger air forces.<ref>[[forum:1356228/#post-26361808]]</ref>
is_licensing_to = {
|Must use > or < in the ratio.
   target = GER
|1.0
   equipment = {
|-id="naval_strength_ratio"
     type = light_tank_equipment
|naval_strength_ratio
     version = 1
|<code>tag = <scope></code><br>The country to check for.
   }
<code>ratio <> <float></code><br>The ratio to check for.
|<pre>naval_strength_ratio = {
   tag = GER
   ratio <> 1
}
}
</pre>
</pre>
|Checks if the current scope is licensing the specified equipment to the specified country.
|Checks if the current scope has the specified naval strength ratio against the specified country.
|
|Must use > or < in the ratio.
|1.0
|1.0
|-
|-id="naval_strength_comparison"
|has_license
|naval_strength_comparison
|<code>from = <scope></code><br>The country to check for.
|<code>other = <scope></code><br>The country to check for.<br/>
<code>archetype = <string></code><br>The equipment archetype to check for. Optional.<br>
<code>tooltip = <string></code><br>The ratio to check for. Optional.<br/>
'''Equipment scope'''<br>
<code>ratio <> <float></code><br>The ratio to check for.<br/>
<code>type = <string></code><br>The equipment to check for. Optional.<br>
<code>sub_unit_def_weights = { ... }</code> The weight to assign to each unit. Optional.
<code>version = <int></code><br>The variant id of the equipment. Optional.
|<pre>naval_strength_comparison = {
|<pre>
    other = POL
has_license = {
    tooltip = my_loc_key_tt
    from = GER
   ratio > 1
    archetype = infantry_equipment
   sub_unit_def_weights = {
     carrier = 1
     submarine = 2
   }
}
}
</pre>
</pre>
<pre>
|Checks if the current scope has the specified naval strength ratio against the specified country.
has_license = {
|Must use > or < in the ratio. If sub_unit_def_weights is unset, each unit is assumed to have 1 weight. If sub_unit_def_weights is set, only specified units will be counted towards strength. Units are defined in {{path|common/units/*.txt}}.
   from = GER
|1.6
   equipment = {
|-id="alliance_strength_ratio"
     type = light_tank_equipment
|alliance_strength_ratio
     version = 1
|<code><float> / <variable></code><br>The ratio to check for.
   }
|<pre>alliance_strength_ratio > 0.5</pre>
}
|Checks if the current scope and allies has an army strength higher than the specified ratio against estimated enemy strength.
</pre>
|Must use either > or < operators.
|Checks if the current scope has a license for the specified equipment from the specified country.
| 1.0
|
|-id="alliance_naval_strength_ratio"
|alliance_naval_strength_ratio
|<code><float> / <variable></code><br>The ratio to check for.
|<pre>alliance_naval_strength_ratio > 0.5</pre>
|Checks if the current scope and allies has an naval strength ratio higher than the specified ratio against estimated enemy strength.
|Must use either > or < operators.
|1.0
|1.0
|}
|-id="enemies_strength_ratio"
 
|enemies_strength_ratio
===AI===
|<code><float> / <variable></code><br>The ratio to check for.
{{SVersion|1.5}}
|<pre>enemies_strength_ratio > 0.5</pre>
 
|Checks if the estimated enemy army strength ratio is higher than the specified ratio.
{| class="wikitable sortable" width="100%"
|Must use either > or < operators.
! width="10%" |Name
|1.0
! width="25%" |Parameters
|-id="enemies_naval_strength_ratio"
! width="25%" |Examples
| enemies_naval_strength_ratio
! width="20%" |Description
|<code><float> / <variable></code><br>The ratio to check for.
! width="15%" |Notes
|<pre>enemies_naval_strength_ratio > 0.5</pre>
! width="5%" |Version Added
|Checks if the estimated enemy naval strength ratio is higher than the specified ratio.
|-
|ai_irrationality
|<code><int></code><br>The amount to check for.
|<pre>ai_irrationality > 10</pre>
|Checks if the current scope AI has the specified irrationality.
|Must use either > or < operators.
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="has_army_size"
|ai_liberate_desire
|has_army_size
|<code>target = <scope></code><br>The country to check for.
|<code>size = <float></code><br>The amount to check for.<br>
<code>count = <float></code><br>The amount to check for.
<code>type = <string></code><br>The battalion type to check for. Divisions that are majority made up of battalions in that type count. Optional, counts all divisions by default.<br>
|<pre>ai_liberate_desire = {
|<pre>has_army_size = {
    target = GER
    size > 10
    count > 1
    type = armor
}
}
</pre>
</pre>
|Checks if the current scope AI has the specified liberation desire towards the specified country.
|Checks if the current scope has the specified number of divisions, or of a specified type of division.
|Must use either > or < operators for count.
|Battalion types are defined within {{path|common/units/*.txt}} files. Must use either > or < operators for size.
|1.0
|1.0
|-
|-id="has_navy_size"
|ai_has_role_division
|has_navy_size
|<code><string></code><br>The role to check for.
|<code>size = <float>/<variable></code><br>The amount to check for.<br>
|<pre>ai_has_role_division = infantry</pre>
<code>type = <string></code><br>The type to check for. Optional.<br>
|Checks if the current scope AI has a division with the specified role.
<code>archetype = <string></code><br />The ship archetype to check for. Optional.<br />
|Roles are defined in {{path|common/ai_templates/*.txt}}
|<pre>has_navy_size = {
   size > 10
   type = capital_ship
   archetype = ship_hull_heavy
}
</pre>
|Checks if the current scope has the specified number of ships, or of a specified type of ship.
|Ship types are defined within {{path|common/units/*.txt}} files. Must use either > or < operators for size. Ship archetypes are found in {{path|common/units/equipment/*.txt}} files.
|1.0
|1.0
|-
|-id="has_deployed_air_force_size"
|ai_has_role_template
|has_deployed_air_force_size
|<code><string></code><br>The role to check for.
|<code>size = <float></code><br>The amount to check for.<br>
|<pre>ai_has_role_template = armor</pre>
<code>type = <string></code><br>The type to check for. Optional.<br>
|Checks if the current scope AI has a division template with the specified role.
|<pre>has_deployed_air_force_size = {
|Roles are defined in {{path|common/ai_templates/*.txt}}
   size > 10
   type = cas
}
</pre>
|Checks if the current scope has the specified number of aircraft, or of a specified type of aircraft.
|Airwing types are defined within {{path|common/units/*.txt}} files. Must use either > or < operators for size.
|1.0
|1.0
|-
|-id="divisions_in_state"
|ai_wants_divisions
|divisions_in_state
|<code><int></code><br>The amount to check for.
|<code>size = <float></code><br>The amount to check for.<br>
|<pre>ai_wants_divisions > 10</pre>
<code>type = <string></code><br>The battalion type to check for. Divisions that are majority made up of battalions in that type count. Optional, counts all divisions by default.<br>
|Checks if the current scope AI desires the specified amount of divisions.
<code>unit = <string></code><br>The exact battalion to check for. Divisions that are majority made up of that battalions count. Optional, counts all divisions by default.<br>
|Must use either > or < operators.
<code>state = <scope> / <variable></code><br>The state to check in.
|<pre>
divisions_in_state = {
   type = armor
   size > 10
   state = 49
}
</pre>
|Checks if the specified state contains the specified amount of divisions.
|Battalions and their types are defined within {{path|common/units/*.txt}} files. Must use either > or < operators for size.
|1.0
|1.0
|-
|-id="army_manpower_in_state"
|has_template_ai_majority_unit
|army_manpower_in_state
|<code><string></code><br>The unit to check for.
|<code>amount <> <float></code><br>The amount to check for.<br>
|<pre>has_template_ai_majority_unit = infantry</pre>
<code>type = <string></code><br>The type to check for. Optional.<br>
|Checks if the current scope AI has a division template mostly made up of the specified unit.
<code>state = <scope> / <variable></code><br>The state to check in.
|
|<pre>
|1.0
army_manpower_in_state = {
|}
   type = support
 
   amount > 10000
== 地区作用域==
   state = 49
{{SVersion|1.5}}
}
 
</pre>
Can be used in '''state''' scope.
|Checks if the specified state contains the specified amount of army manpower within the state.
 
|Battalion types are defined within {{path|common/units/*.txt}} files. Must use either > or < operators for size.
=== 总览===
|1.6
{{SVersion|1.5}}
|-id="divisions_in_border_state"
 
| divisions_in_border_state
{| class="wikitable sortable" width="100%"
|<code>size = <float></code><br>The amount to check for.<br>
! width="10%" |Name
<code>type = <string></code><br>The battalion type to check for. Divisions that are majority made up of battalions in that type count. Optional, counts all divisions by default.<br>
! width="25%" |Parameters
<code>state = <scope> / <variable></code><br>The state to check in.<br>
! width="25%" |Examples
<code>border_state = <scope> / <variable></code><br>The border state to check in.
! width="20%" |Description
|<pre>
! width="15%" |Notes
divisions_in_border_state = {
! width="5%" |Version Added
   type = infantry
|-
   size > 10
|state
   state = 49
|<code><scope> / <variable></code><br>The state to check for.
   border_state = var:state
|<pre>state = 10</pre>
}
<pre>state = var:state</pre>
</pre>
|Checks if the current scope is the specified state.
|Checks if the border provinces between the specified state and border state contain the specified amount of divisions.
|
|Battalion types are defined within {{path|common/units/*.txt}} files. Must use either > or < operators for size.
|1.0
|1.5
|-
|-id="num_divisions_in_states"
|region
|num_divisions_in_states
|<code><int></code><br>The strategic region id to check for.
|<code>count = <int></code><br>The amount to check for.<br>
|<pre>region = 10</pre>
<code>states = { <int> <...> <int> }</code><br/>The states to check in.<br/>
|Checks if the current scope is a state in the specified strategic region.
<code>types = { <string> <...> <string> }</code><br/>The battalion types to check for. Divisions that are majority made up of battalions in that type count. Optional, counts all divisions by default.<br/>
|
<code>exclude = { <string> <...> <string> }</code><br/>The sub-units to exclude from the search. Divisions that are majority made up of specified battalions are excluded. Optional, excludes no divisions by default.
|<pre>
num_divisions_in_states = {
   count > 24
   states = { 550 559 271 }
   exclude = { irregular_infantry }
}
</pre>
|Checks if the specified states contain enough divisions of the specified types.
|Divisions and their types are defined within {{path|common/units/*.txt}} files. Can use either =, >, or < operators for count. The tooltip does not specify the states the check runs for nor the filtered types.
|1.12
|-id="num_battalions_in_states"
|num_battalions_in_states
|<code>count = <int></code><br>The amount to check for.<br>
<code>states = { <int> <...> <int> }</code><br/>The states to check in.<br/>
<code>types = { <string> <...> <string> }</code><br/>The battalion types to check for.<br/>
<code>exclude = { <string> <...> <string> }</code><br/>The sub-units to exclude from the search.
|<pre>
num_battalions_in_states = {
   count > 24
   states = { 550 559 271 }
   exclude = { irregular_infantry }
}
</pre>
|Checks if the specified states contain enough battalions (or sub-units) of the specified types.
|Battalions and their types are defined within {{path|common/units/*.txt}} files. Can use either =, >, or < operators for count. The tooltip does not specify the states the check runs for nor the filtered types.
|1.12
|-id="ships_in_state_ports"
|ships_in_state_ports
|<code>size = <float></code><br>The amount to check for.<br>
<code>type = <string></code><br>The type to check for. Optional.<br>
<code>state = <scope> / <variable></code><br>The state to check in.<br>
|<pre>
ships_in_state_ports = {
   type = capital_ship
   size > 10
   state = 49
}
</pre>
|Checks if the specified state contains the specified amount of ships, or of ships of the specified type.
|Ship types are defined within {{path|common/units/*.txt}} files. Must use either > or < operators for size.
|1.0
|1.0
|-
|-id="num_planes_stationed_in_regions"
|area
|num_planes_stationed_in_regions
|<code><int></code><br>The supply area id to check for.
|<code>value = <float></code><br>The amount to check for.<br>
|<pre>area = 6</pre>
<code>regions = { <id> <...> <id> }</code><br>The regions to check in.<br>
|Checks if the current scope is a state in the specified supply area.
|<pre>num_planes_stationed_in_regions = {
|
   value > 10
|1.0
   regions = { 123 321 }
|-
}
|has_state_flag
</pre>
|<code><string></code><br>The flag to check for.
|Checks if the current scope has the specified number of aircraft stationed within strategic regions.
|<pre>has_state_flag = my_flag</pre>
|Must use either =, >, or < operators for value.
|Checks if the current scope has the specified flag.
|1.12
|
|-id="has_volunteers_amount_from"
|1.0
|has_volunteers_amount_from
|-
|<code>tag = <scope></code><br>The country to check for.<br>
|has_state_flag
<code>count = <int></code><br>The amount to check for.
|<code>flag = <string></code><br>The flag to check.<br>
<code>value = <int></code><br>The flag value to check for. Optional.<br>
<code>date = <date></code><br>The flag creation date to check for. Optional.<br>
<code>days = <int></code><br>The duration the flag existed for. Optional.
|<pre>
|<pre>
has_state_flag = {
has_volunteers_amount_from = {
    flag = my_flag
    tag = GER
    days > 30
    count > 10
   date > 1936.6.1
   value > 0
}
}
</pre>
</pre>
|Compares the specified flag's last set date, days since last set, and/or value.
|Checks if the current scope has recieved volunteers from the specified country of the specified amounts.
|If not set, the value comparison is <code>>0</code>. <code>value</code> is limited between -32768 and 32767.
|Must use either > or < operators for count.
|1.0
|1.0
|-
|-id="convoy_threat"
|<building>
|convoy_threat
|<code><building> = <int></code><br>The amount of the specified building to to check for.
|<code><float></code><br>The threat to compate with.
|<pre>arms_factory > 10</pre>
|<pre>
|Checks if the current scope has the specified amount of the specified building.
convoy_threat > 0.5
|Must use either > or < operators.
</pre>
|1.0
|Checks how much the convoys are threatened.
|-
|Must use either > or < operators for count. Threat is always between 0 and 1.
|state_population
|1.6
|<code><float></code><br>The amount to check for.
|-id="has_mined"
|<pre>state_population > 10000</pre>
|has_mined
|Checks if the current scope has the specified state population.
|<code>target = <tag></code><br>The country the coast of which is mined.<br />
|Must use either > or < operators.
<code>value <> <int></code><br />The amount of mines to compare with.
|1.0
|<pre>
|-
has_mined = {
|is_capital
   target = POL
|<code><bool></code><br>Boolean.
   value > 1000
|<pre>is_capital = yes</pre>
}</pre>
|Checks if the current scope is a capital.
| Checks if the current scope has X mines on the coast of the specified country.
|Must use either > or < operators for value.
|1.6
|-id="has_mines"
|has_mines
|<code>region = <ID></code><br>The strategic region that contains the mines.<br />
<code>amount = <int></code><br />The amount of mines to compare with.
|<pre>
has_mined = {
   target = POL
   amount = 1000
}</pre>
|Checks if the current scope has at least X mines within the specified strategic region.
|
|
|1.6
|-id="mine_threat"
|mine_threat
|<code><float></code><br>The threat to compate with.
|<pre>mine_threat < 0.6</pre>
| Checks how dangerous enemy mines are.
|Must use either > or < operators for count. Threat is always between 0 and 1.
|1.6
|-id="has_military_industrial_organization"
|has_military_industrial_organization
|<code><token></code><br>The id to check for.
|<pre>has_military_industrial_organization = infantry_mio_token</pre>
|Checks if the current scope has a MIO with the specified name.
|Accepts variables.
|1.13
|}
===Equipment ===
{{SVersion|1.13}}
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Equipment-related country-scoped triggers:}}<br/>
! width="10%" | Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="stockpile_ratio"
| stockpile_ratio
|<code>archetype = <string></code><br>The equipment archetype to check for.<br>
<code>ratio = <float></code><br>The ratio of equipment to check for.
|<pre>
stockpile_ratio = {
   archetype = infantry_equipment
   ratio > 0.5
}
</pre>
|Checks if the current scope has stockpiled the specified equipment to the specified ratio against fielded equipment of the same type.
|Must use either > or < operators for ratio. <br> For the convoy equipment which is not fielded as other equipments, ratio shall be not a percentage but a direct amount (for instance 256 convoys)
|1.5
|1.5
|-
|-id="has_equipment"
|is_controlled_by
|has_equipment
|<code><scope> / <variable></code><br>The country to check for.
|<code><equipment> = <int> / <variable></code><br>The equipment to check for, and the amount to check for.
|<pre>is_controlled_by = GER</pre>
|<pre>
|Checks if the current scope is controlled by the specified country.
has_equipment = {
   infantry_equipment_1 > 10
}
</pre>
|Checks if the current scope has the specified equipment to the specified amount.
|Must use either > or < operators.
| 1.0
|-id="has_any_license"
|has_any_license
|<code><bool></code><br>Boolean.
|<pre>has_any_license = yes</pre>
|Checks if the current scope has any licenses from other countries.
|
|
|1.0
|1.0
|-
|-id="is_licensing_any_to"
|is_fully_controlled_by
|is_licensing_any_to
|<code><scope> / <variable></code><br>The country to check for.
|<code><scope></code><br>The country to check for.
|<pre>is_fully_controlled_by = GER</pre>
|<pre>is_licensing_any_to = GER</pre>
|Checks if the current scope is fully controlled by the specified country.
|Checks if the current scope is licensing to the specified scope.
|
|1.5
|-
|is_owned_by
|<code><scope> / <variable></code><br>The country to check for.
|<pre>is_owned_by = GER</pre>
|Checks if the current scope is owned by the specified country.
|
|
|1.0
|1.0
|-
|-id="is_licensing_to"
|is_claimed_by
|is_licensing_to
|<code><scope> / <variable></code><br>The country to check for.
|<code>target = <scope></code><br>The country to check for.
|<pre>is_claimed_by = GER</pre>
<code>archetype = <string></code><br>The equipment archetype to check for. Optional.<br>
|Checks if the current scope is claimed by the specified country.
'''Equipment scope'''<br>
<code>type = <string></code><br>The equipment to check for. Optional.<br>
<code>version = <int></code><br>The variant id of the equipment. Optional.
|<pre>
is_licensing_to = {
   target = GER
   archetype = infantry_equipment
}
</pre>
<pre>
is_licensing_to = {
   target = GER
   equipment = {
     type = light_tank_equipment
     version = 1
   }
}
</pre>
|Checks if the current scope is licensing the specified equipment to the specified country.
|
|
|1.0
|1.0
|-
|-id="has_license"
|is_core_of
|has_license
|<code><scope> / <variable></code><br>The country to check for.
|<code>from = <scope></code><br>The country to check for.
|<pre>is_core_of = GER</pre>
<code>archetype = <string></code><br>The equipment archetype to check for. Optional.<br>
|Checks if the current scope is a core of the specified country.
'''Equipment scope'''<br>
<code>type = <string></code><br>The equipment to check for. Optional.<br>
<code>version = <int></code><br>The variant id of the equipment. Optional.
|<pre>
has_license = {
   from = GER
   archetype = infantry_equipment
}
</pre>
<pre>
has_license = {
   from = GER
   equipment = {
     type = light_tank_equipment
     version = 1
   }
}
</pre>
|Checks if the current scope has a license for the specified equipment from the specified country.
|
|
|1.0
|1.0
|-
|-id="fuel_ratio"
|is_owned_and_controlled_by
|fuel_ratio
|<code><scope> / <variable></code><br>The country to check for.
|<code><float></code><br>The ratio to check with.
|<pre>is_owned_and_controlled_by = GER</pre>
|<pre>fuel_ratio > 0.4</pre>
|Checks if the current scope is owned and controlled by the specified country.
|Checks the fuel ratio of the country.
|
|Must use either < or > operators.
|1.0
|1.6
|-
|-id="has_fuel"
|is_demilitarized_zone
|has_fuel
|<code><bool></code><br>Boolean.
|<code><int></code><br>The amount to compare with.
|<pre>is_demilitarized_zone = yes</pre>
|<pre>has_fuel > 400</pre>
|Checks if the current scope is a demilitarized zone.
|Checks the fuel amount of the country.
|
|Must use either < or > operators.
|1.6
|-id="has_design_based_on"
|has_design_based_on
|<code><archetype></code><br>The equipment archetype.
|<pre>has_design_based_on = light_tank_chassis</pre>
|Checks if the country has a builtable non-obsolete design based on the specified equipment archetype.
|Equipment archetypes can be seen in {{path|common/units/equipment/*}}.
|1.11
|}
 
===Intelligence===
{{SVersion|1.13}}
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Intelligence-related country-scoped triggers:}}<br/>
! width="10%" |Name
! width="25%" | Parameters
! width="25%" | Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="estimated_intel_max_piercing"
|estimated_intel_max_piercing
|<code>tag = <scope></code><br>The country to check for.<br>
<code>value = <float></code><br>The amount to check for.
|<pre>
estimated_intel_max_piercing = {
   tag = GER
   value > 0.5
}
</pre>
|Checks if the specified scope has the specified amount of piercing based on the current scope's intel.
|Must use either > or < operators for value.
|1.0
|1.0
|-
|-id="estimated_intel_max_armor"
|is_border_conflict
|estimated_intel_max_armor
|<code><bool></code><br>Boolean.
|<code>tag = <scope></code><br>The country to check for.<br>
|<pre>is_border_conflict = yes</pre>
<code>value = <float></code><br>The amount to check for.
|Checks if the current scope is part of a border war.
|<pre>
|
estimated_intel_max_armor = {
|1.0
   tag = GER
|-
   value > 0.5
|is_in_home_area
}
|<code><bool></code><br>Boolean.
</pre>
|<pre>is_in_home_area = yes</pre>
|Checks if the specified scope has the specified amount of armor based on the current scope's intel.
|Checks if the current scope is connected to the capital state over land.
|Must use either > or < operators for value.
|
|1.0
|1.0
|-
|-id="compare_intel_with"
|is_coastal
|compare_intel_with
|<code><bool></code><br>Boolean.
|<code>target = <tag></code><br>The target to compare with.<br />
|<pre>is_coastal = yes</pre>
<code>civilian_intel <>= <float></code><br>Comparison of civilian intel.<br />
|Checks if the current scope is a coastal state.
<code>army_intel <>= <float></code><br>Comparison of army intel.<br />
<code>navy_intel <>= <float></code><br>Comparison of navy intel.<br />
<code>airforce_intel <>= <float></code><br>Comparison of airforce intel.<br />
|<pre>compare_intel_with = {
   target = POL
   civilian_intel > 0.5
   army_intel = 0
   navy_intel < 0
}</pre>
|Compares intel between 2 countries.
|Can use < (in which case the current country has x less intel), >, and = (in which case it must be equal).
| 1.9
|-id="intel_level_over"
|intel_level_over
|<code>target = <tag></code><br>The target to compare with.<br />
<code>civilian_intel <>= <float></code><br>Comparison of civilian intel.<br />
<code>army_intel <>= <float></code><br>Comparison of army intel.<br />
<code>navy_intel <>= <float></code><br>Comparison of navy intel.<br />
<code>airforce_intel <>= <float></code><br>Comparison of airforce intel.<br />
|<pre>intel_level_over = {
   target = POL
   civilian_intel > 0.5
   army_intel = 0
   navy_intel < 0
}</pre>
|Checks the intel level from the current country over a specified country.
|Can use < (in which case the current country has x less intel), >, and = (in which case it must be equal).
|1.9
|-id="has_intelligence_agency"
|has_intelligence_agency
|<code><boolean></code><br>The intelligence agency to check.<br>
|<pre>has_intelligence_agency = yes</pre>
|Checks if the current scope has an intelligence agency.
|
|
|1.0
|1.9
|-
|-id="network_national_coverage"
|is_island_state
|network_national_coverage
|<code><bool></code><br>Boolean.
|<code>target = <tag></code><br>The country which is checked.<br>
|<pre>is_island_state = yes</pre>
<code>value <> <float></code><br />The value of network.
|Checks if the current scope is a coastal state with no adjacent land states.
|<pre>network_national_coverage = {
   target = POL
   value < 70
}</pre>
|Checks network national coverage over a specific country.
|Must use < or > for value.
|-id="network_strength"
|network_strength
|<code>target = <tag></code><br>The country which is checked.<br>
<code>state = <id></code><br />The state which is checked.<br />
<code>value <> <float></code><br />The strength of network.
|<pre>network_strength = {
   target = POL
   value < 70
}</pre>
|Checks network national coverage over a specific country.
|Must use < or > for value. Can use either or both of target and state.
|1.9
|-id="has_done_agency_upgrade"
|has_done_agency_upgrade
|<code><string></code><br>The agency upgrade to check.<br>
|<pre>has_done_agency_upgrade = upgrade_army_department</pre>
|Checks if the current scope has the specified agency upgrade (to its highest level).
|
|
|1.0
|1.9
|-
|-id="agency_upgrade_number"
|is_on_continent
|agency_upgrade_number
|<code><string></code><br>The continent to check for.
|<code><int></code><br>The amount of agency upgrades to check for.<br>
|<pre>is_on_continent = europe</pre>
|<pre>agency_upgrade_number > 4</pre>
|Checks if the current scope is on the specified continent.
|Checks the number of upgrades done in the current scope's intelligence agency.
|Continents are found in {{path|map/continent.txt}}.
|Must use either > or < operators.
|1.0
|1.9
|-
|-id="decryption_progress"
|has_state_category
|decryption_progress
|<code><string></code><br>The category to check for.
|<code>target = <tag></code><br>The country to compare with.<br>
|<pre>has_state_category = rural</pre>
<code>value <> <float></code><br />The value to compare.
|Checks if the current scope has the specified category.
|<pre>decryption_progress = {
|State categories are found in {{path|common/state_category/*.txt}}.
   target = POL
|1.0
   value < 0.5
|-
}</pre>
|state_strategic_value
| Checks the decryption progress towards a country.
|<code><int></code><br>The amount to check for.
|Must use either > or < operators for value.
|<pre>state_strategic_value > 10</pre>
|1.9
|Checks if the current scope has the specified strategic value.
|-id="has_captured_operative"
|Must use either > or < operators.
|has_captured_operative
|1.5
|<code><tag>/<bool></code><br>Country whose operative was captured/Whether an operative was captured.
|-
|<pre>has_captured_operative = POL</pre>
|state_and_terrain_strategic_value
<pre>has_captured_operative = yes</pre>
|Checks if the current scope has captured an operative.
|
|1.9
|-id="has_finished_collecting_for_operation"
|has_finished_collecting_for_operation
|<code>target = <tag></code><br>Country towards whom the operation is targeted.<br />
<code>operation = <token></code><br />The operation which current scope is planning against the target.
|<pre>has_finished_collecting_for_operation = {
   target = POL
   operation = operation_infiltrate_armed_forces_navy
}</pre>
|Checks if the current scope has finished collecting resources for an operation.
|
|1.9
|-id="is_preparing_operation"
|is_preparing_operation
|<code>target = <tag></code><br>Country towards whom the operation is targeted.<br />
<code>operation = <token></code><br />The operation which current scope is planning against the target. Optional.
|<pre>is_preparing_operation = {
   target = POL
   operation = operation_infiltrate_armed_forces_navy
}</pre>
| Checks if the current scope is preparing an operation against the specified country.
|
|1.9
|-id="is_running_operation"
|is_running_operation
|<code>target = <tag></code><br>Country towards whom the operation is targeted.<br />
<code>operation = <token></code><br />The operation which current scope is planning against the target. Optional.
|<pre>is_running_operation = {
   target = POL
   operation = operation_infiltrate_armed_forces_navy
}</pre>
| Checks if the current scope is running an operation against the specified country.
|
|1.9
|-id="num_finished_operations"
|num_finished_operations
|<code>target = <tag></code><br>Country towards whom the operation is targeted.<br />
<code>operation = <token></code><br />The operation which current scope is planning against the target. Optional.
|<pre>num_finished_operations = {
   target = POL
   operation = operation_infiltrate_armed_forces_navy
}</pre>
|Checks how many finished operations the current scope had against the specified country.
|
|1.9
|-id="has_operation_token"
|has_operation_token
|<code>tag = <tag></code><br>Country towards whom the operation is targeted.<br />
<code>token = <token></code><br />The operation token.
|<pre>has_operation_token = {
   tag = POL
   token = token_name
}</pre>
|Checks if the current scope has an operation token against an another country.
|
|1.9
|-id="is_active_decryption_bonuses_enabled"
|is_active_decryption_bonuses_enabled
|<code><tag></code><br>The country towards which the bonus is enabled.
|<pre>is_active_decryption_bonuses_enabled = POL</pre>
|Checks if the current scope has any decryption bonuses towards the specified country.
|
|1.9
|-id="is_cryptology_department_active"
|is_cryptology_department_active
|<code><bool></code><br>Boolean.
|<pre>is_cryptology_department_active = yes</pre>
|Checks if the current scope has a cryptology department active.
|
|1.9
|-id="is_decrypting"
|is_decrypting
|<code><tag></code><br>The country which is decrypted.
|<pre>is_decrypting = POL</pre>
|Checks if the current scope is decrypting a certain country.
|
|1.9
|-id="is_fully_decrypted"
|is_fully_decrypted
|<code><tag></code><br>The country which is decrypted.
|<pre>is_fully_decrypted = POL</pre>
|Checks if the current scope has fully decrypted a certain country.
|
|1.9
|-id="num_fake_intel_divisions"
|num_fake_intel_divisions
|<code><int></code><br>Amount of divisions.
|<pre>num_fake_intel_divisions > 10</pre>
|Checks the amount of fake intel divisions.
|Must use either < or >.
|1.9
|-id="num_free_operative_slots"
|num_free_operative_slots
|<code><int></code><br>Amount of slots.
|<pre>num_free_operative_slots > 2</pre>
|Checks the amount of free operative slots.
|Must use either < or >.
|1.9
|-id="num_operative_slots"
|num_operative_slots
|<code><int></code><br>Amount of slots.
|<pre>num_operative_slots > 2</pre>
|Checks the amount of operative slots.
|Must use either < or >.
|1.9
|-id="num_of_operatives"
|num_of_operatives
|<code><int></code><br>Amount of operatives.
|<pre>num_of_operatives > 2</pre>
|Checks the amount of operatives.
|Must use either < or >.
|1.9
|}
 
===AI===
{{SVersion|1.13}}
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|AI-related country-scoped triggers:}}<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" | Version Added
|-id="ai_irrationality"
|ai_irrationality
|<code><int></code><br>The amount to check for.
|<code><int></code><br>The amount to check for.
|<pre>state_and_terrain_strategic_value > 10</pre>
|<pre>ai_irrationality > 10</pre>
|Checks if the current scope has the specified state and terrain strategic value.
|Checks if the current scope AI has the specified irrationality.
|Must use either > or < operators.
|Must use either > or < operators.
|1.5
|1.0
|-
|-id="ai_liberate_desire"
|free_building_slots
|ai_liberate_desire
|<code>building = <string></code><br>The building to check for.<br>
|<code>target = <scope></code><br>The country to check for.
<code>size = <int></code><br>The amount to check for.<br>
<code>count = <float></code><br>The amount to check for.
<code>include_locked = <bool></code><br>Whether to include locked slots.
|<pre>ai_liberate_desire = {
|<pre>
    target = GER
free_building_slots = {
    count > 1
    building = arms_factory
    size > 10
   include_locked = yes
}
}
</pre>
</pre>
|Checks if the current scope has available slots for the specified amount of buildings.
|Checks if the current scope AI has the specified liberation desire towards the specified country.
|Must use either > or < operators for size.
|Must use either > or < operators for count.
|1.0
|1.0
|-
|-id="ai_has_role_division"
|any_province_building_level
|ai_has_role_division
|<code>building = <string></code><br>The building to check for.<br>
|<code><string></code><br>The role to check for.
<code>limit = <int></code><br>The amount to check for.<br>
|<pre>ai_has_role_division = infantry</pre>
'''Province scope'''<br>
|Checks if the current scope AI has a division with the specified role.
<code>id = <int></code><br>The province to check for.<br>
|Roles are defined in {{path|common/ai_templates/*.txt}}
<code>limit_to_border = <bool></code><br>Whether to limit check to border provinces.
|<pre>
any_province_building_level = {
   province = {
     id = 445
     id = 494
     limit_to_border = yes
   }
   building = bunker
   level < 5
}
</pre>
|Checks if the current scope has the specified provincal building at the specified amount in the specified provinces.
|Must use either > or < operators for level.
|1.0
|1.0
|-
|-id="ai_has_role_template"
|num_owned_neighbour_states
|ai_has_role_template
|<code>owner = <scope></code><br>The country to check for.
|<code><string></code><br>The role to check for.
<code>count = <int></code><br>The amount to check for.
|<pre>ai_has_role_template = armor</pre>
|<pre>num_owned_neighbour_states = {
|Checks if the current scope AI has a division template with the specified role.
   owner = GER
| Roles are defined in {{path|common/ai_templates/*.txt}}
   count = 2
}
</pre>
|Checks if the current scope has the specified amount of neighbor states belonging to the specified country.
|Must use either > or < operators for count.
|1.0
|1.0
|-
|-id="ai_wants_divisions"
|has_claimed_state_in_peace_conference
|ai_wants_divisions
|<code><scope> / <variable></code><br>The country to check for.
|<code><int></code><br>The amount to check for.
|<pre>has_claimed_state_in_peace_conference = GER</pre>
|<pre>ai_wants_divisions > 10</pre>
|Checks if the current scope has been claimed by the specified country in a peace conference.
| Checks if the current scope AI desires the specified amount of divisions.
|
|Must use either > or < operators.
|1.0
|-id="has_template_ai_majority_unit"
|has_template_ai_majority_unit
|<code><string></code><br>The unit to check for.
|<pre>has_template_ai_majority_unit = infantry</pre>
|Checks if the current scope AI has a division template mostly made up of the specified unit.
|
|1.0
|1.0
|-
|}
|num_claimed_peace_conference_neighbour_states
 
|<code>owner = <scope></code><br>The country to check for.
===Characters===
<code>count = <int></code><br>The amount to check for.
{{SVersion|1.13}}
|<pre>num_claimed_peace_conference_neighbour_states = {
These are character-related triggers in the country scope, not [[#Character scope|character-scoped triggers]].
    owner = GER
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
   count > 2
|+ {{nowrap|Character-related country-scoped triggers:}}<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" | Examples
! width="20%" | Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="can_be_country_leader"
| can_be_country_leader
|<code><character></code><br>The character to check.
|<pre>can_be_country_leader = POL_character_test</pre>
|Checks if the specified character has a country leader role, active or not, and can utilise it in this country.
|
|1.11
|-id="has_character"
|has_character
|<code><string></code><br>The character to check.
|<pre>has_character = my_character</pre>
|Checks if the current scope has the specified character recruited. The character does NOT need to be in power.
|
|1.11
|-id="has_country_leader"
|has_country_leader
|<code>ruling_only = <bool></code>(default = yes) Limit check to ruling only. <br/>
<code>character = <character_token></code> (recommended criteria) The character to check for. Optional. <br/><code>name = <string></code><br>The name to check for. Optional. <br/><code>id = <int></code><br>The id to check for. Optional. <br/>
|<pre>has_country_leader = {
    id = 10
}
</pre><pre>
has_country_leader = {
character = SPR_niceto_alcala_zamora
ruling_only = yes
}
}
</pre>
</pre>
|Checks if the current scope has the specified amount of neighbor states claimed by the specified country in a peace conference.
<pre>
|Must use either > or < operators for count.
has_country_leader = {
|1.0
    name = "John Smith"
|-
    ruling_only = yes
|distance_to
|<code>distance = <float></code><br>The distance to check for.
<code>state = <scope></code><br>The state to compare against.
|<pre>
distance_to = {
    value > 1000
    target = 49
}
}
</pre>
</pre>
|Checks if the current scope is at the specified distance from the specified state.
|Checks if the current scope has the specified country leader.
|Must use either > or < operators for distance.
|1.0
|-
|ships_in_area
|<code>area = <int></code><br>The strategic region to check for.
<code>size = <int></code><br>The amount to check for.
|<pre></pre>
|Checks if the current scope has the specified amount of ships in the specified strategic region.
|Must use either > or < operators for count.
|1.0
|-
|any_neighbor_state
|triggers
|<pre>any_neighbor_state = { is_coastal = yes }</pre>
|Returns true if THIS has at least one adjacent state that fulfills the sub-triggers; false otherwise. Evaluation stops early if any neighbor passes the check.
|
|
|1.3
|-id="has_country_leader_ideology"
|has_country_leader_ideology
|<ideology>
Checks the ideology of the active country leader
|<pre>has_country_leader_ideology = nazism</pre>
|Checks if the current scope's active country leader has the specified ideology.
|
|
|-
|1.11
|all_neighbor_state
|-id="has_country_leader_with_trait"
|triggers
|has_country_leader_with_trait
|<pre>all_neighbor_state = { is_coastal = yes }</pre>
|<code><string></code><br>The trait to check.
|Returns false if THIS has no adjacent states or at least one of them fails the sub-triggers; true otherwise. Evaluation stops early if any neighbor fails the check.
|<pre>has_country_leader_with_trait = champion_of_peace_1</pre>
|Checks if the leader of the country has a specific trait.
|
|
|1.6
|-id="is_female"
|is_female
|<code><bool></code><br>Boolean.
|<pre>is_female = yes</pre>
|Checks if the current country leader is female.
|
|
|1.9
|-id="has_unit_leader"
|has_unit_leader
|<code><int></code><br>The id to check for.
|<pre>has_unit_leader = 1</pre>
|Checks if the current scope has a unit leader with the specified id.
|Only the legacy ID can be used, the character ID doesn't work.
|1.0
|}
|}
 
===Peace conferences===
== 部队将领作用域==
{{SVersion|1.13}}
{{SVersion|1.5}}
These are not exactly peace conference-related triggers, but '''those that can only be used within peace conferences'''.
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
Can be used in '''unit leader''' scope.
|+ {{nowrap|Peace conference-only country-scoped triggers:}}<br/>
 
===总览===
{{SVersion|1.5}}
 
{| class="wikitable sortable" width="100%"
! width="10%" |Name
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Parameters
! width="25%" |Examples
! width="25%" | Examples
! width="20%" |Description
! width="20%" | Description
! width="15%" |Notes
! width="15%" |Notes
! width="5%" |Version Added
! width="5%" |Version Added
|-
|-id="pc_is_winner"
|has_id
|pc_is_winner
|<code><int></code><br>The id to check for.
|<code><bool></code><br>Boolean.
|<pre>has_id = 1</pre>
|<pre>pc_is_winner = yes</pre>
|Checks if the current scope has the specificed unit leader id.
|Checks if the current scope is a winner within the peace conference.
|
|
|1.5
|1.12
|-
|-id="pc_is_on_winning_side"
|has_unit_leader_flag
|pc_is_on_winning_side
|<code><string></code><br>The flag to check for.
|<code><bool></code><br>Boolean.
|<pre>has_unit_leader_flag = my_flag</pre>
|<pre>pc_is_on_winning_side = yes</pre>
|Checks if the current scope has the specified flag.
|Checks if the current scope is on the winning side within the peace conference.
|
|
|1.5
|1.12
|-
|-id="pc_is_loser"
|has_unit_leader_flag
|pc_is_loser
|<code>flag = <string></code><br>The flag to check.<br>
<code>value = <int></code><br>The flag value to check for. Optional.<br>
<code>date = <date></code><br>The flag creation date to check for. Optional.<br>
<code>days = <int></code><br>The duration the flag existed for. Optional.
|<pre>
has_unit_leader_flag = {
   flag = my_flag
   days > 30
   date > 1936.6.1
   value > 0
}
</pre>
|Compares the specified flag's last set date, days since last set, and/or value.
|If not set, the value comparison is <code>>0</code>. <code>value</code> is limited between -32768 and 32767.
|1.0
|-
|is_leading_army
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>is_leading_army = yes</pre>
|<pre>pc_is_loser = yes</pre>
|Checks if the current scope is leading a single army.
|Checks if the current scope is a loser within the peace conference.
|
|
|1.5
|1.12
|-
|-id="pc_is_untouched_loser"
|is_leading_army_group
|pc_is_untouched_loser
|<code><bool></code><br>Boolean.
|<pre>pc_is_untouched_loser = yes</pre>
|Checks if the current scope is an untouched loser within the peace conference.
|
|1.12
|-id="pc_is_on_same_side_as"
|pc_is_on_same_side_as
|<code><scope></code><br>Country to check for.
|<pre>pc_is_on_same_side_as = BHR</pre>
|Checks if the current scope is on the same side of the peace conference as the specified country.
|
|1.12
|-id="pc_is_liberated"
|pc_is_liberated
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>is_leading_army_group = yes</pre>
|<pre>pc_is_liberated = yes</pre>
|Checks if the current scope is leading an army group.
|Checks if the current scope has been liberated within the peace conference.
|
|1.12
|-id="pc_is_liberated_by"
|pc_is_liberated_by
|<code><scope></code><br>Country to check for.
|<pre>pc_is_liberated_by = BHR</pre>
|Checks if the current scope has been liberated within the peace conference by the specified country.
|
|
|1.5
|1.12
|-
|-id="pc_is_puppeted"
|is_field_marshal
|pc_is_puppeted
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>is_field_marshal = yes</pre>
|<pre>pc_is_puppeted = yes</pre>
|Checks if the current scope is a Field Marshal.
|Checks if the current scope has been puppeted within the peace conference.
|
|1.12
|-id="pc_is_puppeted_by"
|pc_is_puppeted_by
|<code><scope></code><br>Country to check for.
|<pre>pc_is_puppeted_by = BHR</pre>
|Checks if the current scope has been puppeted within the peace conference by the specified country.
|
|
|1.5
|1.12
|-
|-id="pc_is_forced_government"
|is_assigned
|pc_is_forced_government
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>is_assigned = yes</pre>
|<pre>pc_is_forced_government = yes</pre>
|Checks if the current scope is an assigned unit leader.
|Checks if the current scope has had an enforced government change within the peace conference.
|
|
|1.5
|1.12
|-
|-id="pc_is_forced_government_by"
|has_trait
|pc_is_forced_government_by
|<code><string></code><br>The trait to check for.
|<code><scope></code><br>Country to check for.
|<pre>has_trait = offensive_doctrine</pre>
|<pre>pc_is_forced_government_by = BHR</pre>
|Checks if the current scope has the specified trait.
|Checks if the current scope has had an enforced government change within the peace conference demanded by the specified country.
|
|
|1.5
|1.12
|-
|-id="pc_is_forced_government_to"
|can_select_trait
|pc_is_forced_government_to
|<code><string></code><br>The trait to check for.
|<code><ideology group></code><br>Ideology group to check for.
|<pre>can_select_trait = offensive_doctrine</pre>
|<pre>pc_is_forced_government_to = democratic</pre>
|Checks if the current scope can select the specified trait.
|Checks if the current scope has had an enforced government change to the specified ideology group.
|
|
|1.5
|1.12
|-
|-id="pc_total_score"
|has_ability
|pc_total_score
|<code><string></code><br>The ability to check for.
|<code><decimal></code><br>Scope to check for.
|<pre>has_ability = glider_planes</pre>
|<pre>pc_total_score > 2400</pre>
|Checks if the current scope has the specified unit leader ability.
|Checks if the current scope has the specified amount in total score within the peace conference.
|Can only be used for the winning countries.
|1.12
|-id="pc_current_score"
|pc_current_score
|<code><decimal></code><br>Scope to check for.
|<pre>pc_current_score > 100</pre>
|Checks if the current scope has the specified amount in current score within the peace conference.
|Can only be used for the winning countries.
|1.12
|}
 
==State scope ==
{{SVersion|1.13}}
 
Can be used in '''state''' scope.
 
===General===
{{SVersion|1.13}}
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|General state-scoped triggers:}}<br/>
! width="10%" | Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="state"
|state
|<code><scope> / <variable></code><br>The state to check for.
|<pre>state = 10</pre>
<pre>state = var:state</pre>
|Checks if the current scope is the specified state.
|
|
|1.5
|-
|skill
|<code><int></code><br>The amount to check for.
|<pre>skill > 1</pre>
|Checks if the current scope has a Skill above the specified amount.
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="region"
|skill_advantage
|region
|<code><int></code><br>The amount to check for.
|<code><int></code><br>The strategic region id to check for.
|<pre>skill_advantage > 1</pre>
|<pre>region = 10</pre>
|Checks if the current scope has a Skill advantage above the specified amount in against an enemy unit leader whilst in combat.
|Checks if the current scope is a state in the specified strategic region.
|Must use either > or < operators.
|
|1.0
|1.0
|-
|-id="s_building_count_trigger"
|planning_skill_level
|<building> (building_count_trigger)
|<code><int></code><br>The amount to check for.
|<code><int></code><br>The amount of the specified building to check for.
|<pre>planning_skill_level > 1</pre>
|<pre>arms_factory > 10</pre>
|Checks if the current scope has a Planning skill above the specified amount.
| Checks if the current scope has the specified amount of the specified building.
|Must use either > or < operators.
| Must use either > or < operators.
|1.5
|1.0
|-
|-id="free_building_slots"
|logistics_skill_level
|free_building_slots
|<code><int></code><br>The amount to check for.
|<code>building = <string></code><br>The building to check for.<br>
|<pre>logistics_skill_level > 1</pre>
<code>size = <int></code><br>The amount to check for.<br>
|Checks if the current scope has a Logistics skill above the specified amount.
<code>include_locked = <bool></code><br>Whether to include locked slots.
|Must use either > or < operators.
|<pre>
|1.5
free_building_slots = {
|-
   building = arms_factory
|defense_skill_level
   size > 10
|<code><int></code><br>The amount to check for.
   include_locked = yes
|<pre>defense_skill_level > 1</pre>
}
|Checks if the current scope has a Defense skill above the specified amount.
</pre>
|Must use either > or < operators.
|Checks if the current scope has available slots for the specified amount of buildings.
|1.5
|Must use either > or < operators for size.
|-
|1.0
|attack_skill_level
|-id="non_damaged_building_level"
|<code><int></code><br>The amount to check for.
|non_damaged_building_level
|<pre>attack_skill_level > 1</pre>
|<code>building = <string></code><br>The building to check for.<br>
|Checks if the current scope has a Attack skill above the specified amount.
<code>level = <int></code><br>The amount to check for.<br>
|Must use either > or < operators.
|<pre>
|1.5
non_damaged_building_level = {
|-
   building = arms_factory
|average_stats
   level > 4
|<code><int></code><br>The amount to check for.
}
|<pre>average_stats > 5</pre>
</pre>
|Checks if the current scope has an average skill above the specified amount.
|Checks if the current scope has the specified amount of the specified buildings that are undamaged.
|Must use either > or < operators.
|Must use either > or < operators for level.
|1.5
|1.9
|-
|-id="any_province_building_level"
|is_border_war
|any_province_building_level
|<code><bool></code><br>Boolean.
|<code>building = <string></code><br>The building to check for.<br>
|<pre>is_border_war = yes</pre>
<code>limit = <int></code><br>The amount to check for.<br>
|Checks if the current socpe is in a border war.
'''Province scope'''<br>
<code>id = <int></code><br>The province to check for.<br>
<code>limit_to_border = <bool></code><br>Whether to limit check to border provinces.
|<pre>
any_province_building_level = {
   province = {
     id = 445
     id = 494
     limit_to_border = yes
   }
   building = bunker
   level < 5
}
</pre>
|Checks if the current scope has the specified provincal building at the specified amount in the specified provinces.
|Must use either > or < operators for level.
| 1.0
<!-- This remains in documentation, yet doesn't make sense.
|-id="area"
| area
|<code><int></code><br>The supply area id to check for.
|<pre>area = 6</pre>
|Checks if the current scope is a state in the specified supply area.
|
|1.0
!-->
|-id="has_state_flag"
| has_state_flag
|<code><string></code><br>The flag to check for.
|<pre>has_state_flag = my_flag</pre>
|Checks if the current scope has the specified flag.
|
|
|1.5
|1.0
|-
|-id="has_state_flag"
|num_units
|has_state_flag
|<code><int></code><br>The amount to check for.
|<code>flag = <string></code><br>The flag to check.<br>
|<pre>num_units > 5</pre>
<code>value = <int></code><br>The flag value to check for. Optional.<br>
|Checks if the current scope is commanding the specified amount of divisions.
<code>date = <date></code><br>The flag creation date to check for. Optional.<br>
|Must use either > or < operators.
<code>days = <int></code><br>The duration the flag existed for. Optional.
|1.5
|<pre>
|}
has_state_flag = {
 
   flag = my_flag
===战斗===
   days > 30
{{SVersion|1.5}}
   date > 1936.6.1
 
   value > 0
These triggers only work in special unit leader combat scopes, i.e. Combat Tactics.
}
 
</pre>
They should not be used in the regular unit leader scopes.
|Compares the specified flag's last set date, days since last set, and/or value.
 
|If not set, the value comparison is <code>>0</code>. <code>value</code> is limited between -32768 and 32767.
{| class="wikitable sortable" width="100%"
|1.0
! width="10%" |Name
|-id="state_population"
! width="25%" |Parameters
| state_population
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-
|hardness
|<code><float></code><br>The amount to check for.
|<code><float></code><br>The amount to check for.
|<pre>hardness > 0.5</pre>
|<pre>state_population > 10000</pre>
|Checks if the current scope has the specified amount of hardness.
|Checks if the current scope has the specified state population.
|Must use either > or < operators.
|Must use either > or < operators.
|1.0
|1.0
|-
|-id="state_population_k"
|armor
|state_population_k
|<code><float></code><br>The amount to check for.
|<code><float></code><br>The amount to check for.
|<pre>armor > 0.5</pre>
|<pre>state_population_k > 10</pre>
|Checks if the current scope has the specified amount of armor units.
|Checks if the current scope has the specified state population in thousands.
|Must use either > or < operators.
| Must use either > or < operators.
|1.0
|-id="is_capital"
|is_capital
|<code><bool></code><br>Boolean.
|<pre>is_capital = yes</pre>
|Checks if the current scope is a capital.
|
|1.5
|-id="is_controlled_by"
|is_controlled_by
|<code><scope> / <variable></code><br>The country to check for.
|<pre>is_controlled_by = GER</pre>
|Checks if the current scope is controlled by the specified country.
|
|1.0
|1.0
|-
|-id="is_fully_controlled_by"
|dig_in
|is_fully_controlled_by
|<code><float></code><br>The amount to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>dig_in > 0.5</pre>
|<pre>is_fully_controlled_by = GER</pre>
|Checks if the current scope has the specified amount of Dig In bonus.
|Checks if the current scope is fully controlled by the specified country.
|Must use either > or < operators.
|
|1.5
|-id="is_owned_by"
| is_owned_by
|<code><scope> / <variable></code><br>The country to check for.
|<pre>is_owned_by = GER</pre>
|Checks if the current scope is owned by the specified country.
|
|1.0
|1.0
|-
|-id="is_claimed_by"
|min_planning
|is_claimed_by
|<code><float></code><br>The amount to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>min_planning > 0.5</pre>
|<pre>is_claimed_by = GER</pre>
|Checks if the current scope has the specified amount of planning.
|Checks if the current scope is claimed by the specified country.
|Must use either > or < operators.
|
|1.0
|1.0
|-
|-id="is_core_of"
|fastest_unit
|is_core_of
|<code><float></code><br>The speed in km/h to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>fastest_unit > 12</pre>
|<pre>is_core_of = GER</pre>
|Checks if the current scope has a unit with the specified speed.
|Checks if the current scope is a core of the specified country.
|Must use either > or < operators.
|
|1.0
|1.0
|-
|-id="is_owned_and_controlled_by"
|temperature
|is_owned_and_controlled_by
|<code><float></code><br>The temperature in celsius to check for.
|<code><scope> / <variable></code><br>The country to check for.
|<pre>temperature > 20</pre>
|<pre>is_owned_and_controlled_by = GER</pre>
|Checks if the current scope is in a province with a temperature above the specified amount.
|Checks if the current scope is owned and controlled by the specified country.
|Must use either > or < operators.
|
|1.0
| 1.0
|-
|-id="is_demilitarized_zone"
|reserves
|is_demilitarized_zone
|<code><float></code><br>The amount to check for.
|<code><bool></code><br>Boolean.
|<pre>reserves > 10</pre>
|<pre>is_demilitarized_zone = yes</pre>
|Checks if the current scope has the specified amount of reserves waiting.
|Checks if the current scope is a demilitarized zone.
|Must use either > or < operators.
|1.0
|-
|has_cavalry_ratio
|<code><float></code><br>The ratio to check for.
|<pre>has_cavalry_ratio > 0.5</pre>
|Checks if the current scope has the specified ratio of cavalry in their division composition.
|Must use either > or < operators.
|1.0
|-
|has_combat_modifier
|<code><string></code><br>The modifier to check for.
|<pre>has_combat_modifier = river_crossing</pre>
|Checks if the current scope has the specified combat modifier.
|
|
|1.0
|1.0
|-
|-id="is_border_conflict"
|is_fighting_in_terrain
|is_border_conflict
|<code><string></code><br>The terrain to check for.
|<code><bool></code><br>Boolean.
|<pre>is_fighting_in_terrain = desert</pre>
|<pre>is_border_conflict = yes</pre>
|Checks if the current scope is fighting in the specified terrain.
|Checks if the current scope is part of a border war.
|
|
|1.0
|1.0
|-
|-id="is_in_home_area"
|phase
|is_in_home_area
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>phase = yes</pre>
|<pre>is_in_home_area = yes</pre>
|Checks if the current scope is in phase.
|Checks if the current scope is connected to the capital state over land. The scope needs to be owned as well for the statement for it to be true.
|
|
|1.0
|1.0
|-
|-id="is_coastal"
|recon_advantage
|is_coastal
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>recon_advantage = yes</pre>
|<pre>is_coastal = yes</pre>
|Checks if the current scope has a recon advantage.
|Checks if the current scope is a coastal state.
|
|
|1.0
|1.0
|-
|-id="is_one_state_island"
|night
|is_one_state_island
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>night = yes</pre>
|<pre>is_one_state_island = yes</pre>
|Checks if the current scope is fighting at night.
|Checks if the current scope is a coastal state with no adjacent land states.
|
|An adjacent land state may be connected via a naval crossing.
|1.0
|1.13
|-
|-id="is_island_state"
|frontage_full
|is_island_state
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>frontage_full = yes</pre>
|<pre>is_island_state = yes</pre>
|Checks if the current scope has a full combat width.
|Checks if the current scope is a state where every province has no land neighbour.
|
|An adjacent land division may be connected via a naval crossing.
|1.0
|1.0
|-
|-id="is_on_continent"
|has_flanked_opponent
|is_on_continent
|<code><bool></code><br>Boolean.
|<code><string></code><br>The continent to check for.
|<pre>has_flanked_opponent = yes</pre>
|<pre>is_on_continent = europe</pre>
|Checks if the current scope has flanked their opponent.
|Checks if the current scope is on the specified continent.
|
|Continents are found in {{path|map/continent.txt}}.
|1.0
|1.0
|-
|-id="impassable"
|has_max_planning
|impassable
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>has_max_planning = yes</pre>
|<pre>impassable = yes</pre>
|Checks if the current scope has the maximum planning bonus.
|Checks if the current scope is impassable.
|
|
|1.9.1
|-id="has_state_category"
|has_state_category
|<code><string></code><br>The category to check for.
|<pre>has_state_category = rural</pre>
|Checks if the current scope has the specified category.
| State categories are found in {{path|common/state_category/*.txt}}.
|1.0
|1.0
|-
|-id="state_strategic_value"
|has_reserves
| state_strategic_value
|<code><bool></code><br>Boolean.
|<code><int></code><br>The amount to check for.
|<pre>has_reserves = yes</pre>
|<pre>state_strategic_value > 10</pre>
|Checks if the current scope has any reserves waiting.
|Checks if the current scope has the specified strategic value.
|
|Must use either > or < operators.
|1.5
|-id="state_and_terrain_strategic_value"
|state_and_terrain_strategic_value
|<code><int></code><br>The amount to check for.
|<pre>state_and_terrain_strategic_value > 10</pre>
|Checks if the current scope has the specified state and terrain strategic value.
|Must use either > or < operators.
| 1.5
|-id="num_owned_neighbour_states"
|num_owned_neighbour_states
|<code>owner = <scope></code><br>The country to check for.
<code>count = <int></code><br>The amount to check for.
|<pre>num_owned_neighbour_states = {
   owner = GER
   count > 2
}
</pre>
|Checks if the current scope has the specified amount of neighbor states belonging to the specified country.
|Must use either > or < operators for count.
|1.0
|1.0
|-
|-id="distance_to"
|is_amphibious_invasion
|distance_to
|<code><bool></code><br>Boolean.
|<code>value = <float></code><br>The distance to check for.
|<pre>is_amphibious_invasion = yes</pre>
<code>target = <scope></code><br>The state to compare against.
|Checks if the current scope is performing an amphibious invasion.
|<pre>
|
distance_to = {
   value > 1000
   target = 49
}
</pre>
|Checks if the current scope is at the specified distance from the specified state.
|Must use either > or < operators for distance.
| 1.0
|-id="ships_in_area"
|ships_in_area
|<code>area = <int></code><br>The strategic region to check for.
<code>size = <int></code><br>The amount to check for.
|<pre>ships_in_area = { area = 104 size > 14 } </pre>
|Checks if the current scope has the specified amount of ships in the specified strategic region.
|Must use either > or < operators for count.
|1.0
|1.0
|-
|-id="s_resource_count_trigger"
|is_attacker
|<resource> (resource_count_trigger)
|<code><bool></code><br>Boolean.
|<code><int></code><br>The amount to check for.
|<pre>is_attacker = yes</pre>
|<pre>tungsten > 10
|Checks if the current scope is attacking.
</pre>
|Checks if the current scope has the specified amount of the specified resource.
|Must use either > or < operators for amount.
|-id="has_resources_amount"
|has_resources_amount
|<code>resource = <string></code><br>The resource to check for.<br>
<code>amount = <int></code><br>The amount to check for.<br>
<code>delivered = yes</code><br>If specified, checks the amount after the modifiers are applied rather than the base resource value.
|<pre>
has_resources_amount = {
   resource = oil
   amount > 10
   delivered = yes
}
</pre>
|Checks if the current scope has the specified amount of the specified resource.
|Must use either > or < operators for amount.
|1.3
|-id="has_resources_rights"
|has_resources_rights
|<code>state = <scope></code><br>The state to check in. Mandatory if used in country scope.<br>
<code>receiver = <int></code><br>The receiver of the resource rights. Mandatory if used in state scope.<br>
<code>resources = { <resource> <...> <resource> }</code><br>Resources to check for. Optional, defaults to any if unset.
|
|
|1.0
<pre>has_resources_rights = {   # Used in country scope
|-
   state = 123
|is_defender
   resources = { oil steel }
|<code><bool></code><br>Boolean.
}</pre>
|<pre>is_defender = yes</pre>
<pre>has_resources_rights = {   # Used in state scope
|Checks if the current scope is defending.
   receiver = POL
}</pre>
|Checks if there are any resource rights with the specified parameters.
|Can be used in either state or country scope. Always returns false if the state has no resources.
|1.12
|-id="days_since_last_strategic_bombing"
|days_since_last_strategic_bombing
|<code><int></code><br>The amount to compare with.
|<pre>days_since_last_strategic_bombing < 10 </pre>
|Checks how many days have passed since the last strategic bombing of the state.
|Must use either > or < operators.
|1.6
|-id="has_railway_connection"
|has_railway_connection
|<code><scope> / <variable></code><br>The states to check.
<code><id></code>
 
The provinces to check. Optional.
|<pre>
has_railway_connection = {
start_state = 10
target_state = 90
}
</pre><pre>
has_railway_connection = {
start_province = 402
target_province = 9400
}
</pre>
|Returns true if the states are connected by a railway. Can also check provinces.
|
| 1.11
|-id="can_build_railway"
|can_build_railway
|<code><scope> / <variable></code><br>The states to check.
<code><id></code>
 
The provinces to check. Optional.
|<pre>
can_build_railway = {
start_state = 10
target_state = 90
}
</pre><pre>
can_build_railway = {
start_province = 402
target_province = 9400
}
</pre>
|Returns true if a railway can be built between states. Can also check for provinces.
|
|
|1.0
|1.11
|-
|-id="has_railway_level"
|is_winning
| has_railway_level
|<code><scope> / <variable></code><br>The states to check.
<code><int></code>
 
Railway level.
|<pre>
has_railway_level = {
   state = 114
   level = 5
}
</pre>
|Checks if a state contains a railway at or above the specified level.
|Works with level 1, 2, 3, 4 or 5. Level 0 does not work.
|1.11
|-id="pc_does_state_stack_demilitarized"
|pc_does_state_stack_demilitarized
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>is_winning = yes</pre>
|<pre>pc_does_state_stack_demilitarized = yes</pre>
|Checks if the current scope is winning their battle.
|Checks if the current scope was demilitarised during a current or previously-ended peace conference.
|
|
|1.0
|1.12
|-
|-id="pc_does_state_stack_dismantled"
|is_fighting_air_units
|pc_does_state_stack_dismantled
|<code><bool></code><br>Boolean.
|<code><bool></code><br>Boolean.
|<pre>is_fighting_air_units = yes</pre>
|<pre>pc_does_state_stack_dismantled = yes</pre>
|Checks if the current scope is fighting air units.
|Checks if the current scope was dismantled during a current or previously-ended peace conference.
|
|
|1.0
|1.12
|-
|-id="pc_is_state_claimed"
|less_combat_width_than_opponent
|pc_is_state_claimed
|<code><bool></code><br>Boolean.
|<code><scope></code><br>Country to check for.
|<pre>less_combat_width_than_opponent = yes</pre>
|<pre>pc_is_state_claimed = yes</pre>
|Checks if the current scope is fighting with less combat width than their opponent.
|Checks if the current scope was claimed by any country during the peace conference.
|
|'''Can only be used within peace conferences.'''
|1.0
|1.12.8
|-
|-id="pc_is_state_claimed_by"
|has_carrier_airwings_on_mission
|pc_is_state_claimed_by
|<code><bool></code><br>Boolean.
|<code><scope></code><br>Country to check for.
|<pre>has_carrier_airwings_on_mission = yes</pre>
|<pre>pc_is_state_claimed_by = BHR</pre>
|Checks if the current scope has carrier airwings on a mission.
|Checks if the current scope was claimed by the specified country during the peace conference.  Note, that "claim" in this context, while includes, is NOT limited to outright taking: forcing government, puppeting and liberating will render that trigger true as well. If one looks specifically for states taken by victors for themselves, [[#pc_is_state_claimed_and_taken_by|pc_is_state_claimed_and_taken_by]] should be used.
|
|'''Can only be used within peace conferences.'''
|1.0
|1.12
|-
|-id="pc_is_state_claimed_and_taken_by"
|has_carrier_airwings_in_own_combat
|pc_is_state_claimed_and_taken_by
|<code><bool></code><br>Boolean.
|<code><scope></code><br>Country to check for.
|<pre>has_carrier_airwings_in_own_combat = yes</pre>
|<pre>pc_is_state_claimed_and_taken_by = SOV</pre>
|Checks if the current scope has carrier airwings in their own combat.
|Checks if the current scope was claimed with "Take State" action (i.e. annexed) by the specified country during the peace conference.
|
|'''Can only be used within peace conferences.'''
|1.0
|<!--Needs clarification, probably 1.12?-->
|}
|-id="pc_is_state_outside_influence_for_winner"
 
|pc_is_state_outside_influence_for_winner
== 变量==
|<code><scope></code><br>Country to check for.
{{SVersion|1.5}}
|<pre>pc_is_state_outside_influence_for_winner = ROOT</pre>
|Checks if the current state is outside of the influence of the specified winner country.
|'''Can only be used within peace conferences.''' Was called pc_is_state_outside_influence_for prior to 1.12.8.
|1.12.8
|-id="pc_turn"
|pc_turn
|<code><int></code><br>The amount of turns to check for.
|<pre>pc_turn > 20</pre>
|Compares the amount of turns that have passed during the peace conference with a number.
|'''Can only be used within peace conferences.'''
|1.12.8
|}


Can be used in '''country''', '''state''' or '''unit leader''' scopes.
===Resistance and Compliance ===
{{SVersion|1.13}}


{| class="wikitable sortable" width="100%"
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Resistance-related state-scoped triggers:}}<br/>
! width="10%" |Name
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Parameters
第2,419行: 第3,250行:
! width="20%" |Description
! width="20%" |Description
! width="15%" |Notes
! width="15%" |Notes
! width="5%" |Version Added
! width="5%" | Version Added
|-
|-id="compliance"
|has_variable
|compliance
|<code><variable></code><br>The variable to check.
|<code><int></code><br>The amount to compare with.
|<pre>has_variable = my_var</pre>
|<pre>compliance > 50</pre>
|Checks if the specified variables exists for the current scope.
|Compares the compliance value of the current scope with the given value.
|Must use either > or < operators.
|1.9
|-id="compliance_speed"
|compliance_speed
|<code><int></code><br>The amount to compare with.
|<pre>compliance_speed > 50</pre>
|Compares the compliance speed of the current scope with the given value.
|Must use either > or < operators.
|1.9
|-id="has_active_resistance"
|has_active_resistance
|<code><bool></code><br>Boolean.
|<pre>has_active_resistance = yes</pre>
|Checks if the current scope has non-zero resistance.
|
|
|1.5
|1.9
|-
|-id="has_resistance"
|check_variable
|has_resistance
|<code>var = <variable></code><br>The variable to check.<br>
|<code><bool></code><br>Boolean.
<code>value = <float> / <variable></code><br>The value to check for.<br>
|<pre>has_resistance = yes</pre>
<code>compare = <type></code><br>The type of comparison. Optional, can use < or > instead.
|Checks if the current scope has resistance.
|<pre>
|
check_variable = {
|1.9
   var = my_var
|-id="resistance"
   value = 10
|resistance
   compare = greater_than_or_equals
|<code><int></code><br>The amount to compare with.
}
|<pre>resistance > 50</pre>
</pre>
|Compares the resistance value of the current scope with the given value.
<pre>
|Must use either > or < operators.
check_variable = {
|1.9
   my_var > 10
|-id="resistance_speed"
}
|resistance_speed
</pre>
|<code><int></code><br>The amount to compare with.
|Check the specified variable for the current scope.
|<pre>resistance_speed > 50</pre>
|Possible compare types:
|Compares the resistance speed of the current scope with the given value.
|Must use either > or < operators.
|1.9
|-id="resistance_target"
|resistance_target
|<code><int></code><br>The amount to compare with.
|<pre>resistance_target > 50</pre>
|Compares the target resistance value of the current scope with the given value.
|Must use either > or < operators.
|1.9
|-id="has_occupation_modifier"
|has_occupation_modifier
|<code><token></code><br>The occupation modifier to check.
|<pre>has_occupation_modifier = modifier_name</pre>
|Checks if the current scope has an occupation modifier, changing resistance/compliance.
|
|1.9
|-id="occupation_law"
| occupation_law
|<code><token></code><br>The occupation law to check.
|<pre>occupation_law = law_name</pre>
|Checks if the current scope has an occupation law.
|
|1.9
|-id="occupied_country_tag"
|occupied_country_tag
|<code><tag></code><br>The occupation tag to check.
|<pre>occupied_country_tag = POL</pre>
|Checks which country creates resistance.
|
|1.9
|}
 
==Character scope==
{{SVersion|1.13}}
Can be used in '''Character''' scope.
 
===General===


*less_than
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
*less_than_or_equals
|+ {{nowrap|General character-scoped triggers:}}<br/>
*greater_than
! width="10%" |Name
*greater_than_or_equals
! width="25%" |Parameters
*equals
! width="25%" |Examples
*not_equals
! width="20%" |Description
|1.5
! width="15%" |Notes
|-
! width="5%" |Version Added
|print_variables
|-id="is_character"
|<code>print_global = <bool></code><br />Print global variables. Defaults to <code>no</code>.<br />
|is_character
<code>var_list = <list></code><br />The variables to print. Defaults to all variables.<br />
|<code><scope></code><br>Character ID.
<code>file = <string></code>The file path to log to. Defaults to "variable_dump".<br />
|<pre>is_character = POL_test_character</pre>
<code>text = <string></code>Text to prepend. Defaults to "No Header".<br />
|Checks if the current character's token matches up with the specified one.
<code>append = <bool></code>Whether to append to the file instead of overwrite. Defaults to <code>yes</code>
|
|<pre>print_variables = {
| 1.11
   var_list = { myvar1 myvar2 }
|-id="can_be_country_leader"
   file = "my_dump_file"
|can_be_country_leader
   text = "my header"
|<code><bool></code><br>Boolean.
|<pre>can_be_country_leader = yes</pre>
|Checks if the character in the current scope has a country leader role, active or non-active.
|
|1.11
|-id="is_country_leader"
|is_country_leader
|<code><bool></code><br>Boolean.
|<pre>is_country_leader = yes</pre>
|Checks if the character in the current scope is the active country leader.
|
| 1.11
|-id="is_unit_leader"
|is_unit_leader
|<code><bool></code><br>Boolean.
|<pre>is_unit_leader = yes</pre>
|Checks if the character in the current scope has an active unit leader (Army/Navy leader) role.
|
|1.11
|-id="is_advisor"
|is_advisor
|<code><bool></code><br>Boolean.
|<pre>is_advisor = yes</pre>
|Checks if the character in the current scope has an advisor role (includes advisors/theorists/high command).
|
|1.11
|-id="is_air_chief"
|is_air_chief
|<code><bool></code><br>Boolean.
|<pre>is_air_chief = yes</pre>
|Checks if the character in the current scope is selected as an air chief.
|Prior to 1.12, checked if the character had a role within the slot, regardless of being selected.
|1.11
|-id="is_army_chief"
|is_army_chief
|<code><bool></code><br>Boolean.
|<pre>is_army_chief = yes</pre>
|Checks if the character in the current scope is selected as an army chief.
|Prior to 1.12, checked if the character had a role within the slot, regardless of being selected.
|1.11
|-id="is_army_leader"
| is_army_leader
|<code><bool></code><br>Boolean.
|<pre>is_army_leader = yes</pre>
|Checks if the character in the current scope has an army leader (General/Field Marshal) role.
|
|1.11
|-id="is_navy_chief"
|is_navy_chief
|<code><bool></code><br>Boolean.
|<pre>is_navy_chief = yes</pre>
|Checks if the character in the current scope is selected as a navy chief.
|Prior to 1.12, checked if the character had a role within the slot, regardless of being selected.
|1.11
|-id="is_navy_leader"
| is_navy_leader
|<code><bool></code><br>Boolean.
|<pre>is_navy_leader = yes</pre>
|Checks if the character in the current scope has an navy leader (Admiral) role.
|
|1.11
|-id="is_high_command"
|is_high_command
|<code><bool></code><br>Boolean.
|<pre>is_high_command = yes</pre>
|Checks if the character in the current scope is selected as high command.
|Prior to 1.12, checked if the character had a role within the slot, regardless of being selected.
|1.11
|-id="is_corps_commander"
|is_corps_commander
|<code><bool></code><br>Boolean.
|<pre>is_corps_commander = yes</pre>
|Checks if the character in the current scope is a corps commander.
|
|1.11
|-id="is_operative"
|is_operative
|<code><bool></code><br>Boolean.
|<pre>is_operative = yes</pre>
|Checks if the character in the current scope is an operative.
|
|1.11
|-id="is_political_advisor"
|is_political_advisor
|<code><bool></code><br>Boolean.
|<pre>is_political_advisor = yes</pre>
|Checks if the character in the current scope is selected as a political advisor.
|Prior to 1.12, checked if the character had a role within the slot, regardless of being selected.
|1.11
|-id="is_theorist"
|is_theorist
|<code><bool></code><br>Boolean.
|<pre>is_theorist = yes</pre>
|Checks if the character in the current scope is selected as a theorist.
|Prior to 1.12, checked if the character had a role within the slot, regardless of being selected.
|1.11
|-id="is_character_slot"
|is_character_slot
|<code><string></code><br>The advisor slot to check.
|<pre>is_character_slot = political_advisor</pre>
|Checks if the character in the current scope has a role within the specified character slot
|Character slots are defined within {{path|common/idea_tags/*.txt}}.
|1.11
|-id="has_air_ledger"
|has_air_ledger
|<code><bool></code><br>Boolean.
|<pre>has_air_ledger = yes</pre>
|Checks if the character in the current scope has an air ledger.
|
|1.11
|-id="has_army_ledger"
|has_army_ledger
|<code><bool></code><br>Boolean.
|<pre>has_army_ledger = yes</pre>
|Checks if the character in the current scope has an army ledger.
|
|1.11
|-id="has_navy_ledger"
|has_navy_ledger
|<code><bool></code><br>Boolean.
|<pre>has_navy_ledger = yes</pre>
|Checks if the character in the current scope has an navy ledger.
|
|1.11
|-id="has_character_flag"
|has_character_flag
|<code><string></code><br>The flag to check for.
|<pre>has_character_flag = my_flag</pre>
|Checks if the current scope has the specified flag.
|
|1.11
|-id="has_character_flag"
|has_character_flag
|<code>flag = <string></code><br>The flag to check.<br>
<code>value = <int></code><br>The flag value to check for. Optional.<br>
<code>date = <date></code><br>The flag creation date to check for. Optional.<br>
<code>days = <int></code><br>The duration the flag existed for. Optional.
|<pre>
has_character_flag = {
   flag = my_flag
   days > 30
   date > 1936.6.1
   value > 0
}
</pre>
|Compares the specified flag's last set date, days since last set, and/or value.
|If not set, the value comparison is <code>>0</code>. <code>value</code> is limited between -32768 and 32767.
|1.11
|-id="has_trait"
|has_trait
|<code><trait></code><br>The trait to check for.
|<pre>has_trait = really_good_boss</pre>
|Checks if the current scope has the specified trait.
|
|1.5
|-id="has_id"
|has_id
|<code><int></code><br>The id to check for.
|<pre>has_id = 1</pre>
|Checks if the current character has the specificed ID.
|
|1.5
|}
 
===Advisors===
{{SVersion|1.13}}
These triggers are to be used specifically for advisors.
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Advisor-scoped triggers:}}<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" | Version Added
|-id="is_hired_as_advisor"
|is_hired_as_advisor
|<code><bool></code>
|<pre>is_hired_as_advisor = yes</pre>
|Checks if the current character is activated as an advisor in any slot.
|
|1.12.10
|-id="not_already_hired_except_as"
|not_already_hired_except_as
|<code><slot></code><br>The slot to check in.
|<pre>not_already_hired_except_as = political_advisor</pre>
|Checks if the current character is not hired, with the exception of the specified slot.
|
|1.11
|-id="advisor_can_be_fired"
|advisor_can_be_fired
|<code><bool></code><br>Boolean.<br/>
'''OR'''<br/>
<code>slot = <slot></code>The slot to check in.<br/>
|<pre>advisor_can_be_fired = no</pre>
<pre>advisor_can_be_fired = {
   slot = political_advisor
}</pre>
}</pre>
|Dumps the specified variables from the current scope and optionally the global scope into <code>logs/variable_dumps/<file>.log</code>. Evaluates to true.
|Checks if the current character's <code>can_be_fired</code> attribute is set or not within a certain slot.
|See [[Variables#Debugging]]
|If an advisor is available in multiple slots, the long version is mandatory to use.
|1.12.8
|}
 
===Country leaders===
{{SVersion|1.13}}
These triggers are to be used specifically for country leaders.
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Country leader-scoped triggers:}}<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" | Version Added
|-id="has_ideology"
|has_ideology
|<code><ideology></code><br>The sub-ideology to check for.
|<pre>has_ideology = liberalism</pre>
|Checks if the current character has the specificed sub-ideology assigned.
|
|1.11
|-id="has_ideology_group"
|has_ideology_group
|<code><ideology></code><br>The ideology to check for.
|<pre>has_ideology_group = democratic</pre>
|Checks if the current character has the specificed ideology assigned.
|
|1.11
|}
===Unit leaders===
{{SVersion|1.13}}
These triggers are to be used specifically for unit leaders, i.e. generals and admirals.
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Unit leader-scoped triggers:}}<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" | Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="has_unit_leader_flag"
|has_unit_leader_flag
|<code><string></code><br>The flag to check for.
|<pre>has_unit_leader_flag = my_flag</pre>
|Checks if the current scope has the specified flag.
| Deprecated. Use has_character_flag instead.
|1.5
|-id="has_unit_leader_flag"
|has_unit_leader_flag
|<code>flag = <string></code><br>The flag to check.<br>
<code>value = <int></code><br>The flag value to check for. Optional.<br>
<code>date = <date></code><br>The flag creation date to check for. Optional.<br>
<code>days = <int></code><br>The duration the flag existed for. Optional.
|<pre>
has_unit_leader_flag = {
   flag = my_flag
   days > 30
   date > 1936.6.1
   value > 0
}
</pre>
|Compares the specified flag's last set date, days since last set, and/or value.
|Deprecated. Use has_character_flag instead. If not set, the value comparison is <code>>0</code>. <code>value</code> is limited between -32768 and 32767.
|1.5
|-id="is_leading_army"
|is_leading_army
|<code><bool></code><br>Boolean.
|<pre>is_leading_army = yes</pre>
|Checks if the current scope is leading a single army.
|
|1.5
|-id="is_leading_army_group"
|is_leading_army_group
|<code><bool></code><br>Boolean.
|<pre>is_leading_army_group = yes</pre>
|Checks if the current scope is leading an army group.
|
|1.5
|-id="is_leading_volunteer_group"
|is_leading_volunteer_group
|<code><tag></code><br>Country tag.
|<pre>is_leading_volunteer_group = POL</pre>
|Checks if the current scope is leading a volunteer army within the specified country.
|If the target country is in a civil war, this will only be valid for one side.
|1.11
|-id="is_leading_volunteer_group_with_original_country"
|is_leading_volunteer_group_with_original_country
|<code><tag></code><br>Country tag.
|<pre>is_leading_volunteer_group_with_original_country = POL</pre>
|Checks if the current scope is leading a volunteer army within a country of the specified original tag.
|If the target country is in a civil war, this will only be valid for each side.
|1.11
|-id="is_field_marshal"
|is_field_marshal
|<code><bool></code><br>Boolean.
|<pre>is_field_marshal = yes</pre>
|Checks if the current scope is a Field Marshal.
|
|1.5
|-id="is_assigned"
|is_assigned
|<code><bool></code><br>Boolean.
|<pre>is_assigned = yes</pre>
|Checks if the current scope is an assigned unit leader.
|
|1.5
|-id="can_select_trait"
|can_select_trait
|<code><string></code><br>The trait to check for.
|<pre>can_select_trait = offensive_doctrine</pre>
| Checks if the current scope can select the specified trait.
|
|1.5
|-id="has_ability"
|has_ability
|<code><string></code><br>The ability to check for.
|<pre>has_ability = glider_planes</pre>
|Checks if the current scope has the specified unit leader ability.
|
|1.5
|-id="skill"
| skill
|<code><int></code><br>The amount to check for.
|<pre>skill > 1</pre>
|Checks if the current scope has a Skill above the specified amount.
|Must use either > or < operators.
|1.5
|-id="skill_advantage"
|skill_advantage
|<code><int></code><br>The amount to check for.
|<pre>skill_advantage > 1</pre>
|Checks if the current scope has a Skill advantage above the specified amount in against an enemy unit leader whilst in combat.
|Must use either > or < operators.
|1.5
|-id="planning_skill_level"
|planning_skill_level
|<code><int></code><br>The amount to check for.
|<pre>planning_skill_level > 1</pre>
|Checks if the current scope has a Planning skill above the specified amount.
| Must use either > or < operators.
|1.5
|-id="logistics_skill_level"
|logistics_skill_level
|<code><int></code><br>The amount to check for.
|<pre>logistics_skill_level > 1</pre>
|Checks if the current scope has a Logistics skill above the specified amount.
|Must use either > or < operators.
|1.5
|-id="defense_skill_level"
|defense_skill_level
|<code><int></code><br>The amount to check for.
|<pre>defense_skill_level > 1</pre>
|Checks if the current scope has a Defense skill above the specified amount.
|Must use either > or < operators.
|1.5
|-id="attack_skill_level"
|attack_skill_level
|<code><int></code><br>The amount to check for.
|<pre>attack_skill_level > 1</pre>
|Checks if the current scope has a Attack skill above the specified amount.
|Must use either > or < operators.
|1.5
|-id="average_stats"
|average_stats
|<code><int></code><br>The amount to check for.
|<pre>average_stats > 5</pre>
|Checks if the current scope has an average skill above the specified amount.
| Must use either > or < operators.
|1.5
|-id="is_border_war"
|is_border_war
|<code><bool></code><br>Boolean.
|<pre>is_border_war = yes</pre>
|Checks if the current socpe is in a border war.
|
|1.5
|-id="num_units"
| num_units
|<code><int></code><br>The amount to check for.
|<pre>num_units > 5</pre>
|Checks if the current scope is commanding the specified amount of divisions.
| Must use either > or < operators.
| 1.5
|-id="is_exiled_leader"
|is_exiled_leader
|<code><bool></code><br>Boolean.
|<pre>is_exiled_leader = yes</pre>
|Checks if the current scope is a general from an exiled country.
|
|1.6
|-id="is_exiled_leader_from"
|is_exiled_leader_from
|<code><tag></code><br>Country.
|<pre>is_exiled_leader_from = POL</pre>
|Checks if the current scope is a general from the specified exiled country.
|
|1.6
|-id="is_female"
|is_female
|<code><bool></code><br>Boolean.
|<pre>is_female = yes</pre>
|Checks if the current scope is female.
|Works for aces.
|1.9
|}
 
===Operatives===
{{SVersion|1.13}}
 
These triggers only work for operatives.
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Operative-scoped triggers:}}<br/>
! width="10%" | Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" | Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="has_nationality"
|has_nationality
|<code><tag></code><br>The nationality to check.
|<pre>has_nationality = POL</pre>
|Checks if the current operative has the nationality.
|
|1.9
|-id="is_operative_captured"
|is_operative_captured
|<code><bool></code><br>Boolean.
|<pre>is_operative_captured = yes</pre>
|Checks if the current scope is captured.
|
|1.9
|-id="operative_leader_mission"
|operative_leader_mission
|<code><token></code><br>Mission.
|<pre>operative_leader_mission = mission_name</pre>
|Checks if the current scope is on the given mission.
|
|1.9
|-id="operative_leader_operation"
|operative_leader_operation
|<code><token></code><br>Operation.
|<pre>operative_leader_operation = operation_name</pre>
|Checks if the current scope is on the given operation.
|
|1.9
|}
 
==Combat==
{{SVersion|1.13}}
 
These triggers are used within the combatant scope. Some trigger blocks in [[Command power#Abilities for field marshals and generals|abilities]], [[combat tactics]], and [[Trait modding#Unit leader traits|unit leader traits]] check this, and it's impossible to access elsewhere.
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Combatant-scoped triggers:}}<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" | Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="hardness"
|hardness
|<code><float></code><br>The amount to check for.
|<pre>hardness > 0.5</pre>
|Checks if the current scope has the specified amount of hardness.
|Must use either > or < operators.
|1.0
|-id="armor"
|armor
|<code><float></code><br>The amount to check for.
|<pre>armor > 0.5</pre>
|Checks if the current scope has the specified amount of armor units.
|Must use either > or < operators.
|1.0
|-id="dig_in"
|dig_in
|<code><float></code><br>The amount to check for.
|<pre>dig_in > 0.5</pre>
|Checks if the current scope has the specified amount of Dig In bonus.
|Must use either > or < operators.
| 1.0
|-id="min_planning"
|min_planning
|<code><float></code><br>The amount to check for.
|<pre>min_planning > 0.5</pre>
|Checks if the current scope has the specified amount of planning.
|Must use either > or < operators.
|1.0
|-id="fastest_unit"
|fastest_unit
|<code><float></code><br>The speed in km/h to check for.
|<pre>fastest_unit > 12</pre>
|Checks if the current scope has a unit with the specified speed.
|Must use either > or < operators.
|1.0
|-id="temperature"
|temperature
|<code><float></code><br>The temperature in celsius to check for.
|<pre>temperature > 20</pre>
|Checks if the current scope is in a province with a temperature above the specified amount.
| Must use either > or < operators.
|1.0
|-id="reserves"
|reserves
|<code><float></code><br>The amount to check for.
|<pre>reserves > 10</pre>
|Checks if the current scope has the specified amount of reserves waiting.
|Must use either > or < operators.
|1.0
|-id="has_combat_modifier"
|has_combat_modifier
|<code><string></code><br>The modifier to check for.
|<pre>has_combat_modifier = river_crossing</pre>
|Checks if the current scope has the specified combat modifier.
|
|1.0
|-id="is_fighting_in_terrain"
|is_fighting_in_terrain
|<code><string></code><br>The terrain to check for.
|<pre>is_fighting_in_terrain = desert</pre>
|Checks if the current scope is fighting in the specified terrain.
|
|1.0
|-id="is_fighting_in_weather"
|is_fighting_in_weather
|<code><string></code><br>The weather to check for.<br/>
'''OR'''<br/>
<code>{ <string> <...> <string> }</code><br/>The weather to check for in an OR statement.
|<pre>is_fighting_in_weather = sandstorm</pre>
<pre>is_fighting_in_weather = { rain_light rain_heavy }</pre>
|Checks if the current scope is fighting in the specified weather.
|
|1.0
|-id="phase"
|phase
|<code><bool></code><br>Boolean.
|<pre>phase = yes</pre>
|Checks if the current scope is in phase.
|
|1.0
|-id="recon_advantage"
|recon_advantage
|<code><bool></code><br>Boolean.
|<pre>recon_advantage > 0</pre>
|Checks if the current scope has x recon advantage.
|
|1.0
|-id="night"
| night
|<code><bool></code><br>Boolean.
|<pre>night = yes</pre>
|Checks if the current scope is fighting at night.
|
|1.0
|-id="frontage_full"
|frontage_full
|<code><bool></code><br>Boolean.
|<pre>frontage_full = yes</pre>
|Checks if the current scope has a full combat width.
|
|1.0
|-id="has_flanked_opponent"
|has_flanked_opponent
|<code><bool></code><br>Boolean.
|<pre>has_flanked_opponent = yes</pre>
|Checks if the current scope has flanked their opponent.
|
|1.0
|-id="has_max_planning"
|has_max_planning
|<code><bool></code><br>Boolean.
|<pre>has_max_planning = yes</pre>
|Checks if the current scope has the maximum planning bonus.
|
|1.0
|-id="has_reserves"
|has_reserves
|<code><bool></code><br>Boolean.
|<pre>has_reserves = yes</pre>
|Checks if the current scope has any reserves waiting.
|
|1.0
|-id="is_amphibious_invasion"
|is_amphibious_invasion
|<code><bool></code><br>Boolean.
|<pre>is_amphibious_invasion = yes</pre>
|Checks if the current scope is performing an amphibious invasion.
|
|1.0
|-id="is_attacker"
|is_attacker
|<code><bool></code><br>Boolean.
|<pre>is_attacker = yes</pre>
|Checks if the current scope is attacking.
|
|1.0
|-id="is_defender"
|is_defender
|<code><bool></code><br>Boolean.
|<pre>is_defender = yes</pre>
|Checks if the current scope is defending.
|
|1.0
|-id="is_winning"
|is_winning
|<code><bool></code><br>Boolean.
|<pre>is_winning = yes</pre>
|Checks if the current scope is winning their battle.
|
|1.0
|-id="is_fighting_air_units"
|is_fighting_air_units
|<code><bool></code><br>Boolean.
|<pre>is_fighting_air_units = yes</pre>
|Checks if the current scope is fighting air units.
|
|1.0
|-id="less_combat_width_than_opponent"
|less_combat_width_than_opponent
|<code><bool></code><br>Boolean.
|<pre>less_combat_width_than_opponent = yes</pre>
|Checks if the current scope is fighting with less combat width than their opponent.
|
|1.0
|-id="has_carrier_airwings_on_mission"
|has_carrier_airwings_on_mission
|<code><bool></code><br>Boolean.
|<pre>has_carrier_airwings_on_mission = yes</pre>
|Checks if the current scope has carrier airwings on a mission.
|
|1.0
|-id="has_carrier_airwings_in_own_combat"
|has_carrier_airwings_in_own_combat
|<code><bool></code><br>Boolean.
|<pre>has_carrier_airwings_in_own_combat = yes</pre>
|Checks if the current scope has carrier airwings in their own combat.
|
|1.0
|}
 
==Division scope==
{{SVersion|1.13}}
Can be used in '''Division''' scope.
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Division-scoped triggers:}}<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" |Examples
! width="20%" |Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="division_has_majority_template"
|division_has_majority_template
|<code><battalion></code><br>Battalion to check for.
|<pre>division_has_majority_template = light_armor</pre>
|Checks if the current scope is majority made up of the specified battalion.
|Battalions are defined within {{path|common/units/*.txt}} files.
|1.12
|-id="division_has_battalion_in_template"
|division_has_battalion_in_template
|<code><battalion></code><br>Battalion to check for.
|<pre>division_has_battalion_in_template = light_armor</pre>
|Checks if the current scope has any battalions of the type in the template.
|Battalions are defined within {{path|common/units/*.txt}} files.
|1.12
|-id="unit_strength"
|unit_strength
|<code><battalion></code><br>Battalion to check for.
|<pre>unit_strength < 0.3</pre>
|Checks the current strength of the unit on the scale from 0 to 1.
|Must use either the < or > operator.
|1.12
|-id="unit_organisation"
|unit_organisation
|<code><battalion></code><br>Battalion to check for.
|<pre>unit_organization < 0.3</pre>
|Checks the current organisation of the unit on the scale from 0 to 1.
|Must use either the < or > operator.
|1.12
|-id="is_unit_template_reserves"
|is_unit_template_reserves
|<code><bool></code><br>Boolean.
|<pre>is_unit_template_reserves = yes</pre>
|Checks if the current division has the supply priority set to 'Reserves', i.e. the lowest priority.
|Must use either the < or > operator.
|1.12
|}
==MIO scope==
Can be used in '''Military-industrial organisation''' scope.
{{SVersion|1.13}}
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|MIO-scoped triggers:}}<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" | Examples
! width="20%" | Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="is_military_industrial_organization"
|is_military_industrial_organization
|<code><token></code><br/>MIO to check.
|<pre>is_military_industrial_organization = my_mio_token</pre>
|Checks if the currently-scoped MIO matches the input token.
|
|1.13
|-id="is_mio_visible"
|is_mio_visible
|<code><bool></code><br/>Boolean.
|<pre>is_mio_visible = yes</pre>
|Checks if the currently-scoped MIO is visible.
|
|1.13
|-id="is_mio_available"
|is_mio_available
|<code><bool></code><br/>Boolean.
|<pre>is_mio_available = yes</pre>
|Checks if the currently-scoped MIO is visible.
|
|1.13
|-id="is_mio_assigned_to_task"
|is_mio_assigned_to_task
|<code><bool></code><br/>Boolean.
|<pre>is_mio_assigned_to_task = yes</pre>
|Checks if the currently-scoped MIO is assigned to a task.
|
|1.13
|-id="has_mio_size"
|has_mio_size
|<code><int></code><br/>Integer.
|<pre>has_mio_size > 3</pre>
|Checks the size of the MIO.
|Accepts [[variables]]. May use < or >.
|1.13
|-id="has_mio_trait"
|has_mio_trait
|<code><token></code><br/>Trait to check.<br/>
'''OR'''<br/>
<code>trait = <token></code><br/>Trait to check.
|<pre>has_mio_trait = my_trait_token</pre>
<pre>has_mio_trait = {
   token = my_trait_token
}</pre>
|Checks whether the MIO has the target trait in its list.
|
|1.13
|-id="is_mio_trait_available"
|is_mio_trait_available
|<code><token></code><br/>Trait to check.<br/>
'''OR'''<br/>
<code>trait = <token></code><br/>Trait to check.<br/>
<code>check_mio_parent_completed = <bool></code><br/>Whether to check if the parent traits are complete. True by default.
<code>check_mio_mutually_exclusive = <bool></code><br/>Whether to check if any mutually exclusive traits are complete. True by default.
|<pre>is_mio_trait_available = my_trait_token</pre>
<pre>is_mio_trait_available = {
   token = my_trait_token
   check_mio_parent_completed = no
}</pre>
|Checks whether the MIO has the target trait in its list and whether it's available.
|
|1.13
|-id="is_mio_trait_completed"
|is_mio_trait_completed
|<code><token></code><br/>Trait to check.<br/>
'''OR'''<br/>
<code>trait = <token></code><br/>Trait to check.
|<pre>is_mio_trait_completed = my_trait_token</pre>
<pre>is_mio_trait_completed = {
   token = my_trait_token
}</pre>
|Checks whether the MIO has the target trait in its list and whether it's completed.
|
|1.13
|-id="has_mio_number_of_completed_traits"
|has_mio_number_of_completed_traits
|<code><int></code><br/>Integer.
|<pre>has_mio_number_of_completed_traits < 2</pre>
|Checks the amount of unlocked MIO traits.
|Accepts [[variables]]. May use < or >.
|1.13
|-id="has_mio_flag"
|has_mio_flag
|<code><string></code><br>The flag to check.
|<pre>has_mio_flag = my_flag</pre>
|Checks if the current scope has the specified flag.
|
|1.13
|-id="has_mio_flag"
|has_mio_flag
|<code>flag = <string></code><br>The flag to check.<br>
<code>value = <int></code><br>The flag value to check for. Optional.<br>
<code>date = <date></code><br>The flag creation date to check for. Optional.<br>
<code>days = <int></code><br>The duration the flag existed for. Optional.
|<pre>
has_mio_flag = {
   flag = my_flag
   days > 30
   date > 1936.6.1
   value > 0
}
</pre>
|Compares the specified flag's last set date, days since last set, and/or value.
|If not set, the value comparison is <code>>0</code>. <code>value</code> is limited between -32768 and 32767.
|1.13
|-id="has_mio_policy"
|has_mio_policy
|<code><token></code><br/>Policy to check.
|<pre>has_mio_policy = my_policy_token</pre>
|Checks if the currently-scoped MIO has the target policy allowed.
|
|1.13
|-id="has_mio_policy_active"
|has_mio_policy_active
|<code><token></code><br/>Policy to check.
|<pre>has_mio_policy_active = my_policy_token</pre>
|Checks if the currently-scoped MIO has the target policy active.
|
|1.13
|-id="has_mio_research_category"
|has_mio_research_category
|<code><token></code><br/>Category to check.
|<pre>has_mio_research_category = my_research_category_token</pre>
|Checks if the currently-scoped MIO has the target research category.
|
|1.13
|-id="has_mio_equipment_type"
|has_mio_equipment_type
|<code><token></code><br/>Type to check.
|<pre>has_mio_equipment_type = my_equipment_type_token</pre>
|Checks if the currently-scoped MIO has the target equipment types.
|The possible equipment types are defined in <code>script_enum_equipment_bonus_type</code> (in {{path|common/script_enums.txt}}) and in {{path|common/equipment_groups.txt}} files.
|1.13
|}
==Contract scope==
Can be used in '''purchase contract''' scope.
{{SVersion|1.13}}
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Contract-scoped triggers:}}<br/>
! width="10%" |Name
! width="25%" |Parameters
! width="25%" | Examples
! width="20%" | Description
! width="15%" |Notes
! width="5%" |Version Added
|-id="contract_contains_equipment"
|contract_contains_equipment
|<code><token></code><br/>Type to check.
|<pre>contract_contains_equipment = infantry_equipment</pre>
|Checks if the currently-scoped purchase contract contains an equipment type.
|May use equipment types, equipment archetypes, or types of equipment archetypes.
|1.13
|-id="deal_completion"
|deal_completion
|<code><decimal></code><br/>Progress to compare with.
|<pre>deal_completition > 0.6</pre>
|Checks the deal completion with the target value.
|May use < or >. On the scale from 0 to 1.
|1.13
|-id="seller"
|seller
|<code><country></code><br/>Country to check.
|<pre>seller = BHR</pre>
|Checks the seller in the current purchase contract.
|
|1.13
|-id="buyer"
|buyer
|<code><country></code><br/>Country to check.
|<pre>buyer = OMA</pre>
|Checks the buyer in the current purchase contract.
|
|1.13
|}
 
==Meta triggers==
{{SVersion|1.13}}
 
Meta triggers are a system added with 1.6 with {{icon|mtg|1}}<ref>[[forum:1117516|HOI4 Dev Diary - Modding and Traits]]</ref> used in the exact same manner as [[Effect#Meta effects|meta effects]]: in order to tie a trigger block to a dynamic localisation entry. This is usually used in conjunction with [[Localisation#Scripted localisation|scripted localisation]] for non-numerical checks. This also can serve in order to place a variable check where one is not possible.<br/>
Meta triggers work in any scope that supports triggers, including combat scope.
 
The following arguments go inside of a scripted trigger:
* <code>text = { ... }</code> is a trigger block used by the meta trigger. In here, any string that must be made dynamic is marked with the square brackets on each side as <code>[EXAMPLE]</code>.
* <code>EXAMPLE = "..."</code> is a string that will serve as the dynamic replacement for <code>[EXAMPLE]</code> within <code>text = { ... }</code>. This accepts [[Localisation#Namespaces|dynamic localisation]] to a limited degree, such as getting a variable's value with <code>[?var_name]</code> or some namespaces like <code>[ROOT.GetTag]</code>.
* <code>debug = yes</code>, if added, will add the final output in the [[Modding|user directory]]'s {{path|logs/game.log}} file for debugging purposes.
For example, the following can be used with [[#has_equipment|has_equipment]] to make it depend on a variable's value:
<pre>meta_trigger = {
   text = {
     has_equipment = { [EQUIPMENT_ARCHETYPE] > 100 }
   }
   EQUIPMENT_ARCHETYPE = "[GetEquipmentArchetype]"
}
</pre>
In this case, <code>GetEquipmentArchetype</code> is [[Localisation#Scripted localisation|scripted localisation]]. An example definition of scripted localisation in this case is as such:
<pre>defined_text = {
   name = GetEquipmentArchetype
   text = {
     trigger = {
       check_variable = { v = 0 }
     }
     localization_key = artillery_equipment
   }
   text = {
     localization_key = infantry_equipment
   }
}</pre>
 
== Scripted triggers ==
{{SVersion|1.13}}
Scripted triggers serve a similar purpose to [https://en.wikipedia.org/wiki/Subroutine functions] in that they can be defined in {{path|common/scripted_triggers/*.txt}} and then used elsewhere as a shortened version. Alongside that, the game has certain base game scripted triggers that are checked directly in the game's code determining triggers for functions that cannot be changed.
 
A scripted trigger is defined simply as <pre>scripted_trigger_name = {
<triggers>
}</pre>This example can be used as a trigger in regular code as <code>scripted_trigger_name = yes</code> or <code>scripted_trigger_name = no</code>.
 
For example, this would be the definition in any scripted trigger file:
<pre>state_is_in_area = {
   OR = {
     state = 120
     state = 121
     state = 123
     state = 124
     state = 125
   }
}</pre>
This can then be used in any other trigger block, such as a national focus' available section:
<pre>focus = {
   id = TAG_focus_id  # Optional attributes, other than available, have been omitted
   available = {
     capital_scope = {
       state_is_in_area = yes
     }
   }
}</pre>
If there are several definitions of scripted triggers with the exact same name, the game will make the scripted trigger be the one that was [[Modding#Loading files|evaluated later, as decided by file names and order in files]].
=== Diplomacy scripted triggers ===
{{SVersion|1.13}}
Diplomacy scripted triggers fall into two mutually exclusive groups: deciding availability and deciding visibility. By default, these are defined in {{path|common/scripted_triggers/diplomacy_scripted_triggers.txt}} and {{path|common/scripted_triggers/00_diplo_action_valid_triggers.txt}} respectively. While it is possible to also use them as regular scripted triggers, they will also modify the prerequisites of being able to do a diplomatic action between 2 countries.
 
A diplomacy scripted trigger is identified by the naming pattern of <code>DIPLOMACY_<action>_ENABLE_TRIGGER</code> for availability, such as <code>DIPLOMACY_GUARANTEE_ENABLE_TRIGGER</code>, and <code>is_diplomatic_action_valid_<action></code> for visibility, such as <code>is_diplomatic_action_valid_stage_coup</code>. In the base game, diplomacy scripted triggers are used to implement the game rules and add some country-specific exceptions, such as the {{flag|United Kingdom}} being unable to release its colonies with the {{icon|mtg|1}} DLC. Checking the base game's contents beforehand or copying it to the mod would ensure that the mod won't accidentally break any existing game rules.
 
Generally, the pattern in localisation keys used for the button usually matches up with the internal ID of a diplomatic action. If the diplomatic action doesn't already have a scripted trigger in the base game, [[Modding#Searching multiple files|entirety of localisation can be searched]] for the name of the button to find the name of the action. For example, a the English localisation entry of <code> DIPLOMACY_CANCEL_GENERATE_WARGOAL_TITLE:0 "Cancel Justification"</code> would suggest that the diplomatic action of cancelling justification is <code>CANCEL_GENERATE_WARGOAL</code>.
 
Know tokens for <code>is_diplomatic_action_valid_<action></code> are:
* '''declare_war''', for the Declare War button
* '''generate_wargoal''', only affects the war goal menu by greying out the send button
* '''guarantee''', for the Guarantee Independence button
* '''docking_rights''', for the request docking rights button
* '''offer_docking_right''', for the offer docking rights button
* '''create_faction''', for the create faction button
* '''assume_faction_leadership''', for the assume leadership of faction button
* '''kick_from_faction''', for the kick from faction button
* '''join_faction''', for the ask to join faction button
* '''request_access_to_licence_production''', for the negotiate license button
* '''embargo''', for the embargo button
* '''send_volunteers''', only affects the sent volunteers menu by greying out the send button
* '''stage_coup''', for the stage coup button
* '''boost_party_popularity''', for the boost party popularity button
 
Within a diplomacy scripted trigger, the default scope is the country that does the trigger, while [[Scopes#FROM|FROM]] is the target of the action. For availability, the trigger's tooltip is shown to the player when hovering over the diplomatic action; in case of country-specific restrictions, using [[#if|conditional statements]] can ensure that the tooltip would only be generated when needed rather than between any pair of nations.
 
For example, this trigger will prevent BHR from revoking a guarantee on QAT, while still ensuring the game rule works otherwise:
<pre>DIPLOMACY_REVOKE_GUARANTEE_ENABLE_TRIGGER = {
   if = {
     limit = {
       has_game_rule = {
         rule = allow_revoke_guarantees
         option = BLOCKED
       }
     }
     custom_trigger_tooltip = {
       tooltip = RULE_ALLOW_REVOKE_GUARANTEES_BLOCKED_TOOLTIP
       always = no
     }
   }
   if = {
     limit = {
       tag = BHR
       FROM = { tag = QAT }
     }
     custom_trigger_tooltip = {
       tooltip = NO_REVOKING_ON_QAT_TT
       always = no
     }
   }
}</pre>
 
=== Resistance initiation triggers ===
The behaviour of resistance being automatically initiated is decided by the <code>should_initiate_resistance</code> scripted trigger, by default defined in {{path|common/scripted_triggers/00_resistance_initiate_triggers.txt}}. If it is unfulfilled, the resistance will never initiate unless forced via the [[Effect#force_enable_resistance|the force_enable_resistance effect]]. Likewise, the resistance will always occur if it's true unless forcefully disabled.
 
The scripted trigger's behaviour can be overwritten with state-specific scripted triggers, which should be named <code>should_initiate_resistance</code> with the list of state IDs suffixed at the end, separated by underscores. For example, this ensures that when a state 321 or 123 is controlled by the {{flag|United Kingdom}}, resistance would get initiated if and only if they're national territory of {{flag|France}}; otherwise, the normal behaviour is used:
<pre>should_initiate_resistance_123_321 = {
if = {
limit = {
tag = ENG
}
is_core_of = FRA
}
else = {
should_initiate_resistance = yes # If this is not done, resistance would always activate due to overwriting that scripted trigger.
}
}</pre>
=== Useful scripted triggers ===
These scripted triggers are defined in base game and might be useful to keep in the mod to cut down on the amount of code. As scripted triggers, all of these use a boolean value as argument.
 
{| class="wikitable sortable mw-collapsible" style="display: inline-block; padding: 5px" width="100%"
|+ {{nowrap|Scripted triggers:}}<br/>
! width="20%" |Name
! width="10%" |Scope
! width="25%" |Example
! width="20%" |Description
! width="25%" |Notes
|-id="can_ROOT_get_wargoal_on_THIS"
|can_ROOT_get_wargoal_on_THIS
|Country
|<pre>can_ROOT_get_wargoal_on_THIS = yes</pre>
|Checks if ROOT can obtain a wargoal on the current scope.
|To evaluate as true, the current scope must exist, not share a faction with ROOT, and not be a subject of ROOT.
|-id="is_free_or_subject_of_root"
|is_free_or_subject_of_root
|Country
|<pre>is_free_or_subject_of_root = yes</pre>
|Checks if the current scope is either independent or a subject of ROOT.
|
|-id="has_same_ideology"
|has_same_ideology
|Country
|<pre>has_same_ideology = yes</pre>
|Checks if the current scope has the same ideology as ROOT.
|Needs modifying if there are custom ideologies. Equivalent to <code>has_government = ROOT</code> for base game ideologies.
|-id="is_enemy_ideology"
|is_enemy_ideology
|Country
|<pre>is_enemy_ideology = yes</pre>
|Checks if the current scope has an ideology that is considered enemy to ROOT's.
|{{Icon|Communism|1}}, {{Icon|Democracy|1}}, and {{Icon|Fascism|1}} are considered enemy to each other.
|-id="has_ROOT_at_least_1_div_in_current_state_scope"
|has_ROOT_at_least_1_div_in_current_state_scope
|State
|<pre>has_ROOT_at_least_1_div_in_current_state_scope = yes</pre>
|Checks if ROOT has at least one division in the current scope.
|
|-id="controls_or_subject_of"
|controls_or_subject_of
|State
|<pre>controls_or_subject_of = yes</pre>
|Checks if the current state is controlled by ROOT or a subject of ROOT.
|
|-id="is_controlled_by_ROOT_or_ally"
|is_controlled_by_ROOT_or_ally
|State
|<pre>is_controlled_by_ROOT_or_ally = yes</pre>
|Checks if the current state is controlled by ROOT, a subject of ROOT, or a country in the same faction as ROOT.
|
|-id="owns_or_subject_of"
|owns_or_subject_of
|State
|<pre>owns_or_subject_of = yes</pre>
|Checks if the current scope is owned by ROOT or a subject of ROOT.
|
|
|}
|}


Remember that variables need to refer to the scope they were set in. This means you can't check a country variable in a state scope without scoping the variable.
==References and notes ==
 
{{cnote|a|Triggers are able to set and modify [[variables|temporary variables]]. This temporary variable itself may be then used separately to change the game's state, such as in a [[MTTH|MTTH block]] or if the trigger block is used in some [[effect]]'s <code>limit {{=}} { ... }</code> (most commonly [[Effect#if|if statements]] or [[Scopes#Scope limits|effect scope limits]]), though the usage of the variable to change the game's state is not a trigger by itself.}}
For example, to get the country variable whilst in a state scope, you'd do the following:
 
<pre>
<country> = {
   <state> = {
     limit = {
       check_variable = { from.my_country_var > 0.0 }
     }
   }
}
</pre>
 
See [[Variables]] for more information.
 
==运算符==
{{SVersion|1.5}}
 
There are two extra operators for triggers, '''>''' (greater than) and '''<''' (less than).
 
They are used for numerical or date triggers, and provide an exclusive check for their value. This means a trigger using them will return true if the result is any number below (or above).
 
Note that equals in Hearts of Iron 4 only checks for exact equality, i.e. x = y, whereas in previous games it checks for equals or greater than, i.e. x >= y.
 
==Context scopes==
{{SVersion|1.5}}
 
There are three general scopes all triggers operate in:
 
*country
*state
*unit leader
 
They give context to a trigger by stating what the trigger is checking against
 
Each country acts as a sub-scope of the general country scope, i.e. <code>GER = { }</code> will check only against Germany, whereas <code>any_country</code> will check against all countries. Likewise for states and unit leaders.
 
The important lesson here is that triggers for one type of scope will not work in the other scopes generally (there are exceptions).
 
==References==
<references />
<references />


{{Modding navbox}}
{{Modding navbox}}
[[category:modding]]
[[ 分类:modding]]

2024年9月8日 (日) 00:51的最新版本

Conditions (also known as Triggers) are used to check whether certain conditions are fulfilled in the game's current state or not, without being able to change anything in the game's state.[a] These return a boolean (true or false), which may be interpreted by the block where it's used. Usually blocks that allow using triggers are an AND unless stated otherwise, which would instantly stop execution upon receiving a single false statement and return false.

The list of triggers may be outdated. A complete, but unsorted, list of triggers can be found in /Hearts of Iron IV/documentation/triggers_documentation.html or /Hearts of Iron IV/documentation/triggers_documentation.md. As of 1.12.14, this file was last updated in the version 1.11.4.


Operators

Every trigger uses one of the three operators: The equality sign = or the comparison signs > and <.

The equality sign can either mean strict equality (Unlike previous games in the series where it checked for being equal or greater than) or can serve as a way to introduce a block of additional triggers, as in has_opinion = { target = GRE value < -10 }. The comparison signs serves as strict comparison: has_political_power > 100 will not be true if the country has exactly 100 political power, for instance.

Not all triggers support the equality sign or comparison signs. See the details for each trigger in the notes for it. If not stated otherwise, the trigger only supports the equality sign.

Context scopes

There are three general scopes all triggers operate in:

  • country
  • state
  • character

They give context to a trigger by stating what the trigger is checking against.

Each country acts as a sub-scope of the general country scope, i.e. GER = { } will check only against Germany, whereas any_country will check against all countries. Likewise for states and characters.

Triggers won't work in scopes they are not assigned to. Country triggers will not work for states or vice-versa.

Scopes

主条目:Scopes

These don't serve as triggers, but rather as scopes that change for whom the triggers are being checked. Each one also serves as an AND statement.

Trigger scopes

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

Trigger scopes:
Name Usage Target type Example Description Version Added
all_country Always usable Country all_country = { … } Checks if all countries meet the triggers. 1.0
any_country Always usable Country any_country = { … } Checks if any country meets the triggers. 1.0
all_other_country Within country scope only Country all_other_country = { … } Checks if all countries other than the one where this scope is located meet the triggers. 1.0
any_other_country Within country scope only Country any_other_country = { … } Checks if any country other than the one where this scope is located meets the triggers. 1.0
all_country_with_original_tag Always usable Country
all_country_with_original_tag = {
    original_tag_to_check = TAG  #required
    …                  #triggers to check
}
Checks if all countries originating from the specified country, including the dynamic countries created for civil wars and other purposes, meet the triggers. original_tag_to_check = TAG is used to specify the original tag. 1.9
any_country_with_original_tag Always usable Country
any_country_with_original_tag = {
    original_tag_to_check = TAG  #required
    …                  #triggers to check
}
Checks if any country originating from the specified country, including the dynamic countries created for civil wars and other purposes, meets the triggers. original_tag_to_check = TAG is used to specify the original tag. 1.9
all_neighbor_country Within country scope only Country all_neighbor_country = { … } Checks if all countries that border the one where this scope is located meet the triggers. 1.0
any_neighbor_country Within country scope only Country any_neighbor_country = { … } Checks if any country that borders the one where this scope is located meets the triggers. 1.0
any_home_area_neighbor_country Within country scope only Country any_home_area_neighbor_country = { … } Checks if any country that borders the one where this scope is located, as well as being in its home area - meaning a direct land connection between the capitals of countries - meets the triggers. 1.0
all_guaranteed_country Within country scope only Country all_guaranteed_country = { … } Checks if all countries that are guaranteed by the one where this scope is located meet the triggers. 1.9
any_guaranteed_country Within country scope only Country any_guaranteed_country = { … } Checks if any country that is guaranteed by the one where this scope is located meets the triggers. 1.9
all_allied_country Within country scope only Country all_allied_country = { … } Checks if all countries that are allied with the one where this scope is located - meaning that they are either a subject of the country, its overlord, or that they share a faction - meet the triggers. Does not include the country itself. 1.9
any_allied_country Within country scope only Country any_allied_country = { … } Checks if any country that is allied with the one where this scope is located - meaning that they are either a subject of the country, its overlord, or that they share a faction - meets the triggers. Does not include the country itself. 1.9
all_occupied_country Within country scope only Country all_occupied_country = { … } Checks if all countries that are occupied by the one where this scope is located - meaning that the occupied country has core states controlled by the occupier country - meet the triggers. 1.9
any_occupied_country Within country scope only Country any_occupied_country = { … } Checks if any country that is occupied by the one where this scope is located - meaning that the occupied country has core states controlled by the occupier country - meets the triggers. 1.9
all_enemy_country Within country scope only Country all_enemy_country = { … } Checks if all countries that are at war with the one where this scope is located meet the triggers. 1.9
any_enemy_country Within country scope only Country any_enemy_country = { … } Checks if any country that are at war with the one where this scope is located meets the triggers. 1.9
all_subject_countries Within country scope only Country all_subject_countries = { … } Checks if all countries that are a subject of the one where this scope is located meet the triggers. Notice the plural spelling in the scope. 1.11
any_subject_country Within country scope only Country any_subject_country = { … } Checks if any country that is a subject of the one where this scope is located meets the triggers. 1.11
any_country_with_core Within state scope only Country any_country_with_core = { … } Checks if any country that has the current scope as a core state meets the triggers. Does not have an equivalent for other effect/trigger scope types. 1.12
all_state Always usable State all_state = { … } Check if all states meet the triggers. 1.0
any_state Always usable State any_state = { … } Check if any state meets the triggers. 1.0
all_neighbor_state Within state scope only State all_neighbor_state = { … } Check if all states that are neighbour to the one where this scope is located meet the triggers. 1.0
any_neighbor_state Within state scope only State any_neighbor_state = { … } Check if any state that is neighbour to the one where this scope is located meets the triggers. 1.0
all_owned_state Within country scope only State all_owned_state = { … } Check if all states that are owned by the country where this scope is located meet the triggers. 1.0
any_owned_state Within country scope only State any_owned_state = { … } Check if any state that is owned by the country where this scope is located meets the triggers. 1.0
all_core_state Within country scope only State all_core_state = { … } Check if any state that is cored by the country where this scope is located meets the triggers. 1.11
any_core_state Within country scope only State any_core_state = { … } Check if all states that are cored by the country where this scope is located meet the triggers. 1.11
all_controlled_state Within country scope only State all_controlled_state = { … } Check if all states that are controlled by the country where this scope is located meet the triggers. 1.9
any_controlled_state Within country scope only State any_controlled_state = { … } Check if any state that is controlled by the country where this scope is located meets the triggers. 1.9
all_unit_leader Within country scope only Unit Leader all_unit_leader = { … } Checks if all unit leaders (corps commanders, field marshals, admirals) that are employed by the country where this scope is located meet the triggers. 1.5
any_unit_leader Within country scope only Unit Leader any_unit_leader = { … } Checks if any unit leader (corps commander, field marshal, admiral) that is employed by the country where this scope is located meets the triggers. 1.5
all_army_leader Within country scope only Unit Leader all_army_leader = { … } Checks if all army leaders that are employed by the country where this scope is located meet the triggers. 1.5
any_army_leader Within country scope only Unit Leader any_army_leader = { … } Checks if any army leader that is employed by the country where this scope is located meets the triggers. 1.5
all_navy_leader Within country scope only Unit Leader all_navy_leader = { … } Checks if all navy leaders that are employed by the country where this scope is located meet the triggers. 1.5
any_navy_leader Within country scope only Unit Leader any_navy_leader = { … } Checks if any navy leader that is employed by the country where this scope is located meets the triggers. 1.5
all_operative_leader Within country scope or operations only Operative all_operative_leader = { … } Checks if all operatives that are employed by the country where this scope is located meet the triggers. 1.9
any_operative_leader Within country scope or operations only Operative any_operative_leader = { … } Checks if any operative that is employed by the country where this scope is located meets the triggers. 1.9
all_character Within country scope only Character all_character = { … } Checks if all characters that are recruited by the country where this scope is located meet the triggers. 1.11
any_character Within country scope only Character any_character = { … } Checks if any character that is recruited by the country where this scope is located meets the triggers. 1.11
any_country_division Within country scope only Division any_country_division = { … } Checks if any division owned by the current country meets the triggers. 1.12
any_state_division Within state scope only Division any_state_division = { … } Checks if any division within the current state meets the triggers. 1.12
all_military_industrial_organization Within country scope only MIO all_military_industrial_organization = { … } Checks if all MIOs within the current country meet the conditions. 1.13
any_military_industrial_organization Within country scope only MIO any_military_industrial_organization = { … } Checks if any MIO within the current country meets the conditions. 1.13
all_purchase_contract Within country scope only Purchase contract all_purchase_contract = { … } Checks if all purchase contracts within the current country meet the conditions. 1.13
any_purchase_contract Within country scope only Purchase contract any_purchase_contract = { … } Checks if any purchase contract within the current country meets the conditions. 1.13

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


Flow control tools

These are triggers that serve as more of a way to establish a connection in how triggers are evaluated. Each one serves as a trigger scope with additional arguments and can be used regardless of scope.

Flow control tools:
Name Additional parameters Examples Description Notes Version Added
AND None
AND = {
    original_tag = GER
    has_stability > 0.5
}
Returns false if any sub-trigger returns false, true otherwise. Evaluation stops at the first false sub-trigger. Only necessary within OR statements and NOT statements, as everything else is implicitly AND. 1.0
OR None
OR = {
    original_tag = ENG
    original_tag = USA
}
Returns true if any sub-trigger returns true, false otherwise. Evaluation stops at the first true sub-trigger. 1.0
NOT None
NOT = {
    has_stability > 0.5
    has_war_support > 0.5
}
Returns false if any sub-trigger returns true, true otherwise. Evaluation stops at the first true sub-trigger. Equivalent to a NOR rather than a NAND. 1.0
count_triggers amount = <int>
The amount of triggers that need to be fulfilled.
count_triggers = {
    amount = 2
    10 = { state_population = 100000 }
    11 = { state_population = 100000 }
    12 = { state_population = 100000 }
}
Sums the results of all sub-triggers (false=0, true=1) and returns true if the sum is at least amount. 1.5
if limit = <trigger block>

else_if = <if-trigger>
Alternative condition. Optional.
else = <AND-trigger>
Final alternative condition. Optional.

if = {
    limit = {
        has_dlc = "Poland: United and Ready"
    }
    has_political_power > 100
}
else_if = {
    limit = {
        has_dlc = "Waking the Tiger"
    }
    has_war_support > 0.5
}
else = {
    always = no
}
If limit is true, the sub-triggers are evaluated like an AND-trigger. If limit is false, else_if blocks are tried in sequence and finally else (if present). Otherwise true is returned. Both nested (As in inside of if = { ... }) and unnested (As in the example) else and else_if exist. In case of overlap, unnested is preferred.

Can be useful for tooltip management: same as in effects, if the limit is unmet, nothing appears. If it is met, then the limit is hidden while the condition outside of the limit appears in the tooltip.

if = { limit = { trigger_1 = yes } trigger_2 = yes } is equivalent to OR = { NOT = { trigger_1 = yes } trigger_2 = yes }, but generates a different tooltip.

1.0
hidden_trigger None
hidden_trigger = {
    country_exists = GER
}
Hides the triggers from the tooltip shown to the player. Also serves as an AND statement. 1.0
custom_trigger_tooltip tooltip = <string>
The localisation key to use.
custom_trigger_tooltip = {
    tooltip = sunrise_invasion_tt		
    any_state = {
        is_owned_by = JAP
        is_on_continent = europe
        is_coastal = yes
    }
}
Hides the triggers from the tooltip shown to the player and instead uses the specified localisation key. Also serves as an AND statement. When required to be false (as with NOT), the game will use the same localisation key but with _NOT appended (as in sunrise_invasion_tt_NOT in the example). If it doesn't exist, the same tooltip as for being true will get re-used, possibly causing player confusion. 1.0

Any scope

These triggers do not require any particular scope.

General

General any-scoped triggers:
Name Parameters Examples Description Notes Version Added
always <bool>
Boolean.
always = yes
Always returns true or false. Useful for debugging. 1.0
has_global_flag <string>
The flag to check.
has_global_flag = my_flag
Checks if the specified flag has been set. 1.0
has_global_flag flag = <string>
The flag to check.

value = <int>
The flag value to check for. Optional.
date = <date>
The flag creation date to check for. Optional.
days = <int>
The duration the flag existed for. Optional.

has_global_flag = {
    flag = my_flag
    days > 30
    date > 1936.6.1
    value > 0
}
Compares the specified flag's last set date, days since last set, and/or value. If not set, the value comparison is >0. value is limited between -32768 and 32767. 1.0
has_dlc <string>
The DLC name to check for.
has_dlc = "Waking the Tiger"
Checks if the specified DLC is enabled. 1.0
has_start_date <date>
The date to check for.
has_start_date > 1950.01.01
Checks if the specified date was the start date used for the current game. Year.Month.Day

Must use either > or < operators.

1.0
date <date>
The date to check for.
date < 1950.01.01
Checks if the specified date against the current date. Year.Month.Day

Must use either > or < operators.

1.0
difficulty <int>
The difficulty value.
difficulty > 0
checks if the specified difficulty against the current difficulty. Must use either > or < operators. 1.0
has_any_custom_difficulty_setting <bool>
Boolean.
has_any_custom_difficulty_setting = yes
Checks if any custom difficulty setting is changed from their default value. Custom difficulty in this case refers to /Hearts of Iron IV/common/difficulty_settings/*.txt, used in base game to strengthen a specific country. 1.0
has_custom_difficulty_setting <string>
The setting to check.
has_custom_difficulty_setting = custom_diff_strong_sov
Checks if the specified custom difficulty setting is changed from the default value. Custom difficulty in this case refers to /Hearts of Iron IV/common/difficulty_settings/*.txt, used in base game to strengthen a specific country. 1.0
game_rules_allow_achievements <bool>
Boolean.
game_rules_allow_achievements = yes
Checks if all of the active game rule options allow achievements. 1.9
country_exists <scope> / <variable>
The country to check.
country_exists = GER
Checks if the specified country currently exists in game. 1.0
is_ironman <bool>
Boolean.
is_ironman = yes
Checks if the current game is running in Ironman mode. 1.0
is_historical_focus_on <bool>
Boolean.
is_historical_focus_on = yes
Checks if the current game is running with Historical Focuses on. 1.0
is_tutorial <bool>
Boolean.
is_tutorial = yes
Checks if the current game is running in Tutorial mode. 1.0
is_debug <bool>
Boolean.
is_debug = yes
Checks if game is in debug mode (launched with -debug argument). 1.9
threat <float>
The amount to check for.
threat > 0.5
Checks if World Tension is above the specified amount. Must use either > or < operators. 1.0
has_game_rule <string>
The game rule to check for.

<string> / <bool>
The option to check.

has_game_rule = { rule = GER_can_remilitarize_rhineland option = yes }
Checks if a game rule is set to a particular option. 1.5

Variables

Variable-related triggers:
Name Parameters Examples Description Notes Version Added
has_variable <variable>
The variable to check.
has_variable = my_var
Checks if the specified variable exists for the current scope. 1.5
check_variable var = <variable>
The variable to check.

value = <float> / <variable>
The value to check for.
compare = <type>
The type of comparison. Optional, can use < or > instead.

check_variable = {
    var = my_var
    value = 10
    compare = greater_than_or_equals
}
check_variable = {
    my_var > 10
}
Check the specified variable for the current scope. Possible compare types:
  • less_than
  • less_than_or_equals
  • greater_than
  • greater_than_or_equals
  • equals
  • not_equals
1.5

Remember that variables need to refer to the scope they were set in. This means you can't check a country variable in a state scope without scoping the variable.

For example, to get the country variable whilst in a state scope, you'd do the following:

<country> = {
    <state> = {
        limit = {
            check_variable = { from.my_country_var > 0.0 }
        }
    }
}

See Variables for more information.

Debugging

These are usable as both effects and triggers and are used for debugging, with the player never seeing them.

Debugging-helpful triggers:
Name Parameters Examples Description Notes Version Added
log <string>
What to log. Supports dynamic localisation.
log = "Added [?temp_add] to [THIS.GetTag]'s variable [?THIS.varvalue]"
Appends an entry into the game.log and, if open, the console when evaluating the trigger. game.log is stored within /Hearts of Iron IV/logs/ in the user directory 1.5

Country scope

Can be used in country scope.

General

General country-scoped triggers:
Name Parameters Examples Description Notes Version Added
exists <bool>
Boolean.
exists = yes
Checks if the current scope exists in game. 1.0
tag <scope> / <variable>
The country to check.
tag = GER
tag = var:my_country
Checks if the current scope is the specified country. Only checks the actual tag while excluding dynamic countries, see original_tag if they should be included. 1.0
original_tag <scope> / <variable>
The country to check.
original_tag = GER
original_tag = var:my_country
Checks if the current scope originates from the specified country. This also includes dynamic countries: civil war breakaways and countries created via create_dynamic_country. True for the original country. 1.0
is_ai <bool>
Boolean.
is_ai = yes
Checks if the current scope is AI. 1.0
has_collaboration target = <country>
The country to check.

value <> <decimal>
The value of the collaboration on the 0-1 scale.

has_collaboration = {
    target = GER
    value > 0.5
}
Checks if the current scope has a collaboration level in the target scope. The target is occupied by the current scope. Must use < or > in the value argument. 1.9
has_country_flag <string>
The flag to check.
has_country_flag = my_flag
Checks if the current scope has the specified flag. 1.0
has_country_flag flag = <string>
The flag to check.

value = <int>
The flag value to check for. Optional.
date = <date>
The flag creation date to check for. Optional.
days = <int>
The duration the flag existed for. Optional.

has_country_flag = {
    flag = my_flag
    days > 30
    date > 1936.6.1
    value > 0
}
Compares the specified flag's last set date, days since last set, and/or value. If not set, the value comparison is >0. value is limited between -32768 and 32767. 1.0
has_cosmetic_tag <string>
The cosmetic tag to check.
has_cosmetic_tag = SOV_custom
Checks if the current scope has the specified cosmetic tag active. 1.5
has_event_target <event target>
The event target to check.
has_event_target = my_var
Checks if the current scope is assigned as the specified event target. 1.0
has_decision <string>
The decision to check.
has_decision = my_decision
Checks if the current scope has the specified decision activated. 1.5
has_dynamic_modifier modifier = <string>
The dynamic_modifier to check.

scope = <scope>
The country to check. Optional, if the original modifier has been targeted.

has_dynamic_modifier = {
    modifier = my_dynamic_modifier
    scope = GER
}
Checks if the current scope has the specified dynamic modifier activated. 1.6
has_active_mission <string>
The mission to check.
has_active_mission = my_mission
Checks if the current scope has the specified mission active. 1.5
has_focus_tree <string>
The focus tree to check.
has_focus_tree = soviet_tree
Checks if the current scope has the specified focus tree. 1.3
has_completed_focus <string>
The focus to check.
has_completed_focus = my_focus
Checks if the current scope has the specified focus completed. 1.0
focus_progress focus = <string>
The focus to check.

progress = <string>
The progress to check for.

focus_progress = {
    focus = my_focus
    progress > 0.5
}
Checks if the specified focus has been completed the specified percent for the current scope. Must use either > or < operators for progress. 1.0
has_country_custom_difficulty_setting <bool>
Boolean.
has_country_custom_difficulty_setting = yes
Checks if the any custom difficulty setting targeting the current scope is changed from the default value. Custom difficulty in this case refers to /Hearts of Iron IV/common/difficulty_settings/*.txt, used in base game to strengthen a specific country. 1.0
has_terrain <terrain>
Terrain.
has_terrain = urban
Checks if the current scope has any provinces of the specified terrain. Only can be used in country scope. 1.11
is_dynamic_country <bool>
Boolean.
is_dynamic_country = yes
Checks if the current scope is a dynamic country. Dynamic countries include those generated in civil wars as well as those generated with the create_dynamic_country effect, such as collaboration governments. 1.11
num_of_supply_nodes <int>
The amount to check for.
num_of_supply_nodes > 10
Checks if the current scope has the specified amount of supply nodes under control. Can only use < or > operators. 1.11
has_completed_custom_achievement mod = <mod ID>
The mod where the achievement is from.

achievement = <achievement ID>
The name of the achievement.

has_completed_custom_achievement = {
    mod = my_mod_unique_id
    achievement = my_achievement_token
}
Checks if the player controlling the current scope has completed the specified custom achievement. The achievement (including the ID of the mod it's from) is defined within /Hearts of Iron IV/common/achievements/*.txt files[1]. The achievement could be completed during a previous session, not necessarily the current one.

If the mod defining the achievement is not loaded, the trigger evaluates as false.

1.12.5
<resource> (resource_count_trigger) <int>
The amount to check for.
tungsten > 10
Checks if the current scope has the specified amount of the specified resource. Must use either > or < operators for amount.
has_resources_in_country resource = <resource>
The resource to check for.

amount = <int>
The amount to check for.
extracted = <bool>
Limits the checked resources only to those gained from the state's base value and multiplicative modifiers on top of it if true. Optional, defaults to false.
buildings = <bool>
Limits the checked resources only to those gained from the state's modifiers applied by buildings. Optional, defaults to false.

has_resources_in_country = {
    resource = oil
    amount > 10
    extracted = yes
}
Checks if the current scope has the specified amount of the specified resource in reserve. Must use either > or < operators for amount. 'In reserve' means that it's not spent on equipment production or exports. 1.12

Politics

Political country-scoped triggers:
Name Parameters Examples Description Notes Version Added
<ideology> (ideology_support_trigger) <ideology> = <float> / <variable>
The amount of the ideology to check for.
fascism > 0.5
democratic > party_popularity@communism
Checks if the current scope has popularity of the specified ideology above the specified amount. 1.0
has_political_power <float>
The amount to check for.
has_political_power > 100
Checks if the current scope has the specified amount of political power. Must use either > or < operators. 1.0
political_power_daily <float> / <variable>
The amount to check for.
political_power_daily > 1
Checks if the current scope has the specified amount of daily political power gain. Must use either > or < operators. 1.5
political_power_growth <float> / <variable>
The amount to check for.
political_power_growth > 1
Checks if the current scope has the specified amount of daily political power gain. Must use either > or < operators. 1.5
command_power <float> / <variable>
The amount to check for.
command_power > 1
Checks if the current scope has the specified amount of command power. Must use either > or < operators. 1.5
command_power_daily <float> / <variable>
The amount to check for.
command_power_daily > 1
Checks if the current scope has the specified amount of daily command power gain. Must use either > or < operators. 1.5
has_war_support <float> / <variable>
The amount to check for.
has_war_support > 0.5
Checks if the current scope has the specified percentage of War Support. Must use either > or < operators. 1.5
has_stability <float> / <variable>
The amount to check for.
has_stability > 0.5
Checks if the current scope has the specified percentage of Stability. Must use either > or < operators. 1.5
has_government <ideology>
The ideology group to check for.

OR
<country>
The country to compare with.

has_government = fascism
has_government = ROOT
Checks if the ruling party of the current scope meets the requirements of being either the specified ideology group or having the same ideology group as the specified country. 1.0
has_elections <bool>
Boolean.
has_elections = yes
Checks if the current scope holds elections. 1.0
is_staging_coup <bool>
Boolean.
is_staging_coup = yes
Checks if the current scope is staging a coup. 1.3
is_target_of_coup <bool>
Boolean.
is_target_of_coup = yes
Checks if the current scope is the target of a coup. 1.0
has_civil_war <bool>
Boolean.
has_civil_war = yes
Checks if the current scope has a civil war active. 1.0
civilwar_target <scope>
The target country.
civilwar_target = GER
Checks if the specified country is a target of a civil war. 1.0
has_manpower_for_recruit_change_to value = <float>
The amount to check for.

group = <group>
The group to check for.

has_manpower_for_recruit_change_to = {
    value > 0.05
    group = mobilization_laws
}
Checks if the current scope has the specified amount of manpower for changing the specified idea group. Must use either > or < operators as = operator checks for the exact value 1.0
has_rule <string>
The rule to check for.
has_rule = can_create_factions
Checks if the current scope has the specified country rule. 1.6
has_casualties_war_support <float> / <variable>
The amount to check for.
has_casualties_war_support < 0
Checks if the current scope has the specified percentage of war support from own combat casualties. Must use either > or < operators. 1.12
has_convoys_war_support <float> / <variable>
The amount to check for.
has_convoys_war_support < 0
Checks if the current scope has the specified percentage of war support from own convoys sunk. Must use either > or < operators. 1.12
has_bombing_war_support <float> / <variable>
The amount to check for.
has_bombing_war_support < 0
Checks if the current scope has the specified percentage of war support from own states bombed by the enemy. Must use either > or < operators. 1.12

Balance of power

Balances of power are stored within /Hearts of Iron IV/common/bop/*.txt files.

Balance of power-related country-scoped triggers:
Name Parameters Examples Description Notes Version Added
has_power_balance id = <bop ID>
The balance to check for.
has_power_balance = {
    id = TAG_my_bop
}
Checks if the current scope has the specified balance of power active. 1.12
has_any_power_balance <bool>
Boolean.
has_any_power_balance = yes
Checks if the current scope has any balance of power active. 1.12
power_balance_value id = <bop ID>
The balance to check in.

value = <float>
The value to check for.

power_balance_value = {
    id = TAG_my_bop
    value > 0.7
}
Checks if the current scope has the specified value within the balance of power. Either =, >, or < operators are allowed. 1.12
power_balance_daily_change id = <bop ID>
The balance to check in.

value = <float>
The value to check for.

power_balance_daily_change = {
    id = TAG_my_bop
    value < -0.01
}
Checks if the current scope's balance of power changes each day by the specified value. Either =, >, or < operators are allowed. 1.12
power_balance_weekly_change id = <bop ID>
The balance to check in.

value = <float>
The value to check for.

power_balance_weekly_change = {
    id = TAG_my_bop
    value < -0.01
}
Checks if the current scope's balance of power changes each week by the specified value. Either =, >, or < operators are allowed. 1.12
is_power_balance_in_range id = <bop ID>
The balance to check in.

range = <range ID>
The range to check for.

is_power_balance_in_range = {
    id = TAG_my_bop
    range > TAG_my_bop_right_range
}
Checks if the current scope's balance of power value lies within the specified range. Ranges are defined within the balance of power. Can use either =, >, and < operators. In case of > or <, the comparison is 'strict', i.e. excluding the range itself. 1.12
is_power_balance_side_active id = <bop ID>
The balance to check in.

side = <side ID>
The side to check.

is_power_balance_side_active = {
    id = TAG_my_bop
    side = TAG_my_bop_right_range
}
Checks if the specified balance of power has a side active. Sides are defined within the balance of power. "Active" means that the side is among those that are currently visible instead of relying on the current value. 1.12
has_power_balance_modifier id = <bop ID>
The balance to check in.

modifier = <modifier ID>
The static modifier.

has_power_balance_modifier = {
    id = TAG_my_bop
    modifier = TAG_my_bop_modifier
}
Checks if the current scope's balance of power value activates a modifier. BoP modifiers are defined within /Hearts of Iron IV/common/modifiers/*.txt files, while they're activated in the balance of power definition. 1.12

Buildings

Building-related country-scoped triggers:
Name Parameters Examples Description Notes Version Added
<building> (building_count_trigger) <int>
The amount of the specified building to to check for.
arms_factory > 10
Checks if the current scope has the specified amount of the specified building. Must use either > or < operators. Works in the state scope as well, unlike the other triggers. 1.0
num_of_military_factories <int>
The amount to check for.
num_of_military_factories > 10
Checks if the current scope has the specified amount of military factories. Must use either > or < operators. 1.0
num_of_civilian_factories <int>
The amount to check for.
num_of_civilian_factories > 10
Checks if the current scope has the specified amount of civilian factories. Must use either > or < operators. 1.0
num_of_naval_factories <int>
The amount to check for.
num_of_naval_factories > 10
Checks if the current scope has the specified amount of dockyards. Must use either > or < operators. 1.0
num_of_available_military_factories <int>
The amount to check for.
num_of_available_military_factories > 10
Checks if the current scope has the specified amount of available military factories. Must use either > or < operators. 1.0
num_of_available_civilian_factories <int>
The amount to check for.
num_of_available_civilian_factories > 10
Checks if the current scope has the specified amount of available civilian factories. Must use either > or < operators. 1.0
num_of_available_naval_factories <int>
The amount to check for.
num_of_available_naval_factories > 10
Checks if the current scope has the specified amount of available dockyards. Must use either > or < operators. 1.0
num_of_factories <int>
The amount to check for.
num_of_factories > 10
Checks if the current scope has the specified amount of military, civilian or dockyard factories. Must use either > or < operators. 1.0
num_of_controlled_factories <int>
The amount to check for.
num_of_controlled_factories > 10
Checks if the current scope has the specified amount of military, civilian or dockyard factories under control. Must use either > or < operators. 1.11
num_of_owned_factories <int>
The amount to check for.
num_of_owned_factories > 10
Checks if the current scope has the specified amount of military, civilian or dockyard factories under owned states. Must use either > or < operators. 1.11
num_of_civilian_factories_available_for_projects <int>
The amount to check for.
num_of_civilian_factories_available_for_projects > 10
Checks if the current scope has the specified amount of civilian factories usable for projects. Must use either > or < operators. 1.5
ic_ratio tag = <scope>
The country to check.

ratio = <float>
The ratio to check for.

ic_ratio = {
    tag = GER
    ratio > 0.5
}
Checks if the current scope has the specified ratio of factories with the target country. Must use either > or < operators for ratio. 1.0
has_damaged_buildings <bool>
Boolean.
has_damaged_buildings = yes
Checks if the current scope has any damanged buildings in their states. 1.0
has_built type = <building>
The building to check for.

value = <int>
The amount to check for.

has_built = {
    type = arms_factory
    value > 10
}
Checks if the current scope has built the specified building the specified number of times. Must use either > or < operators for value. 1.0

Technology

Technology-related country-scoped triggers:
Name Parameters Examples Description Notes Version Added
has_tech <string>
The technology to check for.
has_tech = my_technology
Checks if the current scope has the specified technology. 1.0
is_researching_technology <string>
The technology to check for.
is_researching_technology = my_tech
Checks if the current scope is currently researching the specified technology. 1.0
can_research <string>
The technology to check for.
can_research = my_tech
Checks if the current scope can start researching the specified technology. 1.0
original_research_slots <int>
The amount to check for.
original_research_slots > 3
Checks if the current scope had the specified amount of slots at game start. Must use either > or < operators. 1.0
amount_research_slots <int>
The amount to check for.
amount_research_slots > 3
Checks if the current scope has the specified amount of research slots. Must use either > or < operators. 1.3
is_in_tech_sharing_group <string>
The group to check for.
is_in_tech_sharing_group = us_research
Checks if the current scope is in the specified technology sharing group. 1.3
num_tech_sharing_groups <int>
The amount to check for.
num_tech_sharing_groups > 3
Checks if the current scope is in the specified amount of technology sharing groups. Must use either > or < operators. 1.3
has_tech_bonus technology = <string>
The technology to check for. Optional.

category = <string>
The category to check for. Optional.

has_tech_bonus = {
    technology = my_tech
}
has_tech_bonus = {
    category = my_category
}
Checks if the current scope has a technology bonus in the specified category, or for the specific technology. 1.3
land_doctrine_level <int>
The amount to check for.
land_doctrine_level > 2
Checks if the current scope has the specified amount of land doctrine technologies. Must use either > or < operators. 1.0
num_researched_technologies <int>
The amount to check for.
num_researched_technologies > 10
Checks how many technologies the target has researched. Must use either > or < operators. 1.3

Ideas

Idea-related country-scoped triggers:
Name Parameters Examples Description Notes Version Added
has_idea <string>
The idea to check for.
has_idea = my_idea
Checks if the current scope has the specified idea.
has_idea_with_trait <string>
The trait to check for.
has_idea_with_trait = my_trait
Checks if the current scope has any ideas with the specified trait. 1.0
has_allowed_idea_with_traits idea = <string>
The trait to check for.

limit = <int>
The amount to check for.
characters = <bool>
If set, will only run this on characters.
ignore = { <ideas> }
If set, ignores the ideas inside. Optional.

has_available_idea_with_traits = {
    idea = my_trait
    limit = 1
    ignore = { generic_head_of_intelligence }
}
Checks if the current scope has the specified amount of ideas with the specified trait. ignore = idea_name works for 1 idea. 1.9.1
has_available_idea_with_traits idea = <string>
The trait to check for.

limit = <int>
The amount to check for.
characters = <bool>
If set, will only run this on characters.
ignore = { <ideas> }
If set, ignores the ideas inside. Optional.

has_available_idea_with_traits = {
    idea = my_trait
    limit = 1
    ignore = { generic_head_of_intelligence }
}
Checks if the current scope has the specified amount of ideas with the specified trait. ignore = idea_name works for 1 idea. 1.0
amount_taken_ideas amount = <int>
The amount to check for.

slots = { <string> }
The slot type.

amount_taken_ideas = {
    amount > 3
    slots = {
        political_advisor
    }
}
Checks if the current scope has the specified amount of ideas of the specified slot type. Excludes spirits, hidden ideas, and laws. Slots types are found in /Hearts of Iron IV/common/idea_tags/*.txt. 1.4

Diplomacy

Diplomatic country-scoped triggers:
Name Parameters Examples Description Notes Version Added
is_major <bool>
Boolean.
is_major = yes
Checks if the current scope is considered a Major. 1.0
is_ally_with <scope> / <variable>
The country to check for.
is_ally_with = GER
is_ally_with = var:country
Checks if the current scope is an ally (Faction members or subject-master relation). 1.0
is_in_faction_with <scope> / <variable>
The country to check for.
is_in_faction_with = GER
is_in_faction_with = var:country
Checks if the current scope is in a faction with the specified country. 1.0
is_in_faction <bool>
Boolean.
is_in_faction = yes
Checks if the current scope is in a faction. 1.0
is_faction_leader <bool>
Boolean.
is_faction_leader = yes
Checks if the current scope is the leader of a faction. 1.0
is_spymaster <bool>
Boolean.
is_spymaster = yes
Checks if the current scope is the spymaster of a faction. 1.9
num_faction_members <int>
The amount to check for.
num_faction_members > 1
Checks if the faction of the current scope has the specified amount of members. Must use either > or < operators. 1.0
has_non_aggression_pact_with <scope> / <variable>
The country to check for.
has_non_aggression_pact_with = GER
Checks if the current scope has a non-aggression pact with the specified country. 1.0
is_guaranteed_by <scope> / <variable>
The country to check for.
is_guaranteed_by = GER
Checks if the current scope has been guaranteed by the specified country. 1.0
has_guaranteed <scope> / <variable>
The country to check for.
has_guaranteed = GER
Checks if the current scope has guaranteed the specified country. 1.0
has_military_access_to <scope> / <variable>
The country to check for.
has_military_access_to = GER
Checks if the current scope has military access to the specified country. 1.0
gives_military_access_to <scope> / <variable>
The country to check for.
gives_military_access_to = GER
Checks if the current scope gives military to the specified country. 1.0
is_neighbor_of <scope> / <variable>
The country to check for.
is_neighbor_of = GER
Checks if the current scope is a neighbor of the specified country. 1.0
is_owner_neighbor_of <scope> / <variable>
The country to check for.
is_owner_neighbor_of = GER
Checks if the current scope is a neighbor of the specified country with their core territory only. 1.0
is_puppet_of <scope> / <variable>
The country to check for.
is_puppet_of = GER
Checks if the current scope is a puppet of the specified country. A "puppet" is an autonomous state that has is_puppet = yes in its definition within /Hearts of Iron IV/common/autonomous_states/. For any subject type, see is_subject_of. 1.0
is_subject_of <scope> / <variable>
The country to check for.
is_subject_of = GER
Checks if the current scope is a subject of the specified scope. 1.0
is_puppet <bool>
Boolean.
is_puppet = yes
Returns true if the current country is a puppet. A "puppet" is an autonomous state that has is_puppet = yes in its definition within /Hearts of Iron IV/common/autonomous_states/. For any subject type, see is_subject. 1.0
is_subject <bool>
Boolean.
is_subject = yes
Checks if the current scope is a subject. 1.0
has_subject <bool>
Boolean.
has_subject = GRE
Checks if the country has for subject the given country. 1.0
num_subjects <int>
The amount to check for.
num_subjects > 3
Checks if the current scope has the specified amount of subjects. Must use either > or < operators. 1.3
has_autonomy_state <string>
The autonomy state to check for.
has_autonomy_state = autonomy_dominion
Checks if the current scope is in the specified autonomous state. 1.0
compare_autonomy_state <string>
The autonomy state to check for.
compare_autonomy_state > autonomy_dominion
Checks if the current scope's autonomy state min_freedom_level is less or greater than that of the specified autonomy state. The special value "autonomy_free" compares as greater than any autonomy state. If the current scope is not a subject, it is treated as greater than any autonomy state (including "autonomy_free"). With =, checks if the current scope is in the specified autonomous state. 1.0
compare_autonomy_progress_ratio <float>
The amount to check for.
compare_autonomy_progress_ratio > 0.5
Checks if the current scope autonomy progress is at the specified ratio. If the current scope is not a subject, the ratio is 1. 1.3
has_opinion_modifier <string>
The opinion modifier to check for.
has_opinion_modifier = my_modifier
Checks if the current scope has the specified opinion modifier. 1.0
has_opinion target = <scope>
The country to check for.

value = <float>
The amount to check for.

has_opinion = {
    target = GER
    value > 50
}
Checks if the current scope has the specified opinion with the specified country. Must use either > or < operators. 1.0
has_relation_modifier target = <scope>
The country to check for.

modifier = <modifier>
The modifier to check for.

has_relation_modifier = {
    target = GER
    modifier = my_modifier
}
Checks if the current scope has the specified relation modifier with the specified country. 1.0
has_legitimacy <int>
Amount to check.
has_legitimacy > 50
Checks how much legitimacy the current government in exile has. Must use either > or < operators. Legitimacy ranges from 0 to 100. 1.6
is_exile_host <bool>
Boolean.
is_exile_host = yes
Checks if the current country is hosting an exile. 1.6
is_hosting_exile <tag>
Country.
is_hosting_exile = POL
Checks if the current country is hosting a specific exile. 1.6
is_government_in_exile <bool>
Boolean.
is_government_in_exile = yes
Checks if the current country is exiled in a different country. 1.6
is_exiled_in <tag>
Country to be exiled in.
is_exiled_in = POL
Checks if the current country is exiled in a specific country. 1.6
received_expeditionary_forces sender = <tag>
Country which sent forces.

value <> <int>
Amount of forces.

received_expeditionary_forces = {
    sender = POL
    value > 10
}
Checks if the current country received X units in expeditions from the specified country. 1.6
can_declare_war_on <tag>
Country to check.
can_declare_war_on = POL
Checks if the current scope is able to declare war on the specified country. 1.9
foreign_manpower <int>
Amount to check.
foreign_manpower > 10000
Checks how much foreign manpower we have received for garrisoning. Must use either > or < operators. 1.9
is_embargoed_by <scope>
Amount to check.
is_embargoed_by = USA
Checks if the current scope is embargoed by the specified country. 1.12
is_embargoing <scope>
Amount to check.
is_embargoing = CUB
Checks if the current scope is embargoing the specified country. 1.12

War

War-related country-scoped triggers:
Name Parameters Examples Description Notes Version Added
has_war <bool>
Boolean.
has_war = yes
Checks if the current scope is at war. 1.0
has_war_with <scope> / <variable>
The country to check for.
has_war_with = GER
has_war_with = var:country
Checks if the current scope is at war with the specified country. 1.0
has_offensive_war_with <scope> / <variable>
The country to check for.
has_offensive_war_with = GER
Checks if the current scope is in an offensive war against the specified country. 1.0
has_defensive_war_with <scope> / <variable>
The country to check for.
has_defensive_war_with = GER
Checks if the current scope is in an defensive war against the specified country. 1.0
has_offensive_war <bool>
Boolean.
has_offensive_war = yes
Checks if the current scope is in an offensive war. 1.0
has_defensive_war <bool>
Boolean.
has_defensive_war = yes
Checks if the current scope is in a defensive war. 1.0
has_war_together_with <scope> / <variable>
The country to check for.
has_war_together_with = GER
Checks if the current scope is in a war alongside the specified country. 1.0
has_war_with_major <bool>
Boolean.
has_war_with_major = yes
Checks if the current scope is at war with any other country that is considered major. 1.12
has_war_with_wargoal_against target = <scope> / <variable>
The country to check for.

type = <wargoal>
The wargoal to check for. Optional.

has_war_with_wargoal_against = {
    target = ENG
    type = independence_wargoal
}
Checks if the current scope is at war with the specified country with the specified wargoal being active. Wargoals are stored within /Hearts of Iron IV/common/wargoals/*.txt files. If no wargoal is specified, checks for any wargoal. Joining an ally in their war does not count as a wargoal. 1.12
surrender_progress <float> / <variable>
The amount to check for.
surrender_progress > 0.1
Checks if the current scope has the specified amount of surrender progress. Must use either > or < operators. 1.0
any_war_score <float>
The amount to check for.
any_war_score > 10
Checks if the current scope has the specified amount of war progress (not war participation)[2] in any war. Must use either > or < operators. 1.0
has_capitulated <bool>
Boolean.
has_capitulated = yes
Checks if the current scope has capitulated. 1.0
days_since_capitulated <int>
Amount of days.
days_since_capitulated > 10
Checks the amount of days since the target last capitulated. If the target never capitulated, the amount of days is extremely large. Recommended to combine with has_capitulated. 1.9
has_border_war_with <scope> / <variable>
The country to check for.
has_border_war_with = GER
Checks if the current scope has a border war with the specified country. 1.5
has_border_war_between attacker = <scope> / <variable>
The state to check for.

defender = <scope> / <variable>
The state to check for.

has_border_war_between = {
    attacker = 1
    defender = 2
}
Checks if there is a border war between the two specified states. 1.5
has_border_war <bool>
Boolean.
has_border_war = yes
Checks if the current scope has a border war active. 1.5
has_added_tension_amount <float> / <variable>
The amount to check for.
has_added_tension_amount > 10
Checks if the current scope has caused the specified amount of World Tension. Must use either > or < operators. 1.0
has_wargoal_against <scope> / <variable>
The country to check for.
has_wargoal_against = GER
Checks if the current scope has any wargoal against the specified country. 1.0
has_wargoal_against target = <scope> / <variable>
The country to check for.

type = <string>
The type of wargoal to check for.

has_wargoal_against = {
    target = FROM
    type = take_state
}
Checks if the current scope has a specific wargoal type against the specified country. 1.8
is_justifying_wargoal_against <scope> / <variable>
The country to check for.
is_justifying_wargoal_against = GER
Checks if the current scope is justifying a wargoal against the specified country. 1.0
has_annex_war_goal <scope> / <variable>
The country to check for.
has_annex_war_goal = GER
Checks if the current scope has the Annex wargoal against the specified country. 1.0
any_claim <bool>
Boolean.
any_claim = yes
Checks if the current scope has any claims on another country. 1.0
is_in_peace_conference <bool>
Boolean.
is_in_peace_conference = yes
Checks if the current scope is in a peace conference. Please test this in-game for 1.12. 1.0
controls_province <id>
The province to check for.
controls_province = 1239
Checks if the current scope has control of the specified province. 1.9
longest_war_length <int>
Amount of months.
longest_war_length > 3
Checks how long a country has been at war, in months. 1.14
war_length_with tag = <scope> / <variable>
Target country

months = <int>
Amounth of months

war_length_with = {
    tag = GER
    months > 3
}
Checks how long a country has been at war with specific country, in months. 1.14

State

These are state-related triggers in the country scope, not state-scoped triggers.

State-related country-scoped triggers:
Name Parameters Examples Description Notes Version Added
controls_state <scope> / <variable>
The state to check for.
controls_state = 39
controls_state = var:state
Checks if the current scope has control of the specified state. 1.0
owns_state <scope> / <variable>
The state to check for.
owns_state = 39
Checks if the current scope owns the specified state. 1.0
num_of_controlled_states <int>
The amount to check for.
num_of_controlled_states > 5
Checks if the current scope has the specified amount of controlled states. Must use either > or < operators. 1.0
num_occupied_states <int>
The amount to check for.
num_occupied_states > 5
Checks if the current scope has the specified amount of occupied states. Must use either > or < operators. 1.0
has_full_control_of_state <scope> / <variable>
The state to check for.
has_full_control_of_state = 39
Checks if the current scope has total control (100% occupation) of the specified state. 1.3
core_compliance occupied_country_tag = <TAG>
The country for which to check compliance.

value = <int>
The value to check for.

core_compliance = {
    occupied_country_tag = ITA
    value > 10
}
Compares the average compliance of core states of the specified country within controlled states of the current scope. Must use either > or < operators for value. 1.9
core_resistance occupied_country_tag = <TAG>
The country for which to check resistance.

value = <int>
The value to check for.

core_resistance = {
    occupied_country_tag = ITA
    value > 10
}
Compares the average resistance of core states of the specified country within controlled states of the current scope. Must use either > or < operators for value. 1.9
garrison_manpower_need <int>
Amount to check.
garrison_manpower_need > 10000
Checks how much garrison manpower we need for resistance in controlled states. Must use either > or < operators. 1.9
has_core_occupation_modifier occupied_country_tag = <scope> / <variable>
The country to check.

modifier = <token>The modifier to check.

has_core_occupation_modifier = { occupied_country_tag = ITA modifier = token }
Checks if the current scope has an occupation modifier for resistance/compliance that applies to our occupied states of a specified country. 1.9
occupation_law <law ID>
The law to check.
POL = { POL = { occupation_law = brutally_oppressive_occupation } }   # Checks POL's default occupation law
HOL = { BEL = { occupation_law = foreign_civilian_oversight } }  # Checks HOL's occupation law over BEL
Checks the occupation law that's either the default or applied over a specific country. Checks PREV's occupation law over the current country. If they're the same scope, checks the default occupation law. 1.12

Military

Military-related country-scoped triggers:
Name Parameters Examples Description Notes Version Added
has_army_experience <float> / <variable>
The amount to check for.
has_army_experience > 10
has_army_experience > var:number
Checks if the current scope has the specified amount of Army experience. Must use either > or < operators as = operator checks for the exact value 1.3
has_air_experience <float> / <variable>
The amount to check for.
has_air_experience > 10
Checks if the current scope has the specified amount of Air experience. Must use either > or < operators as = operator checks for the exact value 1.3
has_navy_experience <float> / <variable>
The amount to check for.
has_navy_experience < 10
Checks if the current scope has the specified amount of Navy experience. Must use either > or < operators as = operator checks for the exact value 1.3
has_manpower <float> / <variable>
The amount to check for.
has_manpower > 1000
Checks if the current scope has the specified amount of manpower. Must use either > or < operators as = operator checks for the exact value 1.0
has_army_manpower size = <int>
The amount to check for.
has_army_manpower = {
    size > 1000
}
Checks if the current scope has an army using the specified amount of manpower. Must use either > or < operators. 1.0
manpower_per_military_factory <float>
The amount to check for.
manpower_per_military_factory > 1000
Checks if the current scope has the specified manpower times their number of military factories. Must use either > or < operators. 1.0
conscription_ratio <float> / <variable>
The ratio to compare with.
conscription_ratio < 0.2
Checks if the current scope has the specified conscription ratio currently, not to be mixed up with the target conscription ratio. Must use either > or < operators as = operator checks for the exact value 1.9
current_conscription_amount <float> / <variable>
The amount to compare with.
current_conscription_amount > 2000
Checks if the current scope has already conscripted that much manpower. Must use either > or < operators as = operator checks for the exact value 1.9
target_conscription_amount <float> / <variable>
The amount to compare with.
target_conscription_amount > 2000
Checks if the current scope is targeting to conscript that much manpower. Must use either > or < operators as = operator checks for the exact value 1.9
num_divisions <int>
The amount to check for.
num_divisions > 5
Checks if the current scope has the specified amount of divisions. Must use either > or < operators. 1.3
num_of_nukes <int>
The amount to check for.
num_of_nukes > 5
Checks if the current scope has the specified amount of nukes. Must use either > or < operators. 1.0
casualties <int>
The amount to check for.
casualties > 10000
Checks if the current scope has suffered the specified amount of casualties. Must use either > or < operators. 1.0
casualties_k <int>
The amount to check for.
casualties_k > 10
Checks if the current scope has suffered the specified amount of casualties in thousands. Must use either > or < operators. 1.0
casualties_inflicted_by opponent = <tag>
The tag that inflicted the casualties.

thousands <> <int>
The amount of casualties in thousands.

casualties_inflicted_by = {
    opponent = POL
    thousands > 10
}
Checks if the current scope has suffered the specified amount of casualties in thousands from a specific country. Must use either > or < operators for thousands. 1.6
amount_manpower_in_deployment_queue <float>
The amount to check for.
amount_manpower_in_deployment_queue > 1000
Checks if the current scope has the specified amount of manpower in their deployment queue. Must use either > or < operators. 1.5
has_attache_from <scope> / <variable>
The country to check for.
has_attache_from = GER
Checks if the current scope has an attache from the specified scope. 1.5
has_attache <bool>
Boolean.
has_attache = yes
Checks if the current scope has an attache. 1.5
is_lend_leasing <scope> / <variable>
The country to check for.
is_lend_leasing = GER
Checks if the current scope is lend leasing to the specified scope. 1.0
has_template <string>
The name of the template.
has_template = "Infantry Division"
Checks if the current scope has a division template of the specified name. 1.0
has_template_majority_unit <string>
The unit to check for.
has_template_majority_unit = infantry
Checks if the current scope has a division template composed mostly of the specified unit. 1.0
has_template_containing_unit <string>
The name of the unit.
has_template_containing_unit = light_armor
Checks if the current scope has a division template contained any of the specified unit. 1.0
strength_ratio tag = <scope>
The country to check for.

ratio <> <float>
The ratio to check for.

strength_ratio = {
    tag = GER
    ratio > 1
}
Checks if the current scope has the specified strength ratio against the specified country. The ratio is the number of fielded divisions of the current scope divided by those of tag (or 1 if tag has no divisions). The ratio gets increased by 10% if the current scope has a stronger air forces.[3] Must use > or < in the ratio. 1.0
alliance_strength_ratio <float> / <variable>
The ratio to check for.
alliance_strength_ratio > 0.5
Checks if the current scope and allies has an army strength higher than the specified ratio against estimated enemy strength. Must use either > or < operators. 1.0
alliance_naval_strength_ratio <float> / <variable>
The ratio to check for.
alliance_naval_strength_ratio > 0.5
Checks if the current scope and allies has an naval strength ratio higher than the specified ratio against estimated enemy strength. Must use either > or < operators. 1.0
enemies_strength_ratio <float> / <variable>
The ratio to check for.
enemies_strength_ratio > 0.5
Checks if the estimated enemy army strength ratio is higher than the specified ratio. Must use either > or < operators. 1.0
enemies_naval_strength_ratio <float> / <variable>
The ratio to check for.
enemies_naval_strength_ratio > 0.5
Checks if the estimated enemy naval strength ratio is higher than the specified ratio. Must use either > or < operators. 1.0
has_army_size size = <float>
The amount to check for.

type = <string>
The battalion type to check for. Divisions that are majority made up of battalions in that type count. Optional, counts all divisions by default.

has_army_size = {
    size > 10
    type = armor
}
Checks if the current scope has the specified number of divisions, or of a specified type of division. Battalion types are defined within /Hearts of Iron IV/common/units/*.txt files. Must use either > or < operators for size. 1.0
has_navy_size size = <float>/<variable>
The amount to check for.

type = <string>
The type to check for. Optional.
archetype = <string>
The ship archetype to check for. Optional.

has_navy_size = {
    size > 10
    type = capital_ship
    archetype = ship_hull_heavy
}
Checks if the current scope has the specified number of ships, or of a specified type of ship. Ship types are defined within /Hearts of Iron IV/common/units/*.txt files. Must use either > or < operators for size. Ship archetypes are found in /Hearts of Iron IV/common/units/equipment/*.txt files. 1.0
has_deployed_air_force_size size = <float>
The amount to check for.

type = <string>
The type to check for. Optional.

has_deployed_air_force_size = {
    size > 10
    type = cas
}
Checks if the current scope has the specified number of aircraft, or of a specified type of aircraft. Airwing types are defined within /Hearts of Iron IV/common/units/*.txt files. Must use either > or < operators for size. 1.0
divisions_in_state size = <float>
The amount to check for.

type = <string>
The battalion type to check for. Divisions that are majority made up of battalions in that type count. Optional, counts all divisions by default.
unit = <string>
The exact battalion to check for. Divisions that are majority made up of that battalions count. Optional, counts all divisions by default.
state = <scope> / <variable>
The state to check in.

divisions_in_state = {
    type = armor
    size > 10
    state = 49
}
Checks if the specified state contains the specified amount of divisions. Battalions and their types are defined within /Hearts of Iron IV/common/units/*.txt files. Must use either > or < operators for size. 1.0
army_manpower_in_state amount <> <float>
The amount to check for.

type = <string>
The type to check for. Optional.
state = <scope> / <variable>
The state to check in.

army_manpower_in_state = {
    type = support
    amount > 10000
    state = 49
}
Checks if the specified state contains the specified amount of army manpower within the state. Battalion types are defined within /Hearts of Iron IV/common/units/*.txt files. Must use either > or < operators for size. 1.6
divisions_in_border_state size = <float>
The amount to check for.

type = <string>
The battalion type to check for. Divisions that are majority made up of battalions in that type count. Optional, counts all divisions by default.
state = <scope> / <variable>
The state to check in.
border_state = <scope> / <variable>
The border state to check in.

divisions_in_border_state = {
    type = infantry
    size > 10
    state = 49
    border_state = var:state
}
Checks if the border provinces between the specified state and border state contain the specified amount of divisions. Battalion types are defined within /Hearts of Iron IV/common/units/*.txt files. Must use either > or < operators for size. 1.5
num_divisions_in_states count = <int>
The amount to check for.

states = { <int> <...> <int> }
The states to check in.
types = { <string> <...> <string> }
The battalion types to check for. Divisions that are majority made up of battalions in that type count. Optional, counts all divisions by default.
exclude = { <string> <...> <string> }
The sub-units to exclude from the search. Divisions that are majority made up of specified battalions are excluded. Optional, excludes no divisions by default.

num_divisions_in_states = {
    count > 24
    states = { 550 559 271 }
    exclude = { irregular_infantry }
}
Checks if the specified states contain enough divisions of the specified types. Divisions and their types are defined within /Hearts of Iron IV/common/units/*.txt files. Can use either =, >, or < operators for count. The tooltip does not specify the states the check runs for nor the filtered types. 1.12
num_battalions_in_states count = <int>
The amount to check for.

states = { <int> <...> <int> }
The states to check in.
types = { <string> <...> <string> }
The battalion types to check for.
exclude = { <string> <...> <string> }
The sub-units to exclude from the search.

num_battalions_in_states = {
    count > 24
    states = { 550 559 271 }
    exclude = { irregular_infantry }
}
Checks if the specified states contain enough battalions (or sub-units) of the specified types. Battalions and their types are defined within /Hearts of Iron IV/common/units/*.txt files. Can use either =, >, or < operators for count. The tooltip does not specify the states the check runs for nor the filtered types. 1.12
ships_in_state_ports size = <float>
The amount to check for.

type = <string>
The type to check for. Optional.
state = <scope> / <variable>
The state to check in.

ships_in_state_ports = {
    type = capital_ship
    size > 10
    state = 49
}
Checks if the specified state contains the specified amount of ships, or of ships of the specified type. Ship types are defined within /Hearts of Iron IV/common/units/*.txt files. Must use either > or < operators for size. 1.0
num_planes_stationed_in_regions value = <float>
The amount to check for.

regions = { <id> <...> <id> }
The regions to check in.

num_planes_stationed_in_regions = {
    value > 10
    regions = { 123 321 }
}
Checks if the current scope has the specified number of aircraft stationed within strategic regions. Must use either =, >, or < operators for value. 1.12
has_volunteers_amount_from tag = <scope>
The country to check for.

count = <int>
The amount to check for.

has_volunteers_amount_from = {
    tag = GER
    count > 10
}
Checks if the current scope has recieved volunteers from the specified country of the specified amounts. Must use either > or < operators for count. 1.0
convoy_threat <float>
The threat to compate with.
convoy_threat > 0.5
Checks how much the convoys are threatened. Must use either > or < operators for count. Threat is always between 0 and 1. 1.6
has_mined target = <tag>
The country the coast of which is mined.

value <> <int>
The amount of mines to compare with.

has_mined = {
    target = POL
    value > 1000
}
Checks if the current scope has X mines on the coast of the specified country. Must use either > or < operators for value. 1.6
has_mines region = <ID>
The strategic region that contains the mines.

amount = <int>
The amount of mines to compare with.

has_mined = {
    target = POL
    amount = 1000
}
Checks if the current scope has at least X mines within the specified strategic region. 1.6
mine_threat <float>
The threat to compate with.
mine_threat < 0.6
Checks how dangerous enemy mines are. Must use either > or < operators for count. Threat is always between 0 and 1. 1.6
has_military_industrial_organization <token>
The id to check for.
has_military_industrial_organization = infantry_mio_token
Checks if the current scope has a MIO with the specified name. Accepts variables. 1.13

Equipment

Equipment-related country-scoped triggers:
Name Parameters Examples Description Notes Version Added
stockpile_ratio archetype = <string>
The equipment archetype to check for.

ratio = <float>
The ratio of equipment to check for.

stockpile_ratio = {
    archetype = infantry_equipment
    ratio > 0.5
}
Checks if the current scope has stockpiled the specified equipment to the specified ratio against fielded equipment of the same type. Must use either > or < operators for ratio.
For the convoy equipment which is not fielded as other equipments, ratio shall be not a percentage but a direct amount (for instance 256 convoys)
1.5
has_equipment <equipment> = <int> / <variable>
The equipment to check for, and the amount to check for.
has_equipment = {
    infantry_equipment_1 > 10
}
Checks if the current scope has the specified equipment to the specified amount. Must use either > or < operators. 1.0
has_any_license <bool>
Boolean.
has_any_license = yes
Checks if the current scope has any licenses from other countries. 1.0
is_licensing_any_to <scope>
The country to check for.
is_licensing_any_to = GER
Checks if the current scope is licensing to the specified scope. 1.0
is_licensing_to target = <scope>
The country to check for.

archetype = <string>
The equipment archetype to check for. Optional.
Equipment scope
type = <string>
The equipment to check for. Optional.
version = <int>
The variant id of the equipment. Optional.

is_licensing_to = {
    target = GER
    archetype = infantry_equipment
}
is_licensing_to = {
    target = GER
    equipment = {
        type = light_tank_equipment
        version = 1
    }
}
Checks if the current scope is licensing the specified equipment to the specified country. 1.0
has_license from = <scope>
The country to check for.

archetype = <string>
The equipment archetype to check for. Optional.
Equipment scope
type = <string>
The equipment to check for. Optional.
version = <int>
The variant id of the equipment. Optional.

has_license = {
    from = GER
    archetype = infantry_equipment
}
has_license = {
    from = GER
    equipment = {
        type = light_tank_equipment
        version = 1
    }
}
Checks if the current scope has a license for the specified equipment from the specified country. 1.0
fuel_ratio <float>
The ratio to check with.
fuel_ratio > 0.4
Checks the fuel ratio of the country. Must use either < or > operators. 1.6
has_fuel <int>
The amount to compare with.
has_fuel > 400
Checks the fuel amount of the country. Must use either < or > operators. 1.6
has_design_based_on <archetype>
The equipment archetype.
has_design_based_on = light_tank_chassis
Checks if the country has a builtable non-obsolete design based on the specified equipment archetype. Equipment archetypes can be seen in /Hearts of Iron IV/common/units/equipment/*. 1.11

Intelligence

Intelligence-related country-scoped triggers:
Name Parameters Examples Description Notes Version Added
estimated_intel_max_piercing tag = <scope>
The country to check for.

value = <float>
The amount to check for.

estimated_intel_max_piercing = {
    tag = GER
    value > 0.5
}
Checks if the specified scope has the specified amount of piercing based on the current scope's intel. Must use either > or < operators for value. 1.0
estimated_intel_max_armor tag = <scope>
The country to check for.

value = <float>
The amount to check for.

estimated_intel_max_armor = {
    tag = GER
    value > 0.5
}
Checks if the specified scope has the specified amount of armor based on the current scope's intel. Must use either > or < operators for value. 1.0
compare_intel_with target = <tag>
The target to compare with.

civilian_intel <>= <float>
Comparison of civilian intel.
army_intel <>= <float>
Comparison of army intel.
navy_intel <>= <float>
Comparison of navy intel.
airforce_intel <>= <float>
Comparison of airforce intel.

compare_intel_with = { 
    target = POL 
    civilian_intel > 0.5
    army_intel = 0
    navy_intel < 0
}
Compares intel between 2 countries. Can use < (in which case the current country has x less intel), >, and = (in which case it must be equal). 1.9
intel_level_over target = <tag>
The target to compare with.

civilian_intel <>= <float>
Comparison of civilian intel.
army_intel <>= <float>
Comparison of army intel.
navy_intel <>= <float>
Comparison of navy intel.
airforce_intel <>= <float>
Comparison of airforce intel.

intel_level_over = { 
    target = POL 
    civilian_intel > 0.5
    army_intel = 0
    navy_intel < 0
}
Checks the intel level from the current country over a specified country. Can use < (in which case the current country has x less intel), >, and = (in which case it must be equal). 1.9
has_intelligence_agency <boolean>
The intelligence agency to check.
has_intelligence_agency = yes
Checks if the current scope has an intelligence agency. 1.9
network_national_coverage target = <tag>
The country which is checked.

value <> <float>
The value of network.

network_national_coverage = {
    target = POL
    value < 70
}
Checks network national coverage over a specific country. Must use < or > for value.
network_strength target = <tag>
The country which is checked.

state = <id>
The state which is checked.
value <> <float>
The strength of network.

network_strength = {
    target = POL
    value < 70
}
Checks network national coverage over a specific country. Must use < or > for value. Can use either or both of target and state. 1.9
has_done_agency_upgrade <string>
The agency upgrade to check.
has_done_agency_upgrade = upgrade_army_department
Checks if the current scope has the specified agency upgrade (to its highest level). 1.9
agency_upgrade_number <int>
The amount of agency upgrades to check for.
agency_upgrade_number > 4
Checks the number of upgrades done in the current scope's intelligence agency. Must use either > or < operators. 1.9
decryption_progress target = <tag>
The country to compare with.

value <> <float>
The value to compare.

decryption_progress = {
    target = POL
    value < 0.5
}
Checks the decryption progress towards a country. Must use either > or < operators for value. 1.9
has_captured_operative <tag>/<bool>
Country whose operative was captured/Whether an operative was captured.
has_captured_operative = POL
has_captured_operative = yes
Checks if the current scope has captured an operative. 1.9
has_finished_collecting_for_operation target = <tag>
Country towards whom the operation is targeted.

operation = <token>
The operation which current scope is planning against the target.

has_finished_collecting_for_operation = {
    target = POL
    operation = operation_infiltrate_armed_forces_navy
}
Checks if the current scope has finished collecting resources for an operation. 1.9
is_preparing_operation target = <tag>
Country towards whom the operation is targeted.

operation = <token>
The operation which current scope is planning against the target. Optional.

is_preparing_operation = {
    target = POL
    operation = operation_infiltrate_armed_forces_navy
}
Checks if the current scope is preparing an operation against the specified country. 1.9
is_running_operation target = <tag>
Country towards whom the operation is targeted.

operation = <token>
The operation which current scope is planning against the target. Optional.

is_running_operation = {
    target = POL
    operation = operation_infiltrate_armed_forces_navy
}
Checks if the current scope is running an operation against the specified country. 1.9
num_finished_operations target = <tag>
Country towards whom the operation is targeted.

operation = <token>
The operation which current scope is planning against the target. Optional.

num_finished_operations = {
    target = POL
    operation = operation_infiltrate_armed_forces_navy
}
Checks how many finished operations the current scope had against the specified country. 1.9
has_operation_token tag = <tag>
Country towards whom the operation is targeted.

token = <token>
The operation token.

has_operation_token = {
    tag = POL
    token = token_name
}
Checks if the current scope has an operation token against an another country. 1.9
is_active_decryption_bonuses_enabled <tag>
The country towards which the bonus is enabled.
is_active_decryption_bonuses_enabled = POL
Checks if the current scope has any decryption bonuses towards the specified country. 1.9
is_cryptology_department_active <bool>
Boolean.
is_cryptology_department_active = yes
Checks if the current scope has a cryptology department active. 1.9
is_decrypting <tag>
The country which is decrypted.
is_decrypting = POL
Checks if the current scope is decrypting a certain country. 1.9
is_fully_decrypted <tag>
The country which is decrypted.
is_fully_decrypted = POL
Checks if the current scope has fully decrypted a certain country. 1.9
num_fake_intel_divisions <int>
Amount of divisions.
num_fake_intel_divisions > 10
Checks the amount of fake intel divisions. Must use either < or >. 1.9
num_free_operative_slots <int>
Amount of slots.
num_free_operative_slots > 2
Checks the amount of free operative slots. Must use either < or >. 1.9
num_operative_slots <int>
Amount of slots.
num_operative_slots > 2
Checks the amount of operative slots. Must use either < or >. 1.9
num_of_operatives <int>
Amount of operatives.
num_of_operatives > 2
Checks the amount of operatives. Must use either < or >. 1.9

AI

AI-related country-scoped triggers:
Name Parameters Examples Description Notes Version Added
ai_irrationality <int>
The amount to check for.
ai_irrationality > 10
Checks if the current scope AI has the specified irrationality. Must use either > or < operators. 1.0
ai_liberate_desire target = <scope>
The country to check for.

count = <float>
The amount to check for.

ai_liberate_desire = {
    target = GER
    count > 1
}
Checks if the current scope AI has the specified liberation desire towards the specified country. Must use either > or < operators for count. 1.0
ai_has_role_division <string>
The role to check for.
ai_has_role_division = infantry
Checks if the current scope AI has a division with the specified role. Roles are defined in /Hearts of Iron IV/common/ai_templates/*.txt 1.0
ai_has_role_template <string>
The role to check for.
ai_has_role_template = armor
Checks if the current scope AI has a division template with the specified role. Roles are defined in /Hearts of Iron IV/common/ai_templates/*.txt 1.0
ai_wants_divisions <int>
The amount to check for.
ai_wants_divisions > 10
Checks if the current scope AI desires the specified amount of divisions. Must use either > or < operators. 1.0
has_template_ai_majority_unit <string>
The unit to check for.
has_template_ai_majority_unit = infantry
Checks if the current scope AI has a division template mostly made up of the specified unit. 1.0

Characters

These are character-related triggers in the country scope, not character-scoped triggers.

Character-related country-scoped triggers:
Name Parameters Examples Description Notes Version Added
can_be_country_leader <character>
The character to check.
can_be_country_leader = POL_character_test
Checks if the specified character has a country leader role, active or not, and can utilise it in this country. 1.11
has_character <string>
The character to check.
has_character = my_character
Checks if the current scope has the specified character recruited. The character does NOT need to be in power. 1.11
has_country_leader ruling_only = <bool>(default = yes) Limit check to ruling only.

character = <character_token> (recommended criteria) The character to check for. Optional.
name = <string>
The name to check for. Optional.
id = <int>
The id to check for. Optional.

has_country_leader = {
    id = 10
}

has_country_leader = { character = SPR_niceto_alcala_zamora ruling_only = yes }

has_country_leader = {
    name = "John Smith"
    ruling_only = yes
}
Checks if the current scope has the specified country leader. 1.3
has_country_leader_ideology <ideology>

Checks the ideology of the active country leader

has_country_leader_ideology = nazism
Checks if the current scope's active country leader has the specified ideology. 1.11
has_country_leader_with_trait <string>
The trait to check.
has_country_leader_with_trait = champion_of_peace_1
Checks if the leader of the country has a specific trait. 1.6
is_female <bool>
Boolean.
is_female = yes
Checks if the current country leader is female. 1.9
has_unit_leader <int>
The id to check for.
has_unit_leader = 1
Checks if the current scope has a unit leader with the specified id. Only the legacy ID can be used, the character ID doesn't work. 1.0

Peace conferences

These are not exactly peace conference-related triggers, but those that can only be used within peace conferences.

Peace conference-only country-scoped triggers:
Name Parameters Examples Description Notes Version Added
pc_is_winner <bool>
Boolean.
pc_is_winner = yes
Checks if the current scope is a winner within the peace conference. 1.12
pc_is_on_winning_side <bool>
Boolean.
pc_is_on_winning_side = yes
Checks if the current scope is on the winning side within the peace conference. 1.12
pc_is_loser <bool>
Boolean.
pc_is_loser = yes
Checks if the current scope is a loser within the peace conference. 1.12
pc_is_untouched_loser <bool>
Boolean.
pc_is_untouched_loser = yes
Checks if the current scope is an untouched loser within the peace conference. 1.12
pc_is_on_same_side_as <scope>
Country to check for.
pc_is_on_same_side_as = BHR
Checks if the current scope is on the same side of the peace conference as the specified country. 1.12
pc_is_liberated <bool>
Boolean.
pc_is_liberated = yes
Checks if the current scope has been liberated within the peace conference. 1.12
pc_is_liberated_by <scope>
Country to check for.
pc_is_liberated_by = BHR
Checks if the current scope has been liberated within the peace conference by the specified country. 1.12
pc_is_puppeted <bool>
Boolean.
pc_is_puppeted = yes
Checks if the current scope has been puppeted within the peace conference. 1.12
pc_is_puppeted_by <scope>
Country to check for.
pc_is_puppeted_by = BHR
Checks if the current scope has been puppeted within the peace conference by the specified country. 1.12
pc_is_forced_government <bool>
Boolean.
pc_is_forced_government = yes
Checks if the current scope has had an enforced government change within the peace conference. 1.12
pc_is_forced_government_by <scope>
Country to check for.
pc_is_forced_government_by = BHR
Checks if the current scope has had an enforced government change within the peace conference demanded by the specified country. 1.12
pc_is_forced_government_to <ideology group>
Ideology group to check for.
pc_is_forced_government_to = democratic
Checks if the current scope has had an enforced government change to the specified ideology group. 1.12
pc_total_score <decimal>
Scope to check for.
pc_total_score > 2400
Checks if the current scope has the specified amount in total score within the peace conference. Can only be used for the winning countries. 1.12
pc_current_score <decimal>
Scope to check for.
pc_current_score > 100
Checks if the current scope has the specified amount in current score within the peace conference. Can only be used for the winning countries. 1.12

State scope

Can be used in state scope.

General

General state-scoped triggers:
Name Parameters Examples Description Notes Version Added
state <scope> / <variable>
The state to check for.
state = 10
state = var:state
Checks if the current scope is the specified state. 1.0
region <int>
The strategic region id to check for.
region = 10
Checks if the current scope is a state in the specified strategic region. 1.0
<building> (building_count_trigger) <int>
The amount of the specified building to check for.
arms_factory > 10
Checks if the current scope has the specified amount of the specified building. Must use either > or < operators. 1.0
free_building_slots building = <string>
The building to check for.

size = <int>
The amount to check for.
include_locked = <bool>
Whether to include locked slots.

free_building_slots = {
    building = arms_factory
    size > 10
    include_locked = yes
}
Checks if the current scope has available slots for the specified amount of buildings. Must use either > or < operators for size. 1.0
non_damaged_building_level building = <string>
The building to check for.

level = <int>
The amount to check for.

non_damaged_building_level = {
    building = arms_factory
    level > 4
}
Checks if the current scope has the specified amount of the specified buildings that are undamaged. Must use either > or < operators for level. 1.9
any_province_building_level building = <string>
The building to check for.

limit = <int>
The amount to check for.
Province scope
id = <int>
The province to check for.
limit_to_border = <bool>
Whether to limit check to border provinces.

any_province_building_level = {
    province = {
        id = 445
        id = 494
        limit_to_border = yes
    }
    building = bunker
    level < 5
}
Checks if the current scope has the specified provincal building at the specified amount in the specified provinces. Must use either > or < operators for level. 1.0
has_state_flag <string>
The flag to check for.
has_state_flag = my_flag
Checks if the current scope has the specified flag. 1.0
has_state_flag flag = <string>
The flag to check.

value = <int>
The flag value to check for. Optional.
date = <date>
The flag creation date to check for. Optional.
days = <int>
The duration the flag existed for. Optional.

has_state_flag = {
    flag = my_flag
    days > 30
    date > 1936.6.1
    value > 0
}
Compares the specified flag's last set date, days since last set, and/or value. If not set, the value comparison is >0. value is limited between -32768 and 32767. 1.0
state_population <float>
The amount to check for.
state_population > 10000
Checks if the current scope has the specified state population. Must use either > or < operators. 1.0
state_population_k <float>
The amount to check for.
state_population_k > 10
Checks if the current scope has the specified state population in thousands. Must use either > or < operators. 1.0
is_capital <bool>
Boolean.
is_capital = yes
Checks if the current scope is a capital. 1.5
is_controlled_by <scope> / <variable>
The country to check for.
is_controlled_by = GER
Checks if the current scope is controlled by the specified country. 1.0
is_fully_controlled_by <scope> / <variable>
The country to check for.
is_fully_controlled_by = GER
Checks if the current scope is fully controlled by the specified country. 1.5
is_owned_by <scope> / <variable>
The country to check for.
is_owned_by = GER
Checks if the current scope is owned by the specified country. 1.0
is_claimed_by <scope> / <variable>
The country to check for.
is_claimed_by = GER
Checks if the current scope is claimed by the specified country. 1.0
is_core_of <scope> / <variable>
The country to check for.
is_core_of = GER
Checks if the current scope is a core of the specified country. 1.0
is_owned_and_controlled_by <scope> / <variable>
The country to check for.
is_owned_and_controlled_by = GER
Checks if the current scope is owned and controlled by the specified country. 1.0
is_demilitarized_zone <bool>
Boolean.
is_demilitarized_zone = yes
Checks if the current scope is a demilitarized zone. 1.0
is_border_conflict <bool>
Boolean.
is_border_conflict = yes
Checks if the current scope is part of a border war. 1.0
is_in_home_area <bool>
Boolean.
is_in_home_area = yes
Checks if the current scope is connected to the capital state over land. The scope needs to be owned as well for the statement for it to be true. 1.0
is_coastal <bool>
Boolean.
is_coastal = yes
Checks if the current scope is a coastal state. 1.0
is_one_state_island <bool>
Boolean.
is_one_state_island = yes
Checks if the current scope is a coastal state with no adjacent land states. An adjacent land state may be connected via a naval crossing. 1.13
is_island_state <bool>
Boolean.
is_island_state = yes
Checks if the current scope is a state where every province has no land neighbour. An adjacent land division may be connected via a naval crossing. 1.0
is_on_continent <string>
The continent to check for.
is_on_continent = europe
Checks if the current scope is on the specified continent. Continents are found in /Hearts of Iron IV/map/continent.txt. 1.0
impassable <bool>
Boolean.
impassable = yes
Checks if the current scope is impassable. 1.9.1
has_state_category <string>
The category to check for.
has_state_category = rural
Checks if the current scope has the specified category. State categories are found in /Hearts of Iron IV/common/state_category/*.txt. 1.0
state_strategic_value <int>
The amount to check for.
state_strategic_value > 10
Checks if the current scope has the specified strategic value. Must use either > or < operators. 1.5
state_and_terrain_strategic_value <int>
The amount to check for.
state_and_terrain_strategic_value > 10
Checks if the current scope has the specified state and terrain strategic value. Must use either > or < operators. 1.5
num_owned_neighbour_states owner = <scope>
The country to check for.

count = <int>
The amount to check for.

num_owned_neighbour_states = {
    owner = GER
    count > 2
}
Checks if the current scope has the specified amount of neighbor states belonging to the specified country. Must use either > or < operators for count. 1.0
distance_to value = <float>
The distance to check for.

target = <scope>
The state to compare against.

distance_to = {
    value > 1000
    target = 49
}
Checks if the current scope is at the specified distance from the specified state. Must use either > or < operators for distance. 1.0
ships_in_area area = <int>
The strategic region to check for.

size = <int>
The amount to check for.

ships_in_area = { area = 104 size > 14 } 
Checks if the current scope has the specified amount of ships in the specified strategic region. Must use either > or < operators for count. 1.0
<resource> (resource_count_trigger) <int>
The amount to check for.
tungsten > 10
Checks if the current scope has the specified amount of the specified resource. Must use either > or < operators for amount.
has_resources_amount resource = <string>
The resource to check for.

amount = <int>
The amount to check for.
delivered = yes
If specified, checks the amount after the modifiers are applied rather than the base resource value.

has_resources_amount = {
    resource = oil
    amount > 10
    delivered = yes
}
Checks if the current scope has the specified amount of the specified resource. Must use either > or < operators for amount. 1.3
has_resources_rights state = <scope>
The state to check in. Mandatory if used in country scope.

receiver = <int>
The receiver of the resource rights. Mandatory if used in state scope.
resources = { <resource> <...> <resource> }
Resources to check for. Optional, defaults to any if unset.

has_resources_rights = {    # Used in country scope
    state = 123 
    resources = { oil steel }
}
has_resources_rights = {    # Used in state scope
    receiver = POL
}
Checks if there are any resource rights with the specified parameters. Can be used in either state or country scope. Always returns false if the state has no resources. 1.12
days_since_last_strategic_bombing <int>
The amount to compare with.
days_since_last_strategic_bombing < 10 
Checks how many days have passed since the last strategic bombing of the state. Must use either > or < operators. 1.6
has_railway_connection <scope> / <variable>
The states to check.

<id>

The provinces to check. Optional.

has_railway_connection = {
	start_state = 10
	target_state = 90
}

has_railway_connection = { start_province = 402 target_province = 9400 }

Returns true if the states are connected by a railway. Can also check provinces. 1.11
can_build_railway <scope> / <variable>
The states to check.

<id>

The provinces to check. Optional.

can_build_railway = {
	start_state = 10
	target_state = 90
}

can_build_railway = { start_province = 402 target_province = 9400 }

Returns true if a railway can be built between states. Can also check for provinces. 1.11
has_railway_level <scope> / <variable>
The states to check.

<int>

Railway level.

has_railway_level = {
    	state = 114
    	level = 5
}
Checks if a state contains a railway at or above the specified level. Works with level 1, 2, 3, 4 or 5. Level 0 does not work. 1.11
pc_does_state_stack_demilitarized <bool>
Boolean.
pc_does_state_stack_demilitarized = yes
Checks if the current scope was demilitarised during a current or previously-ended peace conference. 1.12
pc_does_state_stack_dismantled <bool>
Boolean.
pc_does_state_stack_dismantled = yes
Checks if the current scope was dismantled during a current or previously-ended peace conference. 1.12
pc_is_state_claimed <scope>
Country to check for.
pc_is_state_claimed = yes
Checks if the current scope was claimed by any country during the peace conference. Can only be used within peace conferences. 1.12.8
pc_is_state_claimed_by <scope>
Country to check for.
pc_is_state_claimed_by = BHR
Checks if the current scope was claimed by the specified country during the peace conference. Note, that "claim" in this context, while includes, is NOT limited to outright taking: forcing government, puppeting and liberating will render that trigger true as well. If one looks specifically for states taken by victors for themselves, pc_is_state_claimed_and_taken_by should be used. Can only be used within peace conferences. 1.12
pc_is_state_claimed_and_taken_by <scope>
Country to check for.
pc_is_state_claimed_and_taken_by = SOV
Checks if the current scope was claimed with "Take State" action (i.e. annexed) by the specified country during the peace conference. Can only be used within peace conferences.
pc_is_state_outside_influence_for_winner <scope>
Country to check for.
pc_is_state_outside_influence_for_winner = ROOT
Checks if the current state is outside of the influence of the specified winner country. Can only be used within peace conferences. Was called pc_is_state_outside_influence_for prior to 1.12.8. 1.12.8
pc_turn <int>
The amount of turns to check for.
pc_turn > 20
Compares the amount of turns that have passed during the peace conference with a number. Can only be used within peace conferences. 1.12.8

Resistance and Compliance

Resistance-related state-scoped triggers:
Name Parameters Examples Description Notes Version Added
compliance <int>
The amount to compare with.
compliance > 50
Compares the compliance value of the current scope with the given value. Must use either > or < operators. 1.9
compliance_speed <int>
The amount to compare with.
compliance_speed > 50
Compares the compliance speed of the current scope with the given value. Must use either > or < operators. 1.9
has_active_resistance <bool>
Boolean.
has_active_resistance = yes
Checks if the current scope has non-zero resistance. 1.9
has_resistance <bool>
Boolean.
has_resistance = yes
Checks if the current scope has resistance. 1.9
resistance <int>
The amount to compare with.
resistance > 50
Compares the resistance value of the current scope with the given value. Must use either > or < operators. 1.9
resistance_speed <int>
The amount to compare with.
resistance_speed > 50
Compares the resistance speed of the current scope with the given value. Must use either > or < operators. 1.9
resistance_target <int>
The amount to compare with.
resistance_target > 50
Compares the target resistance value of the current scope with the given value. Must use either > or < operators. 1.9
has_occupation_modifier <token>
The occupation modifier to check.
has_occupation_modifier = modifier_name
Checks if the current scope has an occupation modifier, changing resistance/compliance. 1.9
occupation_law <token>
The occupation law to check.
occupation_law = law_name
Checks if the current scope has an occupation law. 1.9
occupied_country_tag <tag>
The occupation tag to check.
occupied_country_tag = POL
Checks which country creates resistance. 1.9

Character scope

Can be used in Character scope.

General

General character-scoped triggers:
Name Parameters Examples Description Notes Version Added
is_character <scope>
Character ID.
is_character = POL_test_character
Checks if the current character's token matches up with the specified one. 1.11
can_be_country_leader <bool>
Boolean.
can_be_country_leader = yes
Checks if the character in the current scope has a country leader role, active or non-active. 1.11
is_country_leader <bool>
Boolean.
is_country_leader = yes
Checks if the character in the current scope is the active country leader. 1.11
is_unit_leader <bool>
Boolean.
is_unit_leader = yes
Checks if the character in the current scope has an active unit leader (Army/Navy leader) role. 1.11
is_advisor <bool>
Boolean.
is_advisor = yes
Checks if the character in the current scope has an advisor role (includes advisors/theorists/high command). 1.11
is_air_chief <bool>
Boolean.
is_air_chief = yes
Checks if the character in the current scope is selected as an air chief. Prior to 1.12, checked if the character had a role within the slot, regardless of being selected. 1.11
is_army_chief <bool>
Boolean.
is_army_chief = yes
Checks if the character in the current scope is selected as an army chief. Prior to 1.12, checked if the character had a role within the slot, regardless of being selected. 1.11
is_army_leader <bool>
Boolean.
is_army_leader = yes
Checks if the character in the current scope has an army leader (General/Field Marshal) role. 1.11
is_navy_chief <bool>
Boolean.
is_navy_chief = yes
Checks if the character in the current scope is selected as a navy chief. Prior to 1.12, checked if the character had a role within the slot, regardless of being selected. 1.11
is_navy_leader <bool>
Boolean.
is_navy_leader = yes
Checks if the character in the current scope has an navy leader (Admiral) role. 1.11
is_high_command <bool>
Boolean.
is_high_command = yes
Checks if the character in the current scope is selected as high command. Prior to 1.12, checked if the character had a role within the slot, regardless of being selected. 1.11
is_corps_commander <bool>
Boolean.
is_corps_commander = yes
Checks if the character in the current scope is a corps commander. 1.11
is_operative <bool>
Boolean.
is_operative = yes
Checks if the character in the current scope is an operative. 1.11
is_political_advisor <bool>
Boolean.
is_political_advisor = yes
Checks if the character in the current scope is selected as a political advisor. Prior to 1.12, checked if the character had a role within the slot, regardless of being selected. 1.11
is_theorist <bool>
Boolean.
is_theorist = yes
Checks if the character in the current scope is selected as a theorist. Prior to 1.12, checked if the character had a role within the slot, regardless of being selected. 1.11
is_character_slot <string>
The advisor slot to check.
is_character_slot = political_advisor
Checks if the character in the current scope has a role within the specified character slot Character slots are defined within /Hearts of Iron IV/common/idea_tags/*.txt. 1.11
has_air_ledger <bool>
Boolean.
has_air_ledger = yes
Checks if the character in the current scope has an air ledger. 1.11
has_army_ledger <bool>
Boolean.
has_army_ledger = yes
Checks if the character in the current scope has an army ledger. 1.11
has_navy_ledger <bool>
Boolean.
has_navy_ledger = yes
Checks if the character in the current scope has an navy ledger. 1.11
has_character_flag <string>
The flag to check for.
has_character_flag = my_flag
Checks if the current scope has the specified flag. 1.11
has_character_flag flag = <string>
The flag to check.

value = <int>
The flag value to check for. Optional.
date = <date>
The flag creation date to check for. Optional.
days = <int>
The duration the flag existed for. Optional.

has_character_flag = {
    flag = my_flag
    days > 30
    date > 1936.6.1
    value > 0
}
Compares the specified flag's last set date, days since last set, and/or value. If not set, the value comparison is >0. value is limited between -32768 and 32767. 1.11
has_trait <trait>
The trait to check for.
has_trait = really_good_boss
Checks if the current scope has the specified trait. 1.5
has_id <int>
The id to check for.
has_id = 1
Checks if the current character has the specificed ID. 1.5

Advisors

These triggers are to be used specifically for advisors.

Advisor-scoped triggers:
Name Parameters Examples Description Notes Version Added
is_hired_as_advisor <bool>
is_hired_as_advisor = yes
Checks if the current character is activated as an advisor in any slot. 1.12.10
not_already_hired_except_as <slot>
The slot to check in.
not_already_hired_except_as = political_advisor
Checks if the current character is not hired, with the exception of the specified slot. 1.11
advisor_can_be_fired <bool>
Boolean.

OR
slot = <slot>The slot to check in.

advisor_can_be_fired = no
advisor_can_be_fired = {
    slot = political_advisor
}
Checks if the current character's can_be_fired attribute is set or not within a certain slot. If an advisor is available in multiple slots, the long version is mandatory to use. 1.12.8

Country leaders

These triggers are to be used specifically for country leaders.

Country leader-scoped triggers:
Name Parameters Examples Description Notes Version Added
has_ideology <ideology>
The sub-ideology to check for.
has_ideology = liberalism
Checks if the current character has the specificed sub-ideology assigned. 1.11
has_ideology_group <ideology>
The ideology to check for.
has_ideology_group = democratic
Checks if the current character has the specificed ideology assigned. 1.11

Unit leaders

These triggers are to be used specifically for unit leaders, i.e. generals and admirals.

Unit leader-scoped triggers:
Name Parameters Examples Description Notes Version Added
has_unit_leader_flag <string>
The flag to check for.
has_unit_leader_flag = my_flag
Checks if the current scope has the specified flag. Deprecated. Use has_character_flag instead. 1.5
has_unit_leader_flag flag = <string>
The flag to check.

value = <int>
The flag value to check for. Optional.
date = <date>
The flag creation date to check for. Optional.
days = <int>
The duration the flag existed for. Optional.

has_unit_leader_flag = {
    flag = my_flag
    days > 30
    date > 1936.6.1
    value > 0
}
Compares the specified flag's last set date, days since last set, and/or value. Deprecated. Use has_character_flag instead. If not set, the value comparison is >0. value is limited between -32768 and 32767. 1.5
is_leading_army <bool>
Boolean.
is_leading_army = yes
Checks if the current scope is leading a single army. 1.5
is_leading_army_group <bool>
Boolean.
is_leading_army_group = yes
Checks if the current scope is leading an army group. 1.5
is_leading_volunteer_group <tag>
Country tag.
is_leading_volunteer_group = POL
Checks if the current scope is leading a volunteer army within the specified country. If the target country is in a civil war, this will only be valid for one side. 1.11
is_leading_volunteer_group_with_original_country <tag>
Country tag.
is_leading_volunteer_group_with_original_country = POL
Checks if the current scope is leading a volunteer army within a country of the specified original tag. If the target country is in a civil war, this will only be valid for each side. 1.11
is_field_marshal <bool>
Boolean.
is_field_marshal = yes
Checks if the current scope is a Field Marshal. 1.5
is_assigned <bool>
Boolean.
is_assigned = yes
Checks if the current scope is an assigned unit leader. 1.5
can_select_trait <string>
The trait to check for.
can_select_trait = offensive_doctrine
Checks if the current scope can select the specified trait. 1.5
has_ability <string>
The ability to check for.
has_ability = glider_planes
Checks if the current scope has the specified unit leader ability. 1.5
skill <int>
The amount to check for.
skill > 1
Checks if the current scope has a Skill above the specified amount. Must use either > or < operators. 1.5
skill_advantage <int>
The amount to check for.
skill_advantage > 1
Checks if the current scope has a Skill advantage above the specified amount in against an enemy unit leader whilst in combat. Must use either > or < operators. 1.5
planning_skill_level <int>
The amount to check for.
planning_skill_level > 1
Checks if the current scope has a Planning skill above the specified amount. Must use either > or < operators. 1.5
logistics_skill_level <int>
The amount to check for.
logistics_skill_level > 1
Checks if the current scope has a Logistics skill above the specified amount. Must use either > or < operators. 1.5
defense_skill_level <int>
The amount to check for.
defense_skill_level > 1
Checks if the current scope has a Defense skill above the specified amount. Must use either > or < operators. 1.5
attack_skill_level <int>
The amount to check for.
attack_skill_level > 1
Checks if the current scope has a Attack skill above the specified amount. Must use either > or < operators. 1.5
average_stats <int>
The amount to check for.
average_stats > 5
Checks if the current scope has an average skill above the specified amount. Must use either > or < operators. 1.5
is_border_war <bool>
Boolean.
is_border_war = yes
Checks if the current socpe is in a border war. 1.5
num_units <int>
The amount to check for.
num_units > 5
Checks if the current scope is commanding the specified amount of divisions. Must use either > or < operators. 1.5
is_exiled_leader <bool>
Boolean.
is_exiled_leader = yes
Checks if the current scope is a general from an exiled country. 1.6
is_exiled_leader_from <tag>
Country.
is_exiled_leader_from = POL
Checks if the current scope is a general from the specified exiled country. 1.6
is_female <bool>
Boolean.
is_female = yes
Checks if the current scope is female. Works for aces. 1.9

Operatives

These triggers only work for operatives.

Operative-scoped triggers:
Name Parameters Examples Description Notes Version Added
has_nationality <tag>
The nationality to check.
has_nationality = POL
Checks if the current operative has the nationality. 1.9
is_operative_captured <bool>
Boolean.
is_operative_captured = yes
Checks if the current scope is captured. 1.9
operative_leader_mission <token>
Mission.
operative_leader_mission = mission_name
Checks if the current scope is on the given mission. 1.9
operative_leader_operation <token>
Operation.
operative_leader_operation = operation_name
Checks if the current scope is on the given operation. 1.9

Combat

These triggers are used within the combatant scope. Some trigger blocks in abilities, combat tactics, and unit leader traits check this, and it's impossible to access elsewhere.

Combatant-scoped triggers:
Name Parameters Examples Description Notes Version Added
hardness <float>
The amount to check for.
hardness > 0.5
Checks if the current scope has the specified amount of hardness. Must use either > or < operators. 1.0
armor <float>
The amount to check for.
armor > 0.5
Checks if the current scope has the specified amount of armor units. Must use either > or < operators. 1.0
dig_in <float>
The amount to check for.
dig_in > 0.5
Checks if the current scope has the specified amount of Dig In bonus. Must use either > or < operators. 1.0
min_planning <float>
The amount to check for.
min_planning > 0.5
Checks if the current scope has the specified amount of planning. Must use either > or < operators. 1.0
fastest_unit <float>
The speed in km/h to check for.
fastest_unit > 12
Checks if the current scope has a unit with the specified speed. Must use either > or < operators. 1.0
temperature <float>
The temperature in celsius to check for.
temperature > 20
Checks if the current scope is in a province with a temperature above the specified amount. Must use either > or < operators. 1.0
reserves <float>
The amount to check for.
reserves > 10
Checks if the current scope has the specified amount of reserves waiting. Must use either > or < operators. 1.0
has_combat_modifier <string>
The modifier to check for.
has_combat_modifier = river_crossing
Checks if the current scope has the specified combat modifier. 1.0
is_fighting_in_terrain <string>
The terrain to check for.
is_fighting_in_terrain = desert
Checks if the current scope is fighting in the specified terrain. 1.0
is_fighting_in_weather <string>
The weather to check for.

OR
{ <string> <...> <string> }
The weather to check for in an OR statement.

is_fighting_in_weather = sandstorm
is_fighting_in_weather = { rain_light rain_heavy }
Checks if the current scope is fighting in the specified weather. 1.0
phase <bool>
Boolean.
phase = yes
Checks if the current scope is in phase. 1.0
recon_advantage <bool>
Boolean.
recon_advantage > 0
Checks if the current scope has x recon advantage. 1.0
night <bool>
Boolean.
night = yes
Checks if the current scope is fighting at night. 1.0
frontage_full <bool>
Boolean.
frontage_full = yes
Checks if the current scope has a full combat width. 1.0
has_flanked_opponent <bool>
Boolean.
has_flanked_opponent = yes
Checks if the current scope has flanked their opponent. 1.0
has_max_planning <bool>
Boolean.
has_max_planning = yes
Checks if the current scope has the maximum planning bonus. 1.0
has_reserves <bool>
Boolean.
has_reserves = yes
Checks if the current scope has any reserves waiting. 1.0
is_amphibious_invasion <bool>
Boolean.
is_amphibious_invasion = yes
Checks if the current scope is performing an amphibious invasion. 1.0
is_attacker <bool>
Boolean.
is_attacker = yes
Checks if the current scope is attacking. 1.0
is_defender <bool>
Boolean.
is_defender = yes
Checks if the current scope is defending. 1.0
is_winning <bool>
Boolean.
is_winning = yes
Checks if the current scope is winning their battle. 1.0
is_fighting_air_units <bool>
Boolean.
is_fighting_air_units = yes
Checks if the current scope is fighting air units. 1.0
less_combat_width_than_opponent <bool>
Boolean.
less_combat_width_than_opponent = yes
Checks if the current scope is fighting with less combat width than their opponent. 1.0
has_carrier_airwings_on_mission <bool>
Boolean.
has_carrier_airwings_on_mission = yes
Checks if the current scope has carrier airwings on a mission. 1.0
has_carrier_airwings_in_own_combat <bool>
Boolean.
has_carrier_airwings_in_own_combat = yes
Checks if the current scope has carrier airwings in their own combat. 1.0

Division scope

Can be used in Division scope.

Division-scoped triggers:
Name Parameters Examples Description Notes Version Added
division_has_majority_template <battalion>
Battalion to check for.
division_has_majority_template = light_armor
Checks if the current scope is majority made up of the specified battalion. Battalions are defined within /Hearts of Iron IV/common/units/*.txt files. 1.12
division_has_battalion_in_template <battalion>
Battalion to check for.
division_has_battalion_in_template = light_armor
Checks if the current scope has any battalions of the type in the template. Battalions are defined within /Hearts of Iron IV/common/units/*.txt files. 1.12
unit_strength <battalion>
Battalion to check for.
unit_strength < 0.3
Checks the current strength of the unit on the scale from 0 to 1. Must use either the < or > operator. 1.12
unit_organisation <battalion>
Battalion to check for.
unit_organization < 0.3
Checks the current organisation of the unit on the scale from 0 to 1. Must use either the < or > operator. 1.12
is_unit_template_reserves <bool>
Boolean.
is_unit_template_reserves = yes
Checks if the current division has the supply priority set to 'Reserves', i.e. the lowest priority. Must use either the < or > operator. 1.12

MIO scope

Can be used in Military-industrial organisation scope.

MIO-scoped triggers:
Name Parameters Examples Description Notes Version Added
is_military_industrial_organization <token>
MIO to check.
is_military_industrial_organization = my_mio_token
Checks if the currently-scoped MIO matches the input token. 1.13
is_mio_visible <bool>
Boolean.
is_mio_visible = yes
Checks if the currently-scoped MIO is visible. 1.13
is_mio_available <bool>
Boolean.
is_mio_available = yes
Checks if the currently-scoped MIO is visible. 1.13
is_mio_assigned_to_task <bool>
Boolean.
is_mio_assigned_to_task = yes
Checks if the currently-scoped MIO is assigned to a task. 1.13
has_mio_size <int>
Integer.
has_mio_size > 3
Checks the size of the MIO. Accepts variables. May use < or >. 1.13
has_mio_trait <token>
Trait to check.

OR
trait = <token>
Trait to check.

has_mio_trait = my_trait_token
has_mio_trait = {
    token = my_trait_token
}
Checks whether the MIO has the target trait in its list. 1.13
is_mio_trait_available <token>
Trait to check.

OR
trait = <token>
Trait to check.
check_mio_parent_completed = <bool>
Whether to check if the parent traits are complete. True by default. check_mio_mutually_exclusive = <bool>
Whether to check if any mutually exclusive traits are complete. True by default.

is_mio_trait_available = my_trait_token
is_mio_trait_available = {
    token = my_trait_token
    check_mio_parent_completed = no
}
Checks whether the MIO has the target trait in its list and whether it's available. 1.13
is_mio_trait_completed <token>
Trait to check.

OR
trait = <token>
Trait to check.

is_mio_trait_completed = my_trait_token
is_mio_trait_completed = {
    token = my_trait_token
}
Checks whether the MIO has the target trait in its list and whether it's completed. 1.13
has_mio_number_of_completed_traits <int>
Integer.
has_mio_number_of_completed_traits < 2
Checks the amount of unlocked MIO traits. Accepts variables. May use < or >. 1.13
has_mio_flag <string>
The flag to check.
has_mio_flag = my_flag
Checks if the current scope has the specified flag. 1.13
has_mio_flag flag = <string>
The flag to check.

value = <int>
The flag value to check for. Optional.
date = <date>
The flag creation date to check for. Optional.
days = <int>
The duration the flag existed for. Optional.

has_mio_flag = {
    flag = my_flag
    days > 30
    date > 1936.6.1
    value > 0
}
Compares the specified flag's last set date, days since last set, and/or value. If not set, the value comparison is >0. value is limited between -32768 and 32767. 1.13
has_mio_policy <token>
Policy to check.
has_mio_policy = my_policy_token
Checks if the currently-scoped MIO has the target policy allowed. 1.13
has_mio_policy_active <token>
Policy to check.
has_mio_policy_active = my_policy_token
Checks if the currently-scoped MIO has the target policy active. 1.13
has_mio_research_category <token>
Category to check.
has_mio_research_category = my_research_category_token
Checks if the currently-scoped MIO has the target research category. 1.13
has_mio_equipment_type <token>
Type to check.
has_mio_equipment_type = my_equipment_type_token
Checks if the currently-scoped MIO has the target equipment types. The possible equipment types are defined in script_enum_equipment_bonus_type (in /Hearts of Iron IV/common/script_enums.txt) and in /Hearts of Iron IV/common/equipment_groups.txt files. 1.13

Contract scope

Can be used in purchase contract scope.

Contract-scoped triggers:
Name Parameters Examples Description Notes Version Added
contract_contains_equipment <token>
Type to check.
contract_contains_equipment = infantry_equipment
Checks if the currently-scoped purchase contract contains an equipment type. May use equipment types, equipment archetypes, or types of equipment archetypes. 1.13
deal_completion <decimal>
Progress to compare with.
deal_completition > 0.6
Checks the deal completion with the target value. May use < or >. On the scale from 0 to 1. 1.13
seller <country>
Country to check.
seller = BHR
Checks the seller in the current purchase contract. 1.13
buyer <country>
Country to check.
buyer = OMA
Checks the buyer in the current purchase contract. 1.13

Meta triggers

Meta triggers are a system added with 1.6 with 炮手就位炮手就位[4] used in the exact same manner as meta effects: in order to tie a trigger block to a dynamic localisation entry. This is usually used in conjunction with scripted localisation for non-numerical checks. This also can serve in order to place a variable check where one is not possible.
Meta triggers work in any scope that supports triggers, including combat scope.

The following arguments go inside of a scripted trigger:

  • text = { ... } is a trigger block used by the meta trigger. In here, any string that must be made dynamic is marked with the square brackets on each side as [EXAMPLE].
  • EXAMPLE = "..." is a string that will serve as the dynamic replacement for [EXAMPLE] within text = { ... }. This accepts dynamic localisation to a limited degree, such as getting a variable's value with [?var_name] or some namespaces like [ROOT.GetTag].
  • debug = yes, if added, will add the final output in the user directory's /Hearts of Iron IV/logs/game.log file for debugging purposes.

For example, the following can be used with has_equipment to make it depend on a variable's value:

meta_trigger = {
    text = {
        has_equipment = { [EQUIPMENT_ARCHETYPE] > 100 }
    }
    EQUIPMENT_ARCHETYPE = "[GetEquipmentArchetype]"
}

In this case, GetEquipmentArchetype is scripted localisation. An example definition of scripted localisation in this case is as such:

defined_text = {
    name = GetEquipmentArchetype
    text = {
        trigger = {
            check_variable = { v = 0 }
        }
        localization_key = artillery_equipment
    }
    text = {
        localization_key = infantry_equipment
    }
}

Scripted triggers

Scripted triggers serve a similar purpose to functions in that they can be defined in /Hearts of Iron IV/common/scripted_triggers/*.txt and then used elsewhere as a shortened version. Alongside that, the game has certain base game scripted triggers that are checked directly in the game's code determining triggers for functions that cannot be changed.

A scripted trigger is defined simply as

scripted_trigger_name = {
	<triggers>
}

This example can be used as a trigger in regular code as scripted_trigger_name = yes or scripted_trigger_name = no.

For example, this would be the definition in any scripted trigger file:

state_is_in_area = {
    OR = {
        state = 120
        state = 121
        state = 123
        state = 124
        state = 125
    }
}

This can then be used in any other trigger block, such as a national focus' available section:

focus = {
    id = TAG_focus_id   # Optional attributes, other than available, have been omitted
    available = {
        capital_scope = {
            state_is_in_area = yes
        }
    }
}

If there are several definitions of scripted triggers with the exact same name, the game will make the scripted trigger be the one that was evaluated later, as decided by file names and order in files.

Diplomacy scripted triggers

Diplomacy scripted triggers fall into two mutually exclusive groups: deciding availability and deciding visibility. By default, these are defined in /Hearts of Iron IV/common/scripted_triggers/diplomacy_scripted_triggers.txt and /Hearts of Iron IV/common/scripted_triggers/00_diplo_action_valid_triggers.txt respectively. While it is possible to also use them as regular scripted triggers, they will also modify the prerequisites of being able to do a diplomatic action between 2 countries.

A diplomacy scripted trigger is identified by the naming pattern of DIPLOMACY_<action>_ENABLE_TRIGGER for availability, such as DIPLOMACY_GUARANTEE_ENABLE_TRIGGER, and is_diplomatic_action_valid_<action> for visibility, such as is_diplomatic_action_valid_stage_coup. In the base game, diplomacy scripted triggers are used to implement the game rules and add some country-specific exceptions, such as the 联合王国的国旗 联合王国 being unable to release its colonies with the 炮手就位炮手就位 DLC. Checking the base game's contents beforehand or copying it to the mod would ensure that the mod won't accidentally break any existing game rules.

Generally, the pattern in localisation keys used for the button usually matches up with the internal ID of a diplomatic action. If the diplomatic action doesn't already have a scripted trigger in the base game, entirety of localisation can be searched for the name of the button to find the name of the action. For example, a the English localisation entry of DIPLOMACY_CANCEL_GENERATE_WARGOAL_TITLE:0 "Cancel Justification" would suggest that the diplomatic action of cancelling justification is CANCEL_GENERATE_WARGOAL.

Know tokens for is_diplomatic_action_valid_<action> are:

  • declare_war, for the Declare War button
  • generate_wargoal, only affects the war goal menu by greying out the send button
  • guarantee, for the Guarantee Independence button
  • docking_rights, for the request docking rights button
  • offer_docking_right, for the offer docking rights button
  • create_faction, for the create faction button
  • assume_faction_leadership, for the assume leadership of faction button
  • kick_from_faction, for the kick from faction button
  • join_faction, for the ask to join faction button
  • request_access_to_licence_production, for the negotiate license button
  • embargo, for the embargo button
  • send_volunteers, only affects the sent volunteers menu by greying out the send button
  • stage_coup, for the stage coup button
  • boost_party_popularity, for the boost party popularity button

Within a diplomacy scripted trigger, the default scope is the country that does the trigger, while FROM is the target of the action. For availability, the trigger's tooltip is shown to the player when hovering over the diplomatic action; in case of country-specific restrictions, using conditional statements can ensure that the tooltip would only be generated when needed rather than between any pair of nations.

For example, this trigger will prevent BHR from revoking a guarantee on QAT, while still ensuring the game rule works otherwise:

DIPLOMACY_REVOKE_GUARANTEE_ENABLE_TRIGGER = {
    if = {
        limit = {
            has_game_rule = {
                rule = allow_revoke_guarantees
                option = BLOCKED
            }
        }
        custom_trigger_tooltip = {
            tooltip = RULE_ALLOW_REVOKE_GUARANTEES_BLOCKED_TOOLTIP
            always = no
        }
    }
    if = {
        limit = {
            tag = BHR
            FROM = { tag = QAT }
        }
        custom_trigger_tooltip = {
            tooltip = NO_REVOKING_ON_QAT_TT
            always = no
        }
    }
}

Resistance initiation triggers

The behaviour of resistance being automatically initiated is decided by the should_initiate_resistance scripted trigger, by default defined in /Hearts of Iron IV/common/scripted_triggers/00_resistance_initiate_triggers.txt. If it is unfulfilled, the resistance will never initiate unless forced via the the force_enable_resistance effect. Likewise, the resistance will always occur if it's true unless forcefully disabled.

The scripted trigger's behaviour can be overwritten with state-specific scripted triggers, which should be named should_initiate_resistance with the list of state IDs suffixed at the end, separated by underscores. For example, this ensures that when a state 321 or 123 is controlled by the 联合王国的国旗 联合王国, resistance would get initiated if and only if they're national territory of 法国的国旗 法国; otherwise, the normal behaviour is used:

should_initiate_resistance_123_321 = {
	if = {
		limit = {
			tag = ENG
		}
		is_core_of = FRA
	}
	else = {
		should_initiate_resistance = yes # If this is not done, resistance would always activate due to overwriting that scripted trigger.
	}
}

Useful scripted triggers

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

Scripted triggers:
Name Scope Example Description Notes
can_ROOT_get_wargoal_on_THIS Country
can_ROOT_get_wargoal_on_THIS = yes
Checks if ROOT can obtain a wargoal on the current scope. To evaluate as true, the current scope must exist, not share a faction with ROOT, and not be a subject of ROOT.
is_free_or_subject_of_root Country
is_free_or_subject_of_root = yes
Checks if the current scope is either independent or a subject of ROOT.
has_same_ideology Country
has_same_ideology = yes
Checks if the current scope has the same ideology as ROOT. Needs modifying if there are custom ideologies. Equivalent to has_government = ROOT for base game ideologies.
is_enemy_ideology Country
is_enemy_ideology = yes
Checks if the current scope has an ideology that is considered enemy to ROOT's. 共产主义共产主义, 民主主义民主主义, and 法西斯主义法西斯主义 are considered enemy to each other.
has_ROOT_at_least_1_div_in_current_state_scope State
has_ROOT_at_least_1_div_in_current_state_scope = yes
Checks if ROOT has at least one division in the current scope.
controls_or_subject_of State
controls_or_subject_of = yes
Checks if the current state is controlled by ROOT or a subject of ROOT.
is_controlled_by_ROOT_or_ally State
is_controlled_by_ROOT_or_ally = yes
Checks if the current state is controlled by ROOT, a subject of ROOT, or a country in the same faction as ROOT.
owns_or_subject_of State
owns_or_subject_of = yes
Checks if the current scope is owned by ROOT or a subject of ROOT.

References and notes

^ a: Triggers are able to set and modify temporary variables. This temporary variable itself may be then used separately to change the game's state, such as in a MTTH block or if the trigger block is used in some effect's limit = { ... } (most commonly if statements or effect scope limits), though the usage of the variable to change the game's state is not a trigger by itself.