Wiki

trigger · all_core_state

Definition

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

Description

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

实战 · 配合 · 坑

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

实战用法

all_core_state 常用于判断某国是否已完全收复其所有核心领土,例如在国策或决议的 available / trigger 块中检验"统一大业"是否达成。也可用于成就型事件,确认玩家已控制/拥有本国每一块核心州才触发奖励。

# 国策可用条件:所有核心州必须由本国拥有且控制
focus = {
    id = reclaim_all_cores
    available = {
        all_core_state = {
            is_owned_and_controlled_by = ROOT
        }
    }
}

配合关系

  • any_country_with_core — 先用该 trigger 找到拥有核心的国家,再配合 all_core_state 确认其是否已完整掌控所有核心州,形成双重核心判断逻辑。
  • is_owned_by — 在 all_core_state 的子 scope(STATE)内使用,用于检查每块核心州是否归属特定国家,是最典型的内部条件。
  • is_controlled_by — 与 is_owned_by 搭配,同时验证拥有与控制,防止核心州虽归属本国但被敌军占领的情况被误判为满足条件。
  • all_neighbor_state — 常与 all_core_state 并列使用,同时确认核心州和邻接州的状态,构建更严格的领土完整性判断。

常见坑

  1. 混淆 scope 层级all_core_state 会将 scope 切换到 STATE,其内部子条件必须使用 STATE scope 下有效的 trigger(如 is_owned_byis_controlled_by),若误写 COUNTRY scope 的 trigger(如直接写 has_war = yes)将导致脚本报错或静默失效。
  2. 忽略"无核心州"时的返回值:当某国当前没有任何核心州时,all_core_state 会返回 true(空集合上的全称量词恒真),若逻辑上希望"至少有一块核心州且全部满足条件",需额外用 any_country_with_core 或其他手段先确认核心州存在。

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_core_state is commonly used to check whether a country has fully reclaimed all of its core territories — for example, inside the available or trigger block of a national focus or decision to verify that a "unification" objective has been completed. It can also be used in achievement-type events to confirm that the player owns and controls every core state before granting a reward.

# Focus availability condition: all core states must be owned and controlled by this country
focus = {
    id = reclaim_all_cores
    available = {
        all_core_state = {
            is_owned_and_controlled_by = ROOT
        }
    }
}

Synergy

  • any_country_with_core — Use this trigger first to locate countries that have cores, then pair it with all_core_state to confirm whether that country has full control over every one of its core states, forming a two-layer core-validation logic.
  • is_owned_by — Used inside the child scope (STATE) of all_core_state to check whether each core state belongs to a specific country; this is the most typical inner condition.
  • is_controlled_by — Paired with is_owned_by to simultaneously verify both ownership and control, preventing a situation where a core state is owned by the country but occupied by enemy forces from being incorrectly evaluated as satisfying the condition.
  • all_neighbor_state — Often used alongside all_core_state to simultaneously validate the status of both core states and neighboring states, building a stricter check for territorial integrity.

Common Pitfalls

  1. Confusing scope levels: all_core_state switches the scope to STATE, so all inner conditions must use triggers that are valid in STATE scope (such as is_owned_by and is_controlled_by). Writing a COUNTRY-scope trigger inside it by mistake (e.g., has_war = yes directly) will cause a script error or silent failure.
  2. Overlooking the return value when no core states exist: If a country currently has no core states at all, all_core_state returns true (a universal quantifier over an empty set is vacuously true). If the intended logic is "at least one core state exists and all of them satisfy the condition," you need to separately confirm the existence of core states first, using any_country_with_core or another appropriate check.