Wiki

trigger · num_of_controlled_states

Definition

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

Description

check amount of controlled stats

实战 · 配合 · 坑

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

实战用法

num_of_controlled_states 常用于判断一个国家是否扩张到足够规模,从而解锁特定决策、国策奖励或事件分支。例如在大国崛起 mod 中,可以用它限制某个强化 focus 只有当玩家实际掌控足够数量的地块时才可用。

# 只有当国家控制至少 20 个地块时,才允许选择该国策
available = {
    num_of_controlled_states > 19
}

配合关系

  • [controls_state](/wiki/trigger/controls_state) — 当需要精确检查某几个关键州是否被控制时,与 num_of_controlled_states 配合使用,形成"数量 + 特定目标"的双重条件门槛。
  • [any_controlled_state](/wiki/trigger/any_controlled_state) — 用于遍历当前控制的州并筛选满足子条件的对象,配合 num_of_controlled_states 先做数量预判,避免无意义的遍历开销。
  • [every_controlled_state](/wiki/effect/every_controlled_state) — 在触发效果阶段对所有控制州批量执行操作前,先用 num_of_controlled_states 做数量门控,防止国家控制州过少时产生逻辑错误。
  • [has_country_flag](/wiki/trigger/has_country_flag) — 用国旗记录阶段性扩张节点,配合本 trigger 构建"达到 X 州 → 设旗 → 解锁下一阶段"的成长链条。

常见坑

  1. 控制 ≠ 拥有:新手常将"控制"与"核心/所有权"混淆。该 trigger 统计的是实际控制(controller)的州数,战时占领的敌方土地也计入其中,而和平时期通过傀儡间接掌握的州则不计入,需额外用 num_of_owned_states(若存在)或 all_owned_state 逻辑替代。
  2. 比较运算符缺失:直接写 num_of_controlled_states = 10 是精确等于判断,实际场景往往需要"至少"语义,应写成 num_of_controlled_states > 9 或对应的 >= 写法,漏写或写错运算符会导致条件在绝大多数情况下不满足。

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

num_of_controlled_states is commonly used to determine whether a country has expanded to a sufficient size, thereby unlocking specific decisions, focus tree rewards, or event branches. For example, in major power overhaul mods, it can be used to restrict certain enhanced focuses so they are only available when the player actually controls a sufficient number of states.

# The focus can only be selected when the country controls at least 20 states
available = {
    num_of_controlled_states > 19
}

Synergy

  • [controls_state](/wiki/trigger/controls_state) — When you need to precisely check whether a few critical states are controlled, combine it with num_of_controlled_states to create a dual-condition threshold of "quantity + specific objectives."
  • [any_controlled_state](/wiki/trigger/any_controlled_state) — Used to iterate through currently controlled states and filter objects matching sub-conditions. Pair it with num_of_controlled_states for a preliminary quantity check to avoid unnecessary iteration overhead.
  • [every_controlled_state](/wiki/effect/every_controlled_state) — Before executing batch operations on all controlled states in the effects phase, use num_of_controlled_states as a quantity gate to prevent logic errors when a country controls too few states.
  • [has_country_flag](/wiki/trigger/has_country_flag) — Use country flags to mark expansion milestones, and combine with this trigger to build a growth chain: "reach X states → set flag → unlock next phase."

Common Pitfalls

  1. Control ≠ Ownership: Beginners often conflate "control" with "core/ownership." This trigger counts states that are actually controlled (controller), including enemy territory occupied during war. However, states indirectly held through puppets during peacetime are not counted. You'll need to use num_of_owned_states (if it exists) or all_owned_state logic as a substitute.
  2. Missing Comparison Operators: Writing num_of_controlled_states = 10 directly performs an exact equality check, but most real scenarios require an "at least" condition. Write num_of_controlled_states > 9 or the corresponding >= syntax instead. Omitting or misspelling the operator will cause the condition to fail in the vast majority of cases.