钢铁雄心 IV 中文离线资料库

触发器

原页面:Triggers

本页中文翻译进度 34%,未译部分暂保留英文原文。

Conditions (also known as 触发器) 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. Please note that the yes和no inputs are case-sensitive and must not contain any uppercase letters.

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.17.1.1, this file was last updated in the version 1.17.0.


Operators

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

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:

  • 国家
  • 州
  • 角色

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.

作用域

主条目:作用域

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 触发器; trying to use them as 效果 will result in nothing happening.

Trigger scopes:
名称 用法 目标类型 示例 描述 加入版本
all_country 始终可用 国家 all_country = { … } Checks if all countries meet the triggers. 1.0
any_country 始终可用 国家 any_country = { … } Checks if any country meets the triggers. 1.0
all_other_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 仅限国家作用域内 国家 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 始终可用 国家
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 始终可用 国家
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 仅限国家作用域内 国家 all_neighbor_country = { … } Checks if all countries that border the one where this scope is located meet the triggers. 1.0
any_neighbor_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 仅限国家作用域内 国家 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 仅限国家作用域内 国家 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 仅限国家作用域内 国家 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 仅限国家作用域内 国家 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 仅限国家作用域内 国家 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 仅限国家作用域内 国家 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 仅限国家作用域内 国家 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 仅限国家作用域内 国家 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 仅限国家作用域内 国家 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 仅限国家作用域内 国家 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 仅限国家作用域内 国家 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 仅限州作用域内 国家 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_country_of Alway usable 国家
all_country_of = {
	tooltip = my_loc # Optional bindable localization
	target = { SWE NOR FIN DEN ICE }
	has_defensive_war = yes
}

all_country_of = {
    tooltip = my_loc # Optional bindable localization
	target = constant:country_groups:nordics
	has_defensive_war = yes
}
Checks if all of the provided countries fulfill the specified triggers. The `target` supports script constants and `tooltip` supports bindable localization. 1.17
any_country_of Alway usable 国家
any_country_of = {
	tooltip = my_loc # Optional bindable localization
	target = { SWE NOR FIN DEN ICE }
	has_defensive_war = yes
}

any_country_of = {
    tooltip = my_loc # Optional bindable localization
	target = constant:country_groups:nordics
	has_defensive_war = yes
}
Checks if any of the provided countries fulfills the specified triggers. The `target` supports script constants and `tooltip` supports bindable localization. 1.17
all_state 始终可用 州 all_state = { … } Check if all states meet the triggers. 1.0
any_state 始终可用 州 any_state = { … } Check if any state meets the triggers. 1.0
any_state_in 始终可用 州
any_state_in = {
  array = array_of_states  #required 
    …                  #triggers to check
}
需要具备以下字段之一
array = <array_of_states>
continent = <continent_name>
ai_area = <ai_area_name>
strategic_region = <strategic_region_number>
Check if any state in the given category meets the trigger. 1.15
any_state_of Alway usable 州
any_state_of = {
	tooltip = my_loc # Optional bindable localization
	target = { 1 42 1992 }
	controller = {
		has_defensive_war = yes
	}
}

any_state_of = {
    tooltip = my_loc # Optional bindable localization
	target = constant:country_groups:nordics
	controller = {
		has_defensive_war = yes
	}
}
Checks if any of the provided states fulfills the specified triggers. The `target` supports script constants and `tooltip` supports bindable localization. 1.17
all_neighbor_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 仅限州作用域内 州 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 仅限国家作用域内 州 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 仅限国家作用域内 州 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 仅限国家作用域内 州 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 仅限国家作用域内 州 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 仅限国家作用域内 州 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 仅限国家作用域内 州 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 仅限国家作用域内 单位指挥官 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 仅限国家作用域内 单位指挥官 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 仅限国家作用域内 单位指挥官 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 仅限国家作用域内 单位指挥官 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 仅限国家作用域内 单位指挥官 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 仅限国家作用域内 单位指挥官 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 仅限国家作用域或行动内 特工 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 仅限国家作用域或行动内 特工 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 仅限国家作用域内 角色 all_character = { … } Checks if all characters that are recruited by the country where this scope is located meet the triggers. 1.11
any_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 仅限国家作用域内 师 any_country_division = { … } Checks if any division owned by the current country meets the triggers. 1.12
any_state_division 仅限州作用域内 师 any_state_division = { … } Checks if any division within the current state meets the triggers. 1.12
all_military_industrial_organization 仅限国家作用域内 军工组织 all_military_industrial_organization = { … } Checks if all MIOs within the current country meet the conditions. 1.13
any_military_industrial_organization 仅限国家作用域内 军工组织 any_military_industrial_organization = { … } Checks if any MIO within the current country meets the conditions. 1.13
all_purchase_contract 仅限国家作用域内 采购合同 all_purchase_contract = { … } Checks if all purchase contracts within the current country meet the conditions. 1.13
any_purchase_contract 仅限国家作用域内 采购合同 any_purchase_contract = { … } Checks if any purchase contract within the current country meets the conditions. 1.13
all_scientists 仅限国家作用域内 角色 all_scientistst = { … } Checks if all scientists of the Country in scope matches the triggers. 1.15
any_scientist 仅限国家作用域内 角色 any_scientist = { … } Checks if at least one active scientist of the Country in scope matches the triggers. 1.15
all_active_scientist 仅限国家作用域内 角色 all_active_scientist = { … } Checks if all active scientists of the Country in scope matches the triggers. 1.15
any_active_scientist 仅限国家作用域内 角色 any_active_scientist = { … } Checks if at least one active scientist of the Country in scope matches the triggers. 1.15


双重作用域

以下作用域既可用作效果作用域,也可用作触发器作用域;有些还可作为某些效果和触发器的右侧目标使用。若可作为目标使用,会在表中标注。

部分双重作用域的作用域会随使用位置而变化,例如变量可被设为任何内容。

