Wiki

trigger · all_state

Definition

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

Description

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

实战 · 配合 · 坑

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

实战用法

all_state 常用于需要验证某个国家名下所有州都满足特定条件的场景,例如检查某国所有核心州是否都已被占领、所有目标省份是否都达到了特定建设等级。典型应用包括胜利条件判断、决议解锁条件或事件触发器。

# 检查 ROOT 控制的所有州是否都已达到合规度阈值并属于特定大区
focus = {
    available = {
        all_state = {
            limit = { is_owned_by = ROOT }
            compliance > 50
            is_on_continent = europe
        }
    }
}
# 判断某国所有州是否都被己方完全控制(用于胜利事件)
trigger = {
    all_state = {
        limit = { is_core_of = GER }
        is_fully_controlled_by = GER
    }
}

配合关系

  • any_state — 与 all_state 互补,前者检查"至少一个",后者检查"全部",配合使用可构造精确的数量范围逻辑。
  • is_controlled_by — 常嵌套在 all_state 内部,用于验证每个州的控制权归属。
  • has_state_flag — 嵌套使用时可筛选出被打过特定标记的州,确认整批州是否都经历过某一事件流程。
  • compliance — 直接在 all_state 块内作子条件使用,批量检查所有目标州的合规度是否达标。

常见坑

  1. 忘记使用 limit 预筛范围all_state 默认遍历游戏内全部州,若不加 limit 缩小范围,条件会对所有 1000+ 个州生效,极易因为荒野或中立州不满足条件而永远返回假,导致触发器永不成立。
  2. scope 指向错误all_state 属于 any scope,可在大多数上下文调用,但其内部子触发器的 scope 已切换为,此时若误用国家级 trigger(如直接写 has_war = yes)会因 scope 不匹配而报错或静默失败,需通过 OWNER / CONTROLLER 等目标跳转回国家 scope 再判断。

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_state is commonly used when you need to verify that every state owned by a country meets a specific condition — for example, checking whether all of a nation's core states have been occupied, or whether all target provinces have reached a certain construction level. Typical applications include victory condition checks, decision unlock requirements, and event triggers.

# Check whether all states owned by ROOT have exceeded the compliance threshold and are on a specific continent
focus = {
    available = {
        all_state = {
            limit = { is_owned_by = ROOT }
            compliance > 50
            is_on_continent = europe
        }
    }
}
# Check whether all of a country's states are fully controlled by that country (used in victory events)
trigger = {
    all_state = {
        limit = { is_core_of = GER }
        is_fully_controlled_by = GER
    }
}

Synergy

  • any_state — The counterpart to all_state: the former checks "at least one," the latter checks "all." Using them together lets you construct precise quantity-range logic.
  • is_controlled_by — Frequently nested inside all_state to verify which country controls each individual state.
  • has_state_flag — When nested, allows you to filter for states that have been assigned a specific flag, confirming whether an entire batch of states has passed through a particular event chain.
  • compliance — Used directly as a sub-condition inside an all_state block to bulk-check whether all target states meet a compliance threshold.

Common Pitfalls

  1. Forgetting to use limit to pre-filter the scope: all_state iterates over every state in the game by default. Without a limit to narrow the range, the condition applies to all 1,000+ states, and it will almost certainly return false because wastelands or neutral states fail the condition — meaning the trigger will never fire.
  2. Wrong scope target: all_state is an any-scope trigger and can be called in most contexts, but the sub-triggers inside it have already switched scope to a state. If you mistakenly use a country-level trigger there (such as writing has_war = yes directly), it will cause a scope mismatch error or silently fail. You need to redirect back to a country scope first via targets such as OWNER or CONTROLLER before making that kind of check.