Wiki

trigger · all_character

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

check if all characters meets the trigger. tooltip=key can be defined to override title

实战 · 配合 · 坑

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

实战用法

all_character 常用于需要对一国所有角色做整体判断的场景,例如检查某国是否所有将领都已获得特定特质、或所有顾问都满足某项条件,从而触发特殊事件或解锁决策。

# 检查 GER 是否所有角色均为男性(无女性角色),用于某决策的 available 块
available = {
    tag = GER
    all_character = {
        NOT = { is_female = yes }
    }
}
# 在事件触发条件中,检查当前国家所有角色是否都拥有某特质
trigger = {
    all_character = {
        has_trait = politically_connected
    }
}

配合关系

  • has_trait — 最常见的内层条件,用于检查每个角色是否持有特定 trait,配合 all_character 实现"全员持有某特质"的判断。
  • is_advisor — 用于在 all_character 内部筛选顾问类角色,缩小判断范围后再附加其他条件。
  • is_country_leader — 配合 all_character 可排除或专项检查国家领导人是否满足条件。
  • custom_trigger_tooltip — 当 all_character 的判断逻辑复杂时,包裹在外层提供可读的本地化提示文本,改善玩家 UI 体验。

常见坑

  1. 作用域混淆all_character 仅在 COUNTRY scope 下有效,若在 STATEUNIT_LEADER 等 scope 内直接使用会导致脚本报错或静默失败,使用前务必确认当前 scope 为国家。
  2. any_character 语义混用all_character 要求所有角色满足条件(逻辑与),而 any_character 只需至少一个满足(逻辑或);新手常在只想检查"存在某角色"时误用 all_character,导致条件比预期严苛得多。

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

all_character is most commonly used when you need to evaluate all characters of a country as a whole — for example, checking whether every general has acquired a specific trait, or whether all advisors meet a certain condition, in order to fire a special event or unlock a decision.

# Check whether GER has no female characters at all, used in a decision's available block
available = {
    tag = GER
    all_character = {
        NOT = { is_female = yes }
    }
}
# In an event trigger, check whether every character in the current country has a specific trait
trigger = {
    all_character = {
        has_trait = politically_connected
    }
}

Synergy

  • has_trait — The most common inner condition; checks whether each character holds a specific trait, and combined with all_character produces an "every character has this trait" check.
  • is_advisor — Used inside all_character to filter down to advisor-type characters before applying additional conditions, narrowing the scope of the evaluation.
  • is_country_leader — Paired with all_character to either exclude the country leader from the check or specifically verify that the leader meets a condition.
  • custom_trigger_tooltip — When the logic inside all_character becomes complex, wrapping it in this trigger provides a readable localized tooltip, improving the player-facing UI experience.

Common Pitfalls

  1. Scope confusion: all_character is only valid within a COUNTRY scope. Using it directly inside a STATE, UNIT_LEADER, or other scope will cause a script error or a silent failure. Always confirm you are in a country scope before using it.
  2. Conflating all_character with any_character: all_character requires every character to satisfy the condition (logical AND), whereas any_character only requires at least one to satisfy it (logical OR). Beginners often mistakenly use all_character when they simply want to check whether a certain character exists, resulting in a condition far stricter than intended.