Wiki

trigger · divisions_in_state

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

checks for amount of divisions in specified state owned by current country. 
divisions_in_state = { 
  state = state_id 
  size > 42 
  type = unit type eg. infantry, armor (optional) 
  unit = specific unit eg. mountaineers, light_tank (optional) 
}

实战 · 配合 · 坑

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

实战用法

divisions_in_state 常用于判断某国是否已在关键省份(如首都州、资源州、边境州)集结了足够兵力,以此触发事件、解锁决策或推进 AI 战略逻辑。例如在一个"防御线"mod 中,可以在决策的 available 块里检查本国是否已在指定州部署了规定数量的步兵师,再允许玩家执行后续决策:

available = {
    divisions_in_state = {
        state = 42
        size > 5
        type = infantry
    }
}

配合关系

  • [divisions_in_border_state](/wiki/trigger/divisions_in_border_state) — 同类边境方向的兵力检测,两者搭配可形成"内线州 + 边境州"双重部署验证逻辑。
  • [controls_state](/wiki/trigger/controls_state) — 先确认该州在本国控制下,再检测驻军数量,避免在敌占州上产生无意义的判定。
  • [has_army_size](/wiki/trigger/has_army_size) — 从全局兵力与局部州兵力两个维度共同评估军事准备程度,常配合用于 AI 进攻条件。
  • [activate_targeted_decision](/wiki/effect/activate_targeted_decision) — 当驻军条件满足后立即激活针对目标州的后续决策,形成"部署→解锁"的完整流程。

常见坑

  1. 比较运算符必须是 > / < / =,不少新手写成 size >= 5size == 5,这在 HOI4 脚本语法中是无效的,会导致条件块解析失败且不报明显错误。
  2. state 字段填的是 state ID(整数),不是省份 ID(province ID),两者概念不同,误填省份 ID 会导致条件永远无法匹配,排查时极难发现。

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

divisions_in_state is commonly used to check whether a country has concentrated sufficient forces in a critical state (such as capital states, resource states, or border states), thereby triggering events, unlocking decisions, or advancing AI strategic logic. For example, in a "defensive lines" mod, you can check within the available block of a decision whether your country has deployed the required number of infantry divisions in a designated state before allowing the player to execute subsequent decisions:

available = {
    divisions_in_state = {
        state = 42
        size > 5
        type = infantry
    }
}

Synergy

  • [divisions_in_border_state](/wiki/trigger/divisions_in_border_state) — Similar troop detection for border directions; combining both allows you to form a "internal state + border state" dual deployment verification logic.
  • [controls_state](/wiki/trigger/controls_state) — First confirm that the state is under your control, then check garrison numbers, avoiding meaningless checks on enemy-occupied states.
  • [has_army_size](/wiki/trigger/has_army_size) — Evaluate military preparedness from both global and local state troop dimensions; commonly paired for AI offensive conditions.
  • [activate_targeted_decision](/wiki/effect/activate_targeted_decision) — Immediately activate subsequent decisions targeting the state once garrison conditions are met, forming a complete "deployment → unlock" workflow.

Common Pitfalls

  1. Comparison operators must be > / < / =; many beginners mistakenly write size >= 5 or size == 5, which are invalid in HOI4 script syntax and will cause the condition block to fail parsing without obvious error messages.
  2. The state field takes a state ID (integer), not a province ID; these are different concepts, and filling in a province ID will cause the condition to never match, making it extremely difficult to troubleshoot.