Wiki

effect · every_state_division

Definition

  • Supported scope:STATE
  • Supported target:CAPITAL

Description

Executes children effects on every Division currently in the state in scope (or \"random_select_amount\" of random divisions if specified) that fulfills the \"limit\" trigger.
tooltip=key can be added to override tooltip title.
By default the effects are only displayed once, you may display them for each matching division with display_individual_scopes.
ex:
SOV = {
	every_state_division = {
		tooltip = my_loc_key # Optional
		random_select_amount = 3 # Optional
		display_individual_scopes = yes # Optional - default = no
		... division scope effects ...
	}
}

实战 · 配合 · 坑

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

实战用法

every_state_division 常用于 mod 中对某州内所有部队批量施加状态变化,例如在一场州级事件后削弱防守部队组织度、替换师团模板,或在占领/解放事件中摧毁特定阵营的驻守单位。配合 limit 可以精确筛选满足条件的师团,避免误伤友军。

# 在一个 STATE scope 事件中,摧毁该州内所有敌方(非控制国)的弱小单位
state_event = {
    id = my_mod.1
    immediate = {
        every_state_division = {
            limit = {
                unit_strength < 0.3
            }
            destroy_unit = yes
        }
    }
}

若只想随机处理其中几支部队,可加 random_select_amount = 2,只对 2 支随机师团执行效果,适合模拟局部突袭场景。


配合关系

  • unit_strength:在 limit 块内筛选血量低于阈值的师团,是最常见的过滤条件,避免对满血部队执行不必要的效果。
  • destroy_unit:与本命令直接配合,对筛选出的师团执行摧毁操作,常用于解放或灾难事件中清除驻守部队。
  • set_unit_organization:批量重置州内部队的组织度,例如在包围圈事件后将所有被困师团组织度归零。
  • damage_units:对筛选出的师团造成人员/装备损失,比 destroy_unit 更温和,适合模拟消耗战或轰炸后效果。

常见坑

  1. Scope 混淆every_state_division 必须在 STATE scope 下调用,若直接写在国家 scope(如 SOV = { ... })的顶层而不先进入州 scope,脚本会静默失效或报错。需先用 capital_scope = { } 或指定州进入正确 scope。

  2. limit 内误用国家级 triggerlimit 块运行于师团 scope,不能在其中直接写国家级条件(如 tag = GER)。若需判断该师团所属国家,应通过嵌套 any_of_scopes 等方式处理,或在外层 every_state_division 之前用 if 做国家层面的前置判断。

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

every_state_division is commonly used in mods to apply bulk state changes to all units within a given state — for example, reducing the organization of defending forces after a state-level event, swapping division templates, or destroying specific faction garrisons during occupation or liberation events. Pairing it with limit lets you precisely filter which divisions are affected, preventing friendly fire.

# In a STATE scope event, destroy all weak enemy (non-controller) units in the state
state_event = {
    id = my_mod.1
    immediate = {
        every_state_division = {
            limit = {
                unit_strength < 0.3
            }
            destroy_unit = yes
        }
    }
}

If you only want to process a handful of units at random, add random_select_amount = 2 to apply the effect to just 2 randomly chosen divisions — useful for simulating a localized raid scenario.


Synergy

  • unit_strength: Used inside a limit block to filter divisions below a strength threshold. This is the most common filtering condition, preventing unnecessary effects from being applied to full-strength units.
  • destroy_unit: Works directly alongside this command to destroy the filtered divisions. Frequently used in liberation or disaster events to clear out garrisoning forces.
  • set_unit_organization: Batch-resets the organization of all units in a state — for instance, zeroing out the organization of every encircled division after a pocket event.
  • damage_units: Deals manpower and equipment losses to filtered divisions. A softer alternative to destroy_unit, well-suited for simulating attrition warfare or post-bombardment effects.

Common Pitfalls

  1. Scope confusion: every_state_division must be called within a STATE scope. If you write it at the top level of a country scope (e.g., inside SOV = { ... }) without first entering a state scope, the script will silently fail or throw an error. Use capital_scope = { } or reference a specific state to enter the correct scope first.

  2. Using country-level triggers inside limit: The limit block runs in division scope, so country-level conditions (such as tag = GER) cannot be written directly inside it. If you need to check which country a division belongs to, handle it through nested scope methods such as any_of_scopes, or use an if block at the country level as a prerequisite check before the every_state_division call.