trigger · has_faction_template
Definition
- Supported scope:
COUNTRY - Supported target:
any
Description
Checks if the current country is in a faction with a template
### Examples
TAG = { has_faction_template = template_id }
has_faction_templateCOUNTRYanyChecks if the current country is in a faction with a template
### Examples
TAG = { has_faction_template = template_id }
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
has_faction_template 常用于基于阵营模板来限制某些决议、国策或事件的触发条件,例如只有当某国加入了特定意识形态模板的阵营(如自定义的"社会主义联盟模板")时才能触发后续剧情。在多派系 mod 中,可用它区分不同派系归属,从而给予差异化的奖励或惩罚。
# 只有加入了名为 my_custom_faction_template 的阵营时才可用该决议
available = {
has_faction_template = my_custom_faction_template
}
[create_faction_from_template](/wiki/effect/create_faction_from_template):用于先按模板创建阵营,随后用 has_faction_template 验证该国是否已处于对应模板的阵营中,两者构成"创建→检测"的完整流程。[any_allied_country](/wiki/trigger/any_allied_country):配合使用可在确认本国所在阵营类型的前提下,进一步遍历盟友,筛选出满足特定条件的阵营成员。[add_to_faction](/wiki/effect/add_to_faction):当某国尚未加入目标模板阵营时,可先用此 trigger 做反向判断,再通过 add_to_faction 将其拉入,避免重复操作。[compare_ideology_with_faction](/wiki/trigger/compare_ideology_with_faction):两者常并列使用,同时检查阵营模板与意识形态匹配度,实现更精细的阵营归属逻辑。has_faction_template 接受的是在 faction_templates 中定义的模板 ID(字符串),而非运行时的阵营名称或阵营领袖标签,混淆二者会导致条件永远不成立且没有任何报错提示。Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.
has_faction_template is commonly used to restrict certain decisions, focuses, or events based on faction template membership—for example, triggering a narrative chain only when a nation has joined a specific ideological template faction (such as a custom "Socialist Alliance Template"). In multi-faction mods, it can distinguish faction affiliation, enabling differentiated rewards or penalties.
# This decision is available only if the nation has joined a faction with the my_custom_faction_template template
available = {
has_faction_template = my_custom_faction_template
}
[create_faction_from_template](/wiki/effect/create_faction_from_template): Used to create a faction from a template first, then verify with has_faction_template whether the nation is already in a faction matching that template. Together they form a complete "creation → verification" workflow.[any_allied_country](/wiki/trigger/any_allied_country): When used in conjunction, it allows confirming the faction type of the current nation and then iterating through allies to filter faction members meeting specific criteria.[add_to_faction](/wiki/effect/add_to_faction): When a nation hasn't yet joined the target template faction, you can use this trigger for inverse logic first, then add it via add_to_faction to avoid redundant operations.[compare_ideology_with_faction](/wiki/trigger/compare_ideology_with_faction): Frequently used alongside this trigger to simultaneously check both faction template and ideology alignment, enabling more refined faction membership logic.has_faction_template accepts the template ID (string) defined in faction_templates, not the runtime faction name or faction leader tag. Confusing these will cause the condition to never evaluate true and produce no error messages.