Wiki

trigger · any_core_state

Definition

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

Description

Check if any of the country core states for scope meets the trigger. tooltip=key can be defined to override title

实战 · 配合 · 坑

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

实战用法

any_core_state 常用于判断某国是否对任意一块核心州满足特定条件,例如检测某国核心州中是否有至少一块处于敌对控制或达到特定合规度,从而触发事件或解锁决议。典型场景包括收复失地链,玩家通过此触发器确认本国某块核心州仍被他国占领时才显示相关决议。

# 判断本国是否存在任意一块核心州当前未被自己控制
any_core_state = {
    NOT = { is_controlled_by = ROOT }
}

配合关系

  • is_controlled_by — 与 any_core_state 嵌套,用于检测该核心州是否被特定国家控制,是收复领土逻辑的核心组合。
  • is_core_of — 在遍历州时反向确认该州是否为某国核心,与 any_core_state 形成互补检测。
  • compliance — 嵌套在 any_core_state 内部,检测某核心州的合规度是否达到解锁占领法律的阈值。
  • has_state_flag — 用于在 any_core_state 内排除已被标记处理过的州,防止决议或事件重复触发。

常见坑

  1. Scope 混用any_core_state 只能在 COUNTRY scope 下调用,若在 STATE scope(如 every_state 的内层)直接使用会导致脚本报错或静默失效,需先用 OWNERROOT 跳回国家 scope 再调用。
  2. 误以为检测所有核心州any_core_state 只要有一块核心州满足条件即返回真,若需要全部核心州都满足条件,应改用 all_core_state(触发器侧对应写法),否则逻辑判断会出现误判。

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

any_core_state is commonly used to check whether a country has at least one core state that meets a specific condition — for example, detecting whether any core state is under hostile control or has reached a certain compliance threshold, in order to fire an event or unlock a decision. A typical use case is a reconquest decision chain, where this trigger ensures the relevant decisions only appear when at least one of the player's core states is still occupied by another country.

# Check whether any of ROOT's core states is currently not controlled by ROOT itself
any_core_state = {
    NOT = { is_controlled_by = ROOT }
}

Synergy

  • is_controlled_by — Nested inside any_core_state to check whether a given core state is controlled by a specific country; this combination is the backbone of most reconquest logic.
  • is_core_of — When iterating over states, used in the reverse direction to confirm whether a state is a core of a given country; complements any_core_state for cross-checking ownership.
  • compliance — Nested inside any_core_state to check whether a core state's compliance has reached the threshold required to unlock occupation laws.
  • has_state_flag — Used inside any_core_state to exclude states that have already been flagged as processed, preventing decisions or events from firing more than once.

Common Pitfalls

  1. Scope mismatch: any_core_state can only be called from a COUNTRY scope. Using it directly inside a STATE scope (for example, within the body of every_state) will cause a script error or silent failure. You must first switch back to a country scope via OWNER or ROOT before calling it.
  2. Assuming it checks all core states: any_core_state returns true as soon as one core state satisfies the condition. If you need every core state to satisfy the condition, use all_core_state instead; otherwise your logic will produce false positives.