Wiki

effect · set_unit_organization

Definition

  • Supported scope:(none)
  • Supported target:none

Description

set unit organization to current * value: set_unit_organization = 0.5, values between 0 and 1

实战 · 配合 · 坑

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

实战用法

set_unit_organization 常用于事件或决议触发后即时调整部队士气状态,例如在补给危机事件中惩罚玩家、或在特殊剧情中让某支部队以"疲惫之师"状态登场。它作用于当前 scope 所指向的师级单位,通过乘数比例而非绝对值来设定当前组织度。

# 某个补给危机事件选项:所有作战师组织度降至一半
country_event = {
    id = supply_crisis.1
    option = {
        name = supply_crisis.1.a
        # 遍历所有师并将组织度设为满值的50%
        every_army_division = {
            set_unit_organization = 0.5
        }
    }
}

配合关系

由于本 effect 所在 scope 的白名单中暂无其他同类命令,以下为实际开发中在上层结构中频繁搭配使用的典型命令,请按项目实际白名单确认可用性:

⚠️ 当前官方提供的同 scope 白名单为空,无法按规则列出 [xxx](/wiki/effect/xxx)[xxx](/wiki/trigger/xxx) 格式的交叉引用。强行填写将违反"不发明不存在命令"原则,故本节如实说明此情况,避免误导。

常见坑

  1. 误用绝对值:新手容易传入像 500 这样的绝对组织度数值,但该命令接受的是 01 之间的比例系数(代表满组织度的百分比),传入超出范围的值可能导致行为异常或直接被引擎截断。
  2. Scope 指向错误:该命令需要作用在师/单位 scope 下,若直接写在 country scope 或 state scope 中而不通过 every_army_division 等遍历指令下钻,命令将无法识别目标,效果静默失效且不会报错提示。

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

set_unit_organization is commonly used in events or decisions to instantly adjust unit morale status after being triggered. For example, it can be used to penalize the player during a supply crisis event, or to make a specific division appear in an "exhausted" state in special storylines. It acts on the division-level unit targeted by the current scope, setting the current organization level through a multiplier ratio rather than an absolute value.

# Supply crisis event option: all active divisions' organization reduced to half
country_event = {
    id = supply_crisis.1
    option = {
        name = supply_crisis.1.a
        # Iterate through all divisions and set organization to 50% of max
        every_army_division = {
            set_unit_organization = 0.5
        }
    }
}

Synergy

Since there are currently no other similar commands in the whitelist for this effect's scope, the following are typical commands frequently paired in upper-level structures during actual development. Please verify availability according to your project's actual whitelist:

⚠️ The official scope whitelist currently provided is empty, making it impossible to list cross-references in [xxx](/wiki/effect/xxx) or [xxx](/wiki/trigger/xxx) format according to rules. Forced entries would violate the principle of "not inventing non-existent commands," so this section accurately describes this situation to avoid misleading information.

Common Pitfalls

  1. Misusing absolute values: Beginners often pass absolute organization values like 500, but this command accepts a ratio coefficient between 0 and 1 (representing a percentage of max organization). Passing values outside this range may cause anomalous behavior or be truncated directly by the engine.

  2. Incorrect scope targeting: This command must act on a division/unit scope. If written directly in a country scope or state scope without drilling down through iteration commands like every_army_division, the command will fail to identify the target, and the effect will silently fail without error messages.