Wiki

trigger · all_controlled_state

Definition

  • Supported scope:COUNTRY
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

check if all of the states controlled by the scope country meets the trigger. tooltip=key can be defined to override title

实战 · 配合 · 坑

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

实战用法

all_controlled_state 常用于判断某国是否已将其控制的所有州都建设到特定等级、达成特定合规度或满足特定类别条件,例如在胜利条件事件或国策完成检测中验证"全境已稳固占领"。它在限制决策可用性(available)或国策完成条件(completion_reward 前的 available)时尤为实用。

# 检查该国控制的所有州合规度是否均达到阈值,才允许触发"全面整合"决策
available = {
    all_controlled_state = {
        compliance > 50
    }
}

配合关系

  • compliance — 在 all_controlled_state 内部检测每个被控制州的合规度数值,是最典型的搭配用法。
  • is_fully_controlled_by — 常作为 all_controlled_state 的前置或并列条件,先确认该州无敌方驻扎再做进一步判断。
  • has_state_flag — 在循环每个被控州时检测是否已打上特定标记,用于追踪逐州的进度状态。
  • any_controlled_state(逻辑对照)— 实际白名单中与之对应的是 any_state;在设计逻辑时常将"全部满足"与"任意满足"对比使用,以区分严格条件与宽松条件。

常见坑

  1. scope 写错导致静默失败all_controlled_state 只能在 COUNTRY scope 下使用;若在 STATE scope 内直接调用(例如放在某个州的事件 trigger 块且未先切换到 owner),游戏会报 scope 错误或静默跳过,条件始终不成立,需要先用 OWNER = { all_controlled_state = { ... } } 切换到国家 scope。
  2. all_owned_state 混淆:控制(controlled)≠ 拥有(owned),被敌方占领的州仍属于己方 owned 但不在 controlled 范围内;若意图检测"所有领土"应改用对应的 owned 系列 trigger,否则在战时该条件会因己方被占州缺席而得出与预期不符的结果。

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_controlled_state is commonly used to check whether every state a country controls has reached a certain infrastructure level, compliance threshold, or other category-specific condition — for example, verifying "all territory is firmly occupied" inside victory-condition events or focus completion checks. It is especially useful when restricting decision availability (available) or gating a focus's completion conditions (the available block preceding completion_reward).

# Only allow the "Full Integration" decision to fire if every state
# this country controls has compliance above 50
available = {
    all_controlled_state = {
        compliance > 50
    }
}

Synergy

  • compliance — Checks the compliance value of each controlled state inside all_controlled_state; this is the most typical pairing.
  • is_fully_controlled_by — Often used as a prerequisite or parallel condition alongside all_controlled_state, confirming that no enemy units are present in a state before making further checks.
  • has_state_flag — Detects whether a specific flag has been set on each controlled state as the loop iterates, useful for tracking per-state progress.
  • any_controlled_state (logical counterpart) — The corresponding trigger in the whitelist is any_state; when designing logic it is common to contrast "all must match" with "at least one matches" to distinguish strict conditions from lenient ones.

Common Pitfalls

  1. Silent failure from wrong scope: all_controlled_state can only be used inside a COUNTRY scope. If it is called directly inside a STATE scope — for instance, placed in a state event's trigger block without first switching scope to the owner — the game will either throw a scope error or silently skip the block, causing the condition to never be satisfied. Use OWNER = { all_controlled_state = { ... } } to switch to the correct country scope first.
  2. Confusing all_controlled_state with all_owned_state: Controlled ≠ owned. States occupied by an enemy are still part of your country's owned states but are no longer in your controlled set. If the intent is to check "all territory," use the corresponding owned-series trigger instead; otherwise, during wartime this condition will silently exclude enemy-occupied states and produce results that differ from what was intended.