Wiki

trigger · any_state_in

Definition

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

Description

check if any state in the given category meets the trigger.
tooltip=key can be defined to override title.
The trigger takes one of the followings:
	array: an array of states.
	continent: A continent.
	ai_area: The id of an area.
	strategic_region: The id of an region.

* Note that no default tooltip is available for array and ai_area.
Example:
Check if the trigger is valid in any state in a continent:
any_state_in = {	conteinent = europe
	FOO_TRIGGER = BAR
}

实战 · 配合 · 坑

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

实战用法

any_state_in 常用于检查某大洲或战略区域内是否存在满足特定条件的省份,例如判断欧洲大陆上是否有任意一个州已被某国占领、达到特定顺从度阈值,或拥有某种建筑。典型场景包括:触发大陆解放决议的可用条件、判断某区域内是否存在抵抗活动等。

# 检查欧洲是否存在任意一个被玩家控制且顺从度低于50的州
available = {
    any_state_in = {
        continent = europe
        is_controlled_by = ROOT
        compliance < 50
    }
}

配合关系

  • is_controlled_by:常用于在大陆或战略区域的筛选中进一步确认该州的实际控制归属,避免误判占领地。
  • has_resistance:与 any_state_in 搭配,快速检查某一区域内是否存在激活的抵抗运动,用于触发镇压相关决议的条件。
  • compliance:在检查区域内州的顺从度范围时使用,常与大陆过滤联合判断占领管理效果。
  • has_state_flag:用于在区域扫描时排除或筛选已被脚本打过标记的州,避免重复触发逻辑。

常见坑

  1. arrayai_area 不生成默认 tooltip:使用这两种参数时游戏不会自动显示触发条件说明,必须手动添加 custom_trigger_tooltip 包裹,否则玩家在 UI 中看到的条件框会是空白,非常难以调试。
  2. 拼写字段 continent 而非 conteinent:官方文档示例中存在笔误(conteinent),实际脚本必须写正确拼写 continent = europe,写成文档里的错误拼写会导致条件静默失败,不报错但永远返回假。

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_state_in is commonly used to check whether any state within a given continent or strategic region meets specific conditions — for example, determining whether any state on the European continent has been occupied by a particular country, has reached a certain compliance threshold, or contains a specific building. Typical use cases include: availability conditions for continental liberation decisions, and checks for whether resistance activity exists within a given region.

# Check if any state in Europe is controlled by ROOT and has compliance below 50
available = {
    any_state_in = {
        continent = europe
        is_controlled_by = ROOT
        compliance < 50
    }
}

Synergy

  • is_controlled_by: Frequently used alongside continent or strategic region filters to confirm the actual controller of a state, preventing false positives when dealing with occupied territories.
  • has_resistance: Pairs with any_state_in to quickly check whether any active resistance movement exists within a region, useful as an availability condition for suppression-related decisions.
  • compliance: Used when checking the compliance range of states within a region; often combined with continent filters to evaluate occupation management effectiveness.
  • has_state_flag: Used during region-wide scans to exclude or target states that have already been flagged by script, preventing duplicate trigger logic.

Common Pitfalls

  1. array and ai_area do not generate default tooltips: When using either of these parameter types, the game will not automatically display a description of the trigger condition. You must manually wrap the condition in custom_trigger_tooltip; otherwise the condition box shown to players in the UI will appear blank, making it extremely difficult to debug.
  2. Spell the field as continent, not conteinent: The official documentation contains a typo (conteinent). Your script must use the correct spelling continent = europe — using the misspelled version from the docs will cause the condition to silently fail: no error is thrown, but it will always return false.