Wiki

trigger · any_country_division

Definition

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

Description

check if any division meets the trigger. tooltip=key can be defined to override title

实战 · 配合 · 坑

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

实战用法

any_country_division 常用于检查某国是否拥有满足特定条件的师团,例如判断敌国是否部署了装甲师、某师团是否超过特定强度阈值,或验证 AI 是否已组建目标模板的部队。典型场景包括事件触发条件、决策的 available 块,以及 focus 的 available 检查。

# 检查德国是否有任何师团的组织度低于 30
GER = {
    any_country_division = {
        unit_organization < 30
    }
}

# 在 focus available 中:检查本国是否存在任何满编装甲师团
focus = {
    available = {
        any_country_division = {
            division_has_majority_template = {
                template = "Light Armor Division"
            }
        }
    }
}

配合关系

  • unit_strength:常嵌套在 any_country_division 内部,用于筛选出战斗力高于或低于某阈值的师团。
  • unit_organization:同样嵌套于内层,用于判断师团当前组织度状态,配合 any_country_division 实现"只要有一支部队崩溃就触发"的逻辑。
  • division_has_majority_template:在内层判断师团类型,结合 any_country_division 可检查某国是否已建成特定兵种模板的部队。
  • custom_trigger_tooltip:当条件逻辑复杂时,包裹 any_country_division 提供友好的本地化提示文本,避免玩家看到冗长的自动生成 tooltip。

常见坑

  1. 作用域写错层级any_country_division 只能在 COUNTRY scope 下使用,若当前 scope 已经是 STATE 或 DIVISION 则会报错或静默失败。新手常在 any_state 等地理 scope 内直接调用,应先用 OWNER/CONTROLLER 等关键字切回国家 scope 再调用。
  2. 混淆 any_country_divisionany_state 内的师团迭代any_country_division 遍历的是该国所有师团,不区分所在州省;若只想检查特定州内的部队,需搭配内层的位置条件过滤,而不是替换成 any_state——两者不等价,直接替换会改变遍历范围和 scope 类型。

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_country_division is commonly used to check whether a country has any divisions meeting specific conditions — for example, determining whether an enemy has deployed armored divisions, whether any division has fallen below a certain strength threshold, or verifying that the AI has already recruited units matching a target template. Typical use cases include event trigger conditions, the available block of decisions, and available checks inside focuses.

# Check whether Germany has any division with organization below 30
GER = {
    any_country_division = {
        unit_organization < 30
    }
}

# Inside a focus available block: check whether the country has any fully-equipped armored division
focus = {
    available = {
        any_country_division = {
            division_has_majority_template = {
                template = "Light Armor Division"
            }
        }
    }
}

Synergy

  • unit_strength: Frequently nested inside any_country_division to filter divisions whose combat strength is above or below a given threshold.
  • unit_organization: Also used in the inner scope to evaluate a division's current organization level; combined with any_country_division, this enables logic such as "trigger as soon as any single unit collapses."
  • division_has_majority_template: Checks division type in the inner scope; paired with any_country_division, it lets you verify whether a country has already built units matching a specific template.
  • custom_trigger_tooltip: When the condition logic becomes complex, wrapping any_country_division with this provides a clean localized tooltip, preventing players from seeing the verbose auto-generated tooltip text.

Common Pitfalls

  1. Wrong scope level: any_country_division can only be used under a COUNTRY scope. If the current scope is already a STATE or DIVISION, it will throw an error or silently fail. A common beginner mistake is calling it directly inside a geographic scope such as any_state; you must first switch back to a country scope using keywords like OWNER or CONTROLLER before calling it.
  2. Confusing any_country_division with division iteration inside any_state: any_country_division iterates over all divisions belonging to the country, regardless of which state they are located in. If you only want to check units within a specific state, you need to filter by location conditions in the inner scope — do not simply replace it with any_state. The two are not equivalent; swapping one for the other changes both the iteration range and the scope type.