Wiki

trigger · any_controlled_state

Definition

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

Description

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

实战 · 配合 · 坑

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

实战用法

any_controlled_state 常用于检测某国是否控制了至少一个满足特定条件的州,例如判断是否占领了工业重镇、特定资源州或核心州,以此触发事件或解锁决议。典型场景包括:占领条件、战时补给判断、成就/决议的 available 块。

# 判断某国是否控制了至少一个拥有高等级基础设施的核心州
any_controlled_state = {
    is_core_of = ROOT
    free_building_slots = {
        building = industrial_complex
        size > 0
        include_locked = yes
    }
}
# 在决议 available 中:确保该国控制至少一个沿海州
available = {
    any_controlled_state = {
        is_coastal = yes
    }
}

配合关系

  • all_neighbor_stateany_controlled_state 确认是否控制某类州后,可进一步用 all_neighbor_state 对该州的所有邻接州施加条件,形成区域扩张链式判断。
  • is_owned_by:常在 any_controlled_state 内部配合使用,区分"控制但非占有"与"控制且拥有"两种情形,避免逻辑误判。
  • has_state_flag:在 any_controlled_state 块内检测某州是否已被标记过特定事件或流程,防止重复触发。
  • building_count_trigger:与 any_controlled_state 组合,用于检查该国是否控制了至少一个达到指定建筑等级的州,常用于工业或军事条件判断。

常见坑

  1. 误将其当作 all_controlled_state 使用any_controlled_state 只要有一个州满足条件即为真,若想要求所有被控制的州都满足条件,需换用对应的 all_state(配合 is_controlled_by = ROOT)或重新设计逻辑,直接套用往往导致条件比预期宽松得多。
  2. 混淆"控制"与"拥有"any_controlled_state 基于控制权(controller),即便是被他国占领的本国州也不在范围内,而自己占领的他国州则在范围内;如果业务逻辑需要的是"拥有"(owner),应改用对应的 owned 类遍历,或在块内加 is_owned_by = ROOT 进行二次过滤。

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_controlled_state is commonly used to check whether a country controls at least one state that meets specific conditions — for example, determining whether an industrial hub, a resource-rich state, or a core state has been occupied — in order to fire events or unlock decisions. Typical use cases include occupation conditions, wartime supply checks, and available blocks for achievements or decisions.

# Check whether a country controls at least one core state with available industrial complex building slots
any_controlled_state = {
    is_core_of = ROOT
    free_building_slots = {
        building = industrial_complex
        size > 0
        include_locked = yes
    }
}
# In a decision's available block: ensure the country controls at least one coastal state
available = {
    any_controlled_state = {
        is_coastal = yes
    }
}

Synergy

  • all_neighbor_state: After using any_controlled_state to confirm control of a certain type of state, you can follow up with all_neighbor_state to apply conditions to all states adjacent to it, building a chain of regional expansion checks.
  • is_owned_by: Frequently used inside any_controlled_state to distinguish between "controlled but not owned" and "controlled and owned," preventing logical false positives.
  • has_state_flag: Used within an any_controlled_state block to check whether a state has already been flagged by a specific event or process, preventing duplicate triggers.
  • building_count_trigger: Combined with any_controlled_state to verify whether a country controls at least one state that has reached a specified building level; commonly used for industrial or military conditions.

Common Pitfalls

  1. Mistaking it for all_controlled_state: any_controlled_state evaluates to true as long as one state satisfies the conditions. If you need all controlled states to satisfy the conditions, you should use the corresponding all_state (paired with is_controlled_by = ROOT) or redesign the logic entirely — using any_controlled_state in that scenario will make your condition far more permissive than intended.
  2. Confusing "control" with "ownership": any_controlled_state operates on control (controller), meaning your own states that are occupied by another country fall outside its scope, while enemy states you have occupied fall within it. If your logic actually requires ownership (owner), switch to the corresponding owned-state iteration, or add is_owned_by = ROOT as a secondary filter inside the block.