Wiki

trigger · is_faction_leader

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

check if country leads a faction

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

is_faction_leader 常用于判断某国是否为阵营领袖,从而解锁专属决议、焦点或顾问——例如只有阵营领袖才能发动联合宣战或主导外交行动。在科技共享、派系影响力等系统中,也经常用它来区分领袖与普通成员的不同逻辑分支。

# 只有阵营领袖才能激活该决议
available = {
    is_faction_leader = yes
}

配合关系

  • [any_allied_country](/wiki/trigger/any_allied_country):常与 is_faction_leader 搭配,在确认本国是领袖后,再遍历盟友做进一步条件检查(如判断某盟友是否满足特定条件)。
  • [create_wargoal](/wiki/effect/create_wargoal):确认本国是阵营领袖后,才允许对目标国生成战争目标,避免非领袖国家触发不合逻辑的宣战流程。
  • [dismantle_faction](/wiki/effect/dismantle_faction):通常在 is_faction_leader = yes 的前提下才执行解散派系的 effect,因为只有领袖有权解散自己的阵营。
  • [any_faction_member](/wiki/trigger/any_faction_member):配合使用,先判断当前国是否领袖,再检查阵营内成员构成,实现更精细的阵营规模或成员资质判断。

常见坑

  1. is_in_faction 混淆is_faction_leader 只在该国同时处于某个阵营是其领袖时返回 yes;如果该国不在任何阵营,结果为 no,而不是报错——新手容易误以为"没有阵营"会导致脚本崩溃,从而写出多余的保护判断。
  2. 在 effect 块中直接使用:这是一个 trigger,不能放在 effect 块的顶层直接执行;必须将它放在 limit = { } 或其他条件块内,否则游戏解析时会报脚本错误。

Hands-On Notes

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.

Hands-On Usage

is_faction_leader is commonly used to check whether a country is a faction leader, thereby unlocking exclusive decisions, focuses, or advisors—for example, only faction leaders can initiate joint declarations of war or lead diplomatic actions. In systems involving technology sharing and faction influence, it's also frequently used to differentiate logic branches between leaders and ordinary members.

# Only faction leaders can activate this decision
available = {
    is_faction_leader = yes
}

Synergy

  • [any_allied_country](/wiki/trigger/any_allied_country): Often paired with is_faction_leader to confirm the country is a leader first, then iterate through allies for further condition checks (such as determining whether a specific ally meets certain criteria).
  • [create_wargoal](/wiki/effect/create_wargoal): After confirming the country is a faction leader, allows generating a war goal against a target nation, preventing non-leader countries from triggering illogical war declaration processes.
  • [dismantle_faction](/wiki/effect/dismantle_faction): Typically executed only when is_faction_leader = yes, since only the leader has the authority to dismantle their own faction.
  • [any_faction_member](/wiki/trigger/any_faction_member): Used together to first check if the current country is a leader, then examine faction membership composition, enabling more granular judgments about faction size or member qualifications.

Common Pitfalls

  1. Confusion with is_in_faction: is_faction_leader returns yes only when the country is simultaneously in a faction and is its leader; if the country is not in any faction, the result is no rather than an error—newcomers often mistakenly believe that "having no faction" will cause a script crash, leading them to write unnecessary safeguard checks.
  2. Direct use in effect blocks: This is a trigger and cannot be placed directly at the top level of an effect block; it must be placed within a limit = { } or other conditional block, otherwise the game parser will report a script error.