双重作用域:
名称 用法 目标类型 示例 描述 可作为目标使用 加入版本
TAG 始终可用 国家作用域 SOV = { country_event = my_event.1 } 由标签或标签别名定义的国家。标签别名定义在 /Hearts of Iron IV/common/country_tag_aliases 中,用于在国家的实际标签之外指代特定国家(例如内战中的一方)。若使用确切标签的国家不存在,但存在源自该指定标签的动态国家,则作用域将指向该动态国家。 ✓ 1.0
<state_id> 始终可用 州作用域 123 = { transfer_state_to = SCO } 由此id定义的州。 ✓ 1.0
<character> 不在角色作用域内 角色作用域 ENG_theodore_makhno = { set_nationality = UKR } 在1.12.8之前的游戏版本中,该角色必须已被此作用域所属国家招募。 ✓ 1.11
mio:<MIO> 仅限国家作用域内 军工组织作用域 mio:AST_cockatoo_doe_organization = { … } 由该ID标识的军工组织,定义于 /Hearts of Iron IV/common/military_industrial_organization/organizations/*.txt 文件中。 ✓ 1.13
sp:<special_project> 仅限国家作用域内 特殊项目作用域 sp:sp_land_flamethrower_tank = { … } 由该ID标识的特殊项目,定义于 /Hearts of Iron IV/common/special_projects/projects/*.txt 文件中。 ✓ 1.15
ROOT 始终可用 取决于用法
ENG = {
    FRA = {
        GER = {
            declare_war_on = {
                target = ROOT
                type = annex_everything
            }
        }
    }
} #GER declares war on ENG (if there is no scope before ENG)
指向所在块的根节点,这是每个块固有的属性。最常见的情况是,它就是默认作用域:例如 ROOT 在国策内 始终指向执行该焦点的国家,ROOT 在事件内 始终指向收到该事件的国家。不过,某些块会区分默认作用域与 ROOT,例如 某些脚本化GUI上下文 或 某些 on actions。若某个块没有定义 ROOT(例如 on actions 中的 on_startup),则无法使用它。 ✓ 1.0
THIS 始终可用 取决于用法
set_temp_variable = { target_country = THIS }
以使用它的当前位置为目标作用域。例如,在 every_state 中使用时,它将指代当前正在求值的州。主要用于变量(如示例中所示,省略它将无法工作)或用于 内置本地化指令,此时必须指定某个作用域。更少见地,在使用 PREV 时,这可能有助于作用域操作。由于省略它不会改变代码的解释方式,因此在这些情况之外几乎没有用处。 ✓ 1.0
PREV 始终可用 取决于用法
FRA = {
    random_country = {
        GER = {
            declare_war_on = {
                target = PREV
                type = annex_everything
            }
        }
    }
} #Germany declares war on random_country
以当前作用域所隶属的作用域为目标。在假定默认作用域与 ROOT 不同的情况下可以有更多用途,例如在州事件或某些 on_action 中。可以无限链接为 PREV.PREV。通常会导致提示框显示异常:向玩家显示的内容并不总是与现实相符。

另见:PREV 用法。

✓ 1.0
FROM 始终可用 取决于用法
declare_war_on = {
    target = FROM
    type = annex_everything
}

FROM = {
    load_oob = defend_ourselves
}
可以无限链接为 FROM.FROM。用于指向块固有的各种硬编码作用域,通常是在 ROOT 之外的一个次级作用域。例如:

在 事件 中,这指代发送该事件的国家(即若该事件是 使用效果 触发的,则它是当时触发所在的 ROOT 作用域)。在 有目标决议 或外交脚本触发器中,这指代被作为目标的作用域。

✓ 1.0
宗主国 仅限国家作用域内 国家作用域 宗主国={…} 如果该国是附庸国,则为其宗主国。会触发「invalid event target」错误。 X 1.3
faction_leader 仅限国家作用域内 国家作用域 faction_leader = { add_to_faction = FROM } 该国所属阵营的阵营领袖。会触发「invalid event target」错误。 X 1.10.1
owner 仅限州、角色或参战方作用域内 国家作用域 owner = { add_ideas = owns_this_state } 在州作用域中,指拥有该州的国家。在参战方作用域中,指拥有这些师的国家。在角色作用域中,指已招募该角色的国家。用于州时为会触发「invalid event target」错误。 X 1.0
controller 仅限州作用域内 国家作用域
controller = { 
    ROOT = {
        create_wargoal = {
            target = PREV
            type = take_state_focus
            generator = { 123 }
        }
    }
}
当前州的控制者。会触发「invalid event target」错误。 X 1.0
capital_scope 仅限国家作用域内 州作用域 capital_scope = { … } 当前国家首都所在的州。少数情况下为会触发「invalid event target」错误。 X 1.0
event_target:<event_target_key> 始终可用 取决于用法 event_target:my_event_target = { … } 已保存的事件目标或全局事件目标,冒号后不加空格。会触发「invalid event target」错误。 ✓ 1.0
var:<variable> 始终可用 取决于用法 var:my_variable = { … } add_to_faction = my_variable 或 add_to_faction = var:my_variable 把变量设置为某个作用域。

当用作目标而非作用域时,在大多数情况下可以省略 var:。

✓ 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:
名称 Additional parameters 示例 描述 备注 加入版本
AND 「无」
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和NOT statements, as everything else is implicitly AND. 1.0
OR 「无」
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 「无」
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. 嵌套(即在if = { ... }内部)和非嵌套(如示例中那样)的else与else_if都存在。若二者重叠,优先使用非嵌套形式。

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 「无」
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. #custom_override_tooltip触发器的别名(更多信息参见该触发器)。保留用于向后兼容。建议改用#custom_override_tooltip。

也支持本地化#可绑定本地化。

1.0
custom_override_tooltip tooltip = <string> 要使用的本地化键。

not_tooltip = <string>
The localisation key to use for NOT block. Optional.

custom_override_tooltip = {
    tooltip = {
      localization_key = GER_inner_circle_focus_in_progress_tt
	  CHARACTER = GER_rudolf_hess
	  FLAG_DAYS = [?GER_rally_the_industrialists_in_progress_flag:days]
    }
    not_tooltip = MY_TOOLTIP_NOT
    <triggers>
}
An AND trigger that has an overriden custom tooltip. 可以用tooltip设置一个正面提示框,而在NOT内部使用的提示框可以用not_tooltip设置。如果没有提供正面提示框,且根键是本地化键(而非格式化器,参见格式化本地化),则会通过在正面提示框的根本地化文本后追加_NOT来生成一个负面提示框。tooltip和not_tooltip都是可绑定的本地化。

Can also be used as effect.
Also supports 本地化#可绑定本地化.

1.15

任意作用域

These triggers do not require any particular scope.

通用

General any-scoped triggers:
名称 参数 示例 描述 备注 加入版本
always <bool> 布尔值。
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> 要检查的标记。

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. 年.月.日

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. 年.月.日

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> 布尔值。
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> 布尔值。
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> 布尔值。
is_ironman = yes
Checks if the current game is running in Ironman mode. 1.0
is_historical_focus_on <bool> 布尔值。
is_historical_focus_on = yes
Checks if the current game is running with Historical Focuses on. 1.0
is_tutorial <bool> 布尔值。
is_tutorial = yes
Checks if the current game is running in Tutorial mode. 1.0
is_debug <bool> 布尔值。
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> 要检查的游戏规则。

<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
has_completed_custom_achievement mod = <mod ID> 该成就所属的模组。

achievement = <achievement ID> 成就的名称。

has_completed_custom_achievement = {
    mod = my_mod_unique_id
    achievement = my_achievement_token
}
检查控制当前作用域的玩家是否已完成指定的自定义成就。 成就(包括它所属模组的 ID)在/Hearts of Iron IV/common/achievements/*.txt文件中定义[1]。该成就可能在之前的某次游戏会话中就已达成,不一定是在当前这次。

如果定义该成就的模组未加载,该触发器判定为假。

1.12.5

生涯档案

Career profile-releated any-scoped triggers:
名称 参数 示例 描述 备注 加入版本
career_profile_check_medal medal = <medal> 要检查的奖章。

???

career_profile_check_medal = {
  medal = raining_debris_medal
  ???
}
Checks if the required medal is achieved and collected. Provide no tooltip. ???
career_profile_check_ribbon ribbon = <ribbon> 要检查的绶带。

tooltip = <loc_key>
Optional.

career_profile_check_ribbon = {
  ribbon = orchestra_of_boom
  tooltip = my_loc_key
}
Checks if the required ribbon is achieved and collected. By default provide no tooltip. ???
career_profile_check_playthrough_ratio frits = <variable>

second = <variable>

ratio = <int>
Ratio.
compare = <type>
The type of comparison.

career_profile_check_playthrough_ratio = {
  first = enemy_casualties
  second = total_own_casualties
  ratio = 4
  compare = greater_than_or_equals
}
Compares the ratio (first/second) of two playthrough values to a number. 不提供提示框。

Possible compare types:

  • less_than
  • less_than_or_equals
  • greater_than
  • greater_than_or_equals
  • equals
  • not_equals
???
career_profile_check_playthrough_value { ... }

OR
var = <variable>
Value to compare.
value = <int>
Value to compare to.
compare = <type>
The type of comparison. Optional.
tooltip = <loc_key>
Optional.
tooltip_value = <int>
Optional.

career_profile_check_playthrough_value = {
  plan_landlocked_battleship > 1
  plan_landlocked_carrier > 0
}
career_profile_check_playthrough_value = {
  var = deployed_airplanes_with_air_defense_gold
  value = 100
  compare = greater_than_or_equals
  tooltip = CAREER_PROFILE_TRIGGER_DEPLOYED_AIRPLANES_WITH_AIR_DEFENSE
  tooltip_value = 100
Compares a playthrough value to a number. 默认不提供提示框。

Possible compare types:

  • less_than
  • less_than_or_equals
  • greater_than
  • greater_than_or_equals
  • equals
  • not_equals
???
career_profile_check_points value = <int> 要比较的值。

compare = <type>
The type of comparison.
tooltip = <loc_key>
Optional.

career_profile_check_points = {
  value = 5000
  compare = greater_than_or_equals
  tooltip = CAREER_PROFILE_TRIGGER_MINED_SEA_REGIONS
}
Compares a career points value to a number. 默认不提供提示框。

Possible compare types:

  • less_than
  • less_than_or_equals
  • greater_than
  • greater_than_or_equals
  • equals
  • not_equals
???
career_profile_check_ratio Possible the same as #career_profile_check_playthrough_ratio. Possible the same as #career_profile_check_playthrough_ratio. Compares the ratio (first/second) of two career profile values to a number. Possible the same as #career_profile_check_playthrough_ratio. ???
career_profile_check_value Possible the same as #career_profile_check_playthrough_value. Possible the same as #career_profile_check_playthrough_value. Compares a career profile value to a number. Possible the same as #career_profile_check_playthrough_value. ???
career_profile_has_player_flag <string>
The flag to check.
career_profile_has_player_flag = career_profile_overrun_infantry_flag
Checks if the flag is set for the local player. ???

变量

Variable-related triggers:
名称 参数 示例 描述 备注 加入版本
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> 要检查的变量。

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. 可用的比较类型:
  • 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 变量 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:
名称 参数 示例 描述 备注 加入版本
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 用户目录 1.5

国家作用域

Can be used in 国家 scope.

通用

General country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
exists <bool> 布尔值。
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> 布尔值。
is_ai = yes
Checks if the current scope is AI. 1.0
has_collaboration target = <country> 要检查的国家。

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> 要检查的标记。

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 current scope or global scope has the specified event target saved. 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> 要检查的 dynamic_modifier。

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_country_custom_difficulty_setting <bool> 布尔值。
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.
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> 布尔值。
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
<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. 数量必须使用 > 或 < 运算符。

也可在州作用域使用。

???
has_resources_in_country 资源=<资源> 要检查的资源。

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

国策

National focus-related country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
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> 要检查的焦点。

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_shine_effect_on_focus <string>
The focus to check.
has_shine_effect_on_focus = GER_wunderwaffe
Check if country has shine effect on focus (either manually achieved or by being worked on). 请注意,提示框仅在调试模式下显示。

Shine can be added manually by selecting focus, or via activate_shine_on_focus effect.

1.15

政治

Political country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
<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 <浮点数> / <变量>
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 <浮点数> / <变量>
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 <浮点数> / <变量>
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 <浮点数> / <变量>
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 <浮点数> / <变量>
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 <浮点数> / <变量>
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 <浮点数> / <变量>
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> 要检查的意识形态组。

OR
<国家>
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> 布尔值。
has_elections = yes
Checks if the current scope holds elections. 1.0
is_staging_coup <bool> 布尔值。
is_staging_coup = yes
Checks if the current scope is staging a coup. 1.3
is_target_of_coup <bool> 布尔值。
is_target_of_coup = yes
Checks if the current scope is the target of a coup. 1.0
has_civil_war <bool> 布尔值。
has_civil_war = yes
Checks if the current scope has a civil war active. 1.0
civilwar_target <scope> 目标国家。
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> 要检查的数量。

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 <浮点数> / <变量>
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 <浮点数> / <变量>
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 <浮点数> / <变量>
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

力量均势

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

Balance of power-related country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
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> 布尔值。
has_any_power_balance = yes
Checks if the current scope has any balance of power active. 1.12
power_balance_value id = <bop ID> 要检查的力量平衡。

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> 要检查的力量平衡。

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> 要检查的力量平衡。

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> 要检查的力量平衡。

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> 要检查的力量平衡。

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> 要检查的力量平衡。

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

建筑

Building-related country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
<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. 必须使用 > 或 < 运算符。与其他触发器不同,它也可用于州作用域。

也可在州作用域使用。

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> 要检查的国家。

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> 布尔值。
has_damaged_buildings = yes
Checks if the current scope has any damanged buildings in their states. 1.0
has_built type = <building> 要检查的建筑。

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-related country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
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> 要检查的科技。可选。

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
is_special_project_being_researched sp:<string>
A special project to check for.
is_special_project_being_researched = sp:sp_air_radar
Checks if the country in scope is currently researching the special project in input. 1.15
is_special_project_completed sp:<string>
A special project to check for.
is_special_project_completed = sp:sp_land_flamethrower_tank
Checks if the current scope has the specified special project completed. 1.15

理念

Idea-related country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
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> 要检查的特质。

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> 要检查的特质。

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> 要检查的数量。

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

外交

Diplomatic country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
is_major <bool> 布尔值。
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_spymaster <bool> 布尔值。
is_spymaster = yes
Checks if the current scope is the spymaster of a faction. 1.9
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> 布尔值。
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> 布尔值。
is_subject = yes
Checks if the current scope is a subject. 1.0
has_subject <bool> 布尔值。
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> 要检查的国家。

value = <float>
The amount to check for.

has_opinion = {
    target = GER
    value > 50
}
Checks if the current scope has the specified opinion of the target country. Must use either > or < operators. 1.0
has_relation_modifier target = <scope> 要检查的国家。

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>要检查的数量。
has_legitimacy > 50
检查当前流亡政府拥有多少合法性。 必须使用 > 或 < 运算符。合法性范围为 0 到 100。 1.6
is_exile_host <bool> 布尔值。
is_exile_host = yes
检查当前国家是否在收容一个流亡政府。 1.6
is_hosting_exile <tag>国家。
is_hosting_exile = POL
检查当前国家是否在收容一个特定的流亡政府。 1.6
is_government_in_exile <bool> 布尔值。
is_government_in_exile = yes
检查当前国家是否流亡在另一个国家。 1.6
is_exiled_in <tag>要流亡到的国家。
is_exiled_in = POL
检查当前国家是否流亡在一个特定国家。 1.6
received_expeditionary_forces sender = <tag> 派出部队的国家。

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>要检查的数量。
foreign_manpower > 10000
Checks how much foreign manpower we have received for garrisoning. Must use either > or < operators. 1.9
is_embargoed_by <tag>
Country to check.
is_embargoed_by = USA
Checks if the current scope is embargoed by the specified country. 1.12
is_embargoing <tag>
Country to check.
is_embargoing = CUB
Checks if the current scope is embargoing the specified country. 1.12
has_market_access_with <tag>
Country to check.
has_market_access_with = CUB
Checks if the current scope has market access with the specified country.

阵营

Faction-related country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
is_in_faction <bool> 布尔值。
is_in_faction = yes
Checks if the current scope is in a faction. 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_faction_leader <bool> 布尔值。
is_faction_leader = yes
Checks if the current scope is the leader of a faction. 1.0
num_faction_members <整数> / <变量>
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_manpower_to_become_leader <bool> 布尔值
has_manpower_to_become_leader = yes
Checks if the current country exceeds the current faction leader and its subjects in deployed manpower. 1.17
has_industry_to_become_leader <bool> 布尔值
has_industry_to_become_leader = yes
Checks if the current country exceeds the faction leader in number of factories. 1.17
has_enough_influence_for_leadership <bool> 布尔值
has_enough_influence_for_leadership = yes
Checks if the current country has enough political influence to become faction leader. 1.17
has_faction_template <template_id>
Faction template id.
has_faction_template = faction_template_chinese_united_front
Checks if the current country is in a faction with a template. 1.17
has_active_rule <rule_id> 阵营规则 id。
has_active_rule = government_in_exile_allowed
Checks if the country's faction has a specific active rule. 1.17
has_faction_goal <goal_id>
Faction goal id.
has_faction_goal = faction_goal_resource_control
Checks if the country's faction has an active or completed goal. 1.17
has_completed_faction_goal <goal_id>
Faction goal id.
has_completed_faction_goal = faction_goal_resource_control
Checks if the country's faction has successfully completed a goal. 1.17
faction_goal_fulfillment goal = <goal_id> 阵营目标 ID。

value = <float> / <variable>
The amount to check for.

faction_goal_fulfillment = {
    goal = faction_goal_resource_control
    value > 0.85
}
faction_goal_fulfillment = {
    goal = faction_goal_resource_control
    value > 0.5
    value < 0.85
}
Checks fulfillment of a faction goal for the current country's faction. Value supports > and <, can accept variables, can be repeated multiple times. 1.17
faction_manifest_fulfillment <浮点数> / <变量>
The amount to check for.
faction_manifest_fulfillment > 0.95
Checks manifest fulfillment value of current country's faction manifest. 1.17
faction_upgrade_level <upgrade_token>
Faction upgrade token.
faction_upgrade_level > upgrade_token
Checks the active faction member upgrade against the specified upgrade. Works with >, <, = 1.17
faction_power_projection <整数> / <变量>
The amount to check for.
faction_power_projection > 100
Checks power value of current country's faction projection. 1.17
faction_influence_rank <整数> / <变量>
The amount to check for.
faction_influence_rank < 5
Checks influence rank in the faction of the current country. 1.17
faction_influence_ratio <浮点数> / <变量>
The amount to check for.
faction_influence_ratio > 0.1
Checks influence ratio of current country in the faction. 1.17
faction_influence_score <整数> / <变量>
The amount to check for.
faction_influence_score > 100
Checks influence value of current country in the faction. 1.17
can_assign_supportive_scientist_to_faction <specialization>
Specialization.
can_assign_supportive_scientist_to_faction = specialization_land
Checks if the faction from the country in scope has a free slot for a supportive scientist for the country with the specialization type. 1.17
has_faction_research_unlocked <bool> 布尔值。
has_faction_research_unlocked = yes
Whether the faction has unlocked the research. 1.17
has_faction_military_unlocked <bool> 布尔值。
has_faction_military_unlocked = yes
Whether the faction has unlocked the military operations. 1.17
compare_ideology_with_faction value = <float> / <variable> 要检查的数量。

leader = <tag>
Country to check.

compare_ideology_with_faction = {
    value > 0.5
    leader = FROM
}
Compares the ideology support of the country's ruling party for the ideology of the faction it wants to join. Tooltip is visible only if 'leader' is in faction. 1.17

战争

War-related country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
has_war <bool> 布尔值。
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_offensive_war_without_friend <scope> / <variable>
The country to check for.
has_offensive_war_without_friend = GER
Is country at offensive war without specific ally present. 1.17
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> 布尔值。
has_offensive_war = yes
Checks if the current scope is in an offensive war. 1.0
has_defensive_war <bool> 布尔值。
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> 布尔值。
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> 要检查的国家。

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 任意 wargoal. Joining an ally in their war does not count as a wargoal. 1.12
surrender_progress <浮点数> / <变量>
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
Highest warscore value can be approximated by interating a variable by 1 for as long as any_war_score is greater than the variable. Checking with less than appears broken as a warscore of 0 is sometimes erroneously reported. Must use either > or < operators. 1.0
has_capitulated <bool> 布尔值。
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> 要检查的州。

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> 布尔值。
has_border_war = yes
Checks if the current scope has a border war active. 1.5
has_added_tension_amount <浮点数> / <变量>
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> 要检查的国家。

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> 布尔值。
any_claim = yes
如果满足
  1. Is (manually) justifying on another country
  2. Is being (manually) justified on
  3. Has wargoal on another country
  4. Another country has wargoal on the current country
则返回 true
Misleading name. In-game the localization says "Active or generating war goals related to [TAG.GetNameDefCap]" 1.0
is_in_peace_conference <bool> 布尔值。
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> 目标国家。

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
has_truce_with <scope> / <variable>
The country to check for.
has_truce_with = GER
Checks if the country has truce with the specified country. 1.16
has_naval_control <id> / <variable>
The region to check in.
has_naval_control = 16
Checks if friendly nations and country scope together has enough naval dominance to assert control in strategic region. 1.17
has_enemy_naval_control <id> / <variable>
The region to check in.
has_enemy_naval_control = 16
Checks if any enemy has enough naval dominance to assert control in certain strategic region. 1.17

州

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

State-related country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
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
has_resources_rights state = <scope> / <variable> 要检查的州。在国家作用域中使用时为必填。

resources = { <resource> <...> <resource> }
Resources to check for. Optional, defaults to any if unset.

has_resources_rights = {
  state = 123
  resources = { oil steel }
}
Checks if there are any resource rights with the specified parameters. 可用于州作用域或国家作用域。如果该州没有资源,则始终返回 false。

也可在州作用域使用。

1.12
core_compliance occupied_country_tag = <TAG> 要检查顺从度的国家。

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> 要检查抵抗度的国家。

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>要检查的数量。
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> 要检查的国家。

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 <法令 ID>
The law to check.
POL = {
  POL = {
    occupation_law = foreign_civilian_oversight
  }
}
# 检查 POL 的默认占领法令
HOL = {
  BEL = {
    occupation_law = foreign_civilian_oversight
  }
}
# 检查 HOL 对 BEL 的占领法令
Checks the occupation law that's either the default or applied over a specific country. 检查PREV's对当前国家的占领法令。如果二者作用域相同,则检查默认占领法令。

也可在州作用域使用。

1.12
has_contested_owner <州> / <变量>
State to check.
has_contested_owner = 42
Checks if a state has the specified country as a contested owner. The trigger can be used either from a country or a state scope and accepts the other as parameter. 也可在州作用域使用。 1.15
owns_any_state_of <states>
States to check.
owns_any_state_of = {
  123
  246
}
Check if the country owns any of the states in the list. 等同于:
OR = {
  owns_state = 123
  owns_state = 246
}
1.16
is_on_same_continent_as <scope> / <variable>
The state to check for.
is_on_same_continent_as = 111
Checks if the scope country is on the same continent as the given state. The capital state is used for given country tag. 也可在州作用域使用。 1.17

军事

Military-related country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
has_army_experience <浮点数> / <变量>
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 <浮点数> / <变量>
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 <浮点数> / <变量>
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 <浮点数> / <变量>
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 <浮点数> / <变量>
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 <浮点数> / <变量>
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 <浮点数> / <变量>
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> 造成这些伤亡的国家标签。

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> 布尔值。
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> 要检查的国家。

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.[2] Must use > or < in the ratio. 1.0
fighting_army_strength_ratio tag = <scope> 要检查的国家。

ratio <>= <float> / <variable>
The ratio to check for.

fighting_army_strength_ratio = {
    tag = GER
    ratio > 0.7
}
Compares the total army fighting strength between the scope country and the one set with 'tag'. Ratio can be '<','>' or '='. 1.15
alliance_strength_ratio <浮点数> / <变量>
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 <浮点数> / <变量>
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 <浮点数> / <变量>
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 <浮点数> / <变量>
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> 要检查的数量。

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> 要检查的数量。

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> 要检查的数量。

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> 要检查的数量。

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> 要检查的数量。

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> 要检查的数量。

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> 要检查的数量。

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> 要检查的数量。

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> 要检查的数量。

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> 要检查的数量。

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> 要检查的国家。

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> 其海岸被布设水雷的国家。

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> 包含这些雷区的战略地区。

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
has_tactic <tactic>
The tactic to check for.
has_tactic = tactic_masterful_blitz
Check if the given tactic is unlocked (or active by default) for the country. 1.17

学说

Doctrine-related country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
has_any_grand_doctrine <string>
Doctrine folder.
has_any_grand_doctrine = land
Checks if any grand doctrine in folder is currently active for the country. Folders are land, naval and air. 1.17.2
has_doctrine <grand doctrine> / <subdoctrine>
The doctrine to check for.
has_doctrine = mobile_warfare # Grand doctrine
has_doctrine = mobile_infantry # Subdoctrine
Checks if the given grand doctrine or subdoctrine is currently active for the country. 1.17
has_subdoctrine_in_track <track>
The track to check for.
has_subdoctrine_in_track = infantry
Checks if any subdoctrine is currently assigned to (any instance of) the given track. 1.17
has_completed_subdoctrine <subdoctrine>
The subdoctrine to check for.
has_completed_subdoctrine = mobile_infantry
Checks if the current country has ever completed the specified subdoctrine (even if it was later switched out). 1.17
has_completed_track <track>
The track to check for.
has_completed_track = infantry
Checks if the given subdoctrine track has been completed 1.17
has_mastery amount = <int> 要检查的数量。

track = <track>
The track to check for.

has_mastery = {
    amount = 200
    track = infantry
}
Checks if any track of the given type has at least X mastery. 1.17
has_mastery_level amount = <int> 要检查的数量。

sub_doctrine = <subdoctrine>
The subdoctrine to check for.

has_mastery_level = {
    amount = 2
    sub_doctrine = mobile_infantry
}
Checks if the country has reached the specified number of mastery levels (rewards) for the given subdoctrine. 1.17

装备

Equipment-related country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
stockpile_ratio archetype = <string> 要检查的装备原型。

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> 布尔值。
has_any_license = yes
Checks if the current scope has any licenses from other countries. 1.0
is_licensing_any_to <scope> / <variable>
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> 要检查的国家。

archetype = <string>
The equipment archetype to check for. Optional.
装备作用域
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> 要检查的国家。

archetype = <string>
The equipment archetype to check for. Optional.
装备作用域
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 <浮点数> / <变量>
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 <整数> / <变量>
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-related country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
estimated_intel_max_piercing tag = <scope> 要检查的国家。

value = <int>
The amount to check for.

estimated_intel_max_piercing = {
    tag = GER
    value > 2
}
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> 要检查的国家。

value = <int>
The amount to check for.

estimated_intel_max_armor = {
    tag = GER
    value > 2
}
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> / <variable> 要与之比较的目标。

civilian_intel <>= <float> / <variable>
Comparison of civilian intel.
army_intel <>= <float> / <variable>
Comparison of army intel.
navy_intel <>= <float> / <variable>
Comparison of navy intel.
airforce_intel <>= <float> / <variable>
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> / <variable> 要与之比较的目标。

civilian_intel <>= <float> / <variable>
Comparison of civilian intel.
army_intel <>= <float> / <variable>
Comparison of army intel.
navy_intel <>= <float> / <variable>
Comparison of navy intel.
airforce_intel <>= <float> / <variable>
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> / <variable> 被检查的国家。

value <> <float> / <variable>
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> 被检查的国家。

state = <id> / <variable>
The state which is checked.
value <> <float> / <variable>
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 <整数> / <变量>
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> 要与之比较的国家。

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> 该行动所针对的国家。

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> 该行动所针对的国家。

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> 该行动所针对的国家。

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> 该行动所针对的国家。

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> 该行动所针对的国家。

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> 布尔值。
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:
名称 参数 示例 描述 备注 加入版本
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> 要检查的国家。

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

角色

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

Character-related country-scoped triggers:
名称 参数 示例 描述 备注 加入版本
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 <意识形态>

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> 布尔值。
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
has_scientist_specialization specialization = <specialization_token>
Specialization.
has_scientist_specialization = specialization_nuclear
Checks if the country in scope has a scientist with a skill level of at least 1 in specialization. 1.15

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:
名称 参数 示例 描述 备注 加入版本
pc_is_winner <bool> 布尔值。
pc_is_winner = yes
Checks if the current scope is a winner within the peace conference. 1.12
pc_is_on_winning_side <bool> 布尔值。
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> 布尔值。
pc_is_loser = yes
Checks if the current scope is a loser within the peace conference. 1.12
pc_is_untouched_loser <bool> 布尔值。
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> 布尔值。
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> 布尔值。
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> 布尔值。
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

Faction scope

Can be used in 阵营 scope.

There are currently no faction-specific triggers.

州作用域

Can be used in 州 scope.

通用

General state-scoped triggers:
名称 参数 示例 描述 备注 加入版本
州 <scope> / <variable>
The state to check for.
state = 10
state = var:state
Checks if the current scope is the specified state. 1.0
地区 <int>
The strategic region id to check for.
地区=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. 必须使用 > 或 < 运算符。

Can also be used in building scope.

1.0
free_building_slots building = <string> 要检查的建筑。

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> 要检查的建筑。

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> 要检查的建筑。

limit = <int>
The amount to check for.
省份作用域
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> 要检查的标记。

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> 布尔值。
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> 布尔值。
is_demilitarized_zone = yes
Checks if the current scope is a demilitarized zone. 1.0
is_border_conflict <bool> 布尔值。
is_border_conflict = yes
Checks if the current scope is part of a border war. 1.0
is_in_home_area <bool> 布尔值。
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> 布尔值。
is_coastal = yes
Checks if the current scope is a coastal state. 1.0
is_one_state_island <bool> 布尔值。
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> 布尔值。
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
is_on_same_continent_as <scope> / <variable>
The country to check for.
is_on_same_continent_as = FRA
Checks if the scope state is on the same continent as the given state. The capital state is used for given country tag. 也可在国家作用域中使用。 1.17
impassable <bool> 布尔值。
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> 要检查的国家。

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> 要检查的距离。

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> 要检查的战略地区。

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. 数量必须使用 > 或 < 运算符。

也可在国家作用域中使用。

???
has_resources_amount resource = <string> 要检查的资源。

amount = <int>
The amount to check for.
delivered = <bool>
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 receiver = <scope> 资源权利的接收方。在州作用域中使用时为必填。

resources = { <resource> <...> <resource> }
Resources to check for. Optional, defaults to any if unset.

has_resources_rights = {
  receiver = POL
  resources = { oil steel }
}
Checks if there are any resource rights with the specified parameters. 可用于州作用域或国家作用域。如果该州没有资源,则始终返回 false。

也可在国家作用域中使用。

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> 要检查的州。

<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> 要检查的州。

<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> 要检查的州。

<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> 布尔值。
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> 布尔值。
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
can_construct_building <build type>The type of building. can_construct_building = bunker Checks if the country (as ROOT) and state in scope can build a building in the state. 1.15
has_contested_owner <国家> / <变量>
Country to check.
has_contested_owner = GER
Checks if a state has the specified country as a contested owner. The trigger can be used either from a country or a state scope and accepts the other as parameter. 也可在国家作用域中使用。 1.15

抵抗与顺从度

Resistance-related state-scoped triggers:
名称 参数 示例 描述 备注 加入版本
顺从度 <int>
The amount to compare with.
顺从度>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> 布尔值。
has_active_resistance = yes
Checks if the current scope has non-zero resistance. 1.9
has_resistance <bool> 布尔值。
has_resistance = yes
Checks if the current scope has resistance. 1.9
抵抗度 <int>
The amount to compare with.
抵抗度>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

角色作用域

Can be used in 角色 scope.

通用

General character-scoped triggers:
名称 参数 示例 描述 备注 加入版本
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> 布尔值。
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> 布尔值。
is_country_leader = yes
Checks if the character in the current scope is the active country leader. 1.11
is_unit_leader <bool> 布尔值。
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> 布尔值。
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> 布尔值。
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> 布尔值。
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> 布尔值。
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> 布尔值。
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> 布尔值。
is_navy_leader = yes
Checks if the character in the current scope has an navy leader (Admiral) role. 1.11
is_high_command <bool> 布尔值。
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> 布尔值。
is_corps_commander = yes
Checks if the character in the current scope is a corps commander. 1.11
is_operative <bool> 布尔值。
is_operative = yes
Checks if the character in the current scope is an operative. 1.11
is_political_advisor <bool> 布尔值。
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> 布尔值。
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> 布尔值。
has_air_ledger = yes
Checks if the character in the current scope has an air ledger. 1.11
has_army_ledger <bool> 布尔值。
has_army_ledger = yes
Checks if the character in the current scope has an army ledger. 1.11
has_navy_ledger <bool> 布尔值。
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> 要检查的标记。

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

顾问

These triggers are to be used specifically for advisors.

Advisor-scoped triggers:
名称 参数 示例 描述 备注 加入版本
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> 布尔值。

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
has_advisor_role <slot>
The slot to check in.
has_advisor_role = political_advisor
Checks if the character in scope has an advisor role for the given slot. 可用顾问 role slots. ???

国家领袖

These triggers are to be used specifically for country leaders.

Country leader-scoped triggers:
名称 参数 示例 描述 备注 加入版本
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

部队领袖

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

Unit leader-scoped triggers:
名称 参数 示例 描述 备注 加入版本
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> 要检查的标记。

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> 布尔值。
is_leading_army = yes
Checks if the current scope is leading a single army. 1.5
is_leading_army_group <bool> 布尔值。
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> 布尔值。
is_field_marshal = yes
Checks if the current scope is a Field Marshal. 1.5
is_assigned <bool> 布尔值。
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> 布尔值。
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> 布尔值。
is_exiled_leader = yes
Checks if the current scope is a general from an exiled country. 1.6
is_exiled_leader_from <tag>国家。
is_exiled_leader_from = POL
Checks if the current scope is a general from the specified exiled country. 1.6
is_female <bool> 布尔值。
is_female = yes
Checks if the current scope is female. Works for aces. 1.9
is_leading_army_in_province <province id>
is_leading_army_in_province = 1234
Checks if the current unit leader is leading an army that has any division in a specific province 1.17

特工

These triggers only work for operatives.

Operative-scoped triggers:
名称 参数 示例 描述 备注 加入版本
has_nationality <tag>
The nationality to check.
has_nationality = POL
Checks if the current operative has the nationality. 1.9
is_operative_captured <bool> 布尔值。
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

科学家

These triggers only work for scientists.

Scientist-scoped triggers:
名称 参数 示例 描述 备注 加入版本
has_scientist_level level = <int> 要检查的等级。

specialization = <specialization_token>
Specialization.

has_scientist_level = {
  level > 2
  specialization = specialization_nuclear
}
Checks if the scientist of the character in scope matches the skill level condition for a specialization. Supports < > = operators. 1.15
is_active_scientist <bool>
is_scientist_active = yes
Checks if the scientist of the character in scope is assigned to a project. 1.15
is_scientist_injured <bool>
is_scientist_injured = yes
Checks if the scientist of the character in scope is injured. 1.15

战斗

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

Combatant-scoped triggers:
名称 参数 示例 描述 备注 加入版本
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
装甲 <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
预备机 <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> 要检查的天气。

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> 布尔值。
phase = yes
Checks if the current scope is in phase. 1.0
recon_advantage <bool> 布尔值。
recon_advantage > 0
Checks if the current scope has x recon advantage. 1.0
night <bool> 布尔值。
night = yes
Checks if the current scope is fighting at night. 1.0
frontage_full <bool> 布尔值。
frontage_full = yes
Checks if the current scope has a full combat width. 1.0
has_flanked_opponent <bool> 布尔值。
has_flanked_opponent = yes
Checks if the current scope has flanked their opponent. 1.0
has_max_planning <bool> 布尔值。
has_max_planning = yes
Checks if the current scope has the maximum planning bonus. 1.0
has_reserves <bool> 布尔值。
has_reserves = yes
Checks if the current scope has any reserves waiting. 1.0
is_amphibious_invasion <bool> 布尔值。
is_amphibious_invasion = yes
Checks if the current scope is performing an amphibious invasion. 1.0
is_attacker <bool> 布尔值。
is_attacker = yes
Checks if the current scope is attacking. 1.0
is_defender <bool> 布尔值。
is_defender = yes
Checks if the current scope is defending. 1.0
is_winning <bool> 布尔值。
is_winning = yes
Checks if the current scope is winning their battle. 1.0
is_fighting_air_units <bool> 布尔值。
is_fighting_air_units = yes
Checks if the current scope is fighting air units. 1.0
less_combat_width_than_opponent <bool> 布尔值。
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> 布尔值。
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> 布尔值。
has_carrier_airwings_in_own_combat = yes
Checks if the current scope has carrier airwings in their own combat. 1.0
has_artillery_ratio <float>
has_artillery_ratio > 0.1
Check that ratio of atrillery battalions in the composition of a side of combating troops are over a certain level. ???
has_unit_type <unit_type>
has_unit_type = amphibious_mechanized
Check if the combatant has at least one of the provided unit types. ???

师作用域

Can be used in 师 scope.

Division-scoped triggers:
名称 参数 示例 描述 备注 加入版本
division_has_majority_template <营>
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 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 <float>
The amount 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_organization <float>
The amount 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> 布尔值。
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
has_officer_name <string>
The localization key to check.
has_officer_name = FIN_nikke_parmi
Checks if the current division has an officer with the provided name key.

军工组织作用域

Can be used in Military-industrial organisation scope.

MIO-scoped triggers:
名称 参数 示例 描述 备注 加入版本
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> 布尔值。
is_mio_visible = yes
Checks if the currently-scoped MIO is visible. 1.13
is_mio_available <bool> 布尔值。
is_mio_available = yes
Checks if the currently-scoped MIO is visible. 1.13
is_mio_assigned_to_task <bool> 布尔值。
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> 要检查的特质。

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> 要检查的特质。

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> 要检查的特质。

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> 要检查的标记。

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

合同作用域

Can be used in purchase contract scope.

Contract-scoped triggers:
名称 参数 示例 描述 备注 加入版本
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 to check.
seller = BHR
Checks the seller in the current purchase contract. 1.13
buyer <国家>
Country to check.
buyer = OMA
Checks the buyer in the current purchase contract. 1.13

Special projects

Special project-scoped triggers:
名称 参数 示例 描述 备注 加入版本
has_project_flag <string> 要检查的标记。

OR
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_project_flag = my_flag
has_project_flag = {
  flag = my_flag
  value < 12
  date > 1936.3.25
  days > 365
}
Check if flag has been set within the special project in scope. May checks on the value or date/days since last modified date. If not set, the value comparison is >0. value is limited between -32768 and 32767. 1.15

Meta triggers

Meta triggers are a system added with 1.6 with 全民持枪[3] 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 用户目录'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 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和/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_CALL_ALLY_TITLE:0 "Call to arms" would suggest that the diplomatic action of calling ally to war is CALL_ALLY.

List of known triggers:

DIPLOMACY_JOIN_ALLY_ENABLE_TRIGGER
DIPLOMACY_CALL_ALLY_ENABLE_TRIGGER
DIPLOMACY_WAR_ENABLE_TRIGGER
DIPLOMACY_JOIN_FACTION_ENABLE_TRIGGER
DIPLOMACY_CREATE_FACTION_ENABLE_TRIGGER	
DIPLOMACY_PEACE_PROPOSAL_ENABLE_TRIGGER
DIPLOMACY_IMPROVERELATION_ENABLE_TRIGGER
DIPLOMACY_NONAGGRESSIONPACT_ENABLE_TRIGGER
DIPLOMACY_REVOKE_NONAGGRESSIONPACT_ENABLE_TRIGGER
DIPLOMACY_OFFER_JOIN_FACTION_ENABLE_TRIGGER
DIPLOMACY_REQUEST_FOREIGN_MANPOWER_ENABLE_TRIGGER
DIPLOMACY_CANCEL_FOREIGN_MANPOWER_ENABLE_TRIGGER
DIPLOMACY_CANCEL_LICENSED_PRODUCTION_ENABLE_TRIGGER
DIPLOMACY_REQUEST_ACCESS_TO_LICENCE_PRODUCTION_ENABLE_TRIGGER
DIPLOMACY_SEND_ATTACHE_ENABLE_TRIGGER
DIPLOMACY_EMBARGO_ENABLE_TRIGGER
DIPLOMACY_SEND_EXP_FORCE_ENABLE_TRIGGER
DIPLOMACY_REQUEST_EXP_FORCE_ENABLE_TRIGGER
DIPLOMACY_RETURN_EXP_FORCE_ENABLE_TRIGGER
DIPLOMACY_ASKSTATECONTROL_ENABLE_TRIGGER
DIPLOMACY_GIVESTATECONTROL_ENABLE_TRIGGER
DIPLOMACY_GUARANTEE_ENABLE_TRIGGER
DIPLOMACY_REVOKE_GUARANTEE_ENABLE_TRIGGER
DIPLOMACY_RELEASE_NATION_ENABLE_TRIGGER
DIPLOMACY_MILACC_ENABLE_TRIGGER
DIPLOMACY_OFFER_MILACC_ENABLE_TRIGGER
DIPLOMACY_REVOKE_OFFER_MILACC_ENABLE_TRIGGER
DIPLOMACY_DOCKING_RIGHTS_ENABLE_TRIGGER
DIPLOMACY_OFFER_DOCKING_RIGHTS_ENABLE_TRIGGER
DIPLOMACY_AIR_BASE_ACCESS_ENABLE_TRIGGER
DIPLOMACY_OFFER_AIR_BASE_ACCESS_ENABLE_TRIGGER
DIPLOMACY_REVOKE_OFFER_DOCKING_RIGHTS_ENABLE_TRIGGER
DIPLOMACY_REVOKE_OFFER_AIR_BASE_ACCESS_ENABLE_TRIGGER
DIPLOMACY_LEND_LEASE_ENABLE_TRIGGER
DIPLOMACY_INCOMING_LEND_LEASE_ENABLE_TRIGGER
DIPLOMACY_REQUEST_LICENSED_PRODUCTION_ENABLE_TRIGGER
DIPLOMACY_GENERATE_WARGOAL_ENABLE_TRIGGER
DIPLOMACY_BOOST_PARTY_POPULARITY_ENABLE_TRIGGER
DIPLOMACY_STAGE_COUP_ENABLE_TRIGGER
DIPLOMACY_LEAVE_FACTION_ENABLE_TRIGGER
DIPLOMACY_ASSUME_FACTION_LEADERSHIP_ENABLE_TRIGGER
DIPLOMACY_KICK_FROM_FACTION_ENABLE_TRIGGER
DIPLOMACY_SEND_VOLUNTEERS_ENABLE_TRIGGER

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:
名称 Scope 示例 描述 备注
can_ROOT_get_wargoal_on_THIS 国家
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 国家
is_free_or_subject_of_root = yes
Checks if the current scope is either independent or a subject of ROOT.
has_same_ideology 国家
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 国家
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 州
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 州
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 州
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 州
owns_or_subject_of = yes
Checks if the current scope is owned by ROOT or a subject of ROOT.

参考文献与注释

^ 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.

  1. ↑ [Modding] Achievement for mods
    Tutorial to write achievements files in your mod
  2. ↑ forum:1356228/#post-26361808
  3. ↑ HOI4 Dev Diary - Modding and Traits
模组制作
文档 效果 • 触发器 • 定义文件 • 修正项 • 修正项列表 • 作用域 • 本地化文件 • 事件钩子 • 数据结构(标记、事件目标、国家标签别名、变量、数组)
脚本 成就 • AI • AI 焦点 • 自治领 • 力量均势 • 书签/剧本 (游戏规则) • 建筑 • 角色与特质 • 外观标签 • 国家 • 师 • 决议 • 学说 • 装备 • 事件 • 阵营 • 理念 • 意识形态 • 军事工业组织 • 国策 • 资源 • 脚本化 GUI • 科技与学说 • 单位
地图 地图 • 州 • 补给区域 • 战略区域
图形 界面 • 图形资源 • 实体 • 后期特效 • 粒子 • 字体
外观 肖像 • 名称列表 • 音乐 • 音效
其他 控制台指令 • 疑难排查 • 模组结构 • 模组 • 地图编辑器