Wiki

effect · set_mio_task_capacity

Definition

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

Description

Set the maximum task capacity in the military industrial organization in scope.
This changes the base value. Modifiers will still apply over it.
Input value cannot be negative.
If the capacity is reduced and the MIO becomes over-assigned, the current tasks will be allowed.
It's only later that the player will feel the new restrictions.
ex:
mio:my_mio = {
  set_mio_task_capacity = 3
  set_mio_task_capacity = var:my_number_var
}

实战 · 配合 · 坑

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

实战用法

set_mio_task_capacity 用于在 mod 中动态调整军事工业组织(MIO)的最大任务容量,例如当玩家完成特定国策或科研后解锁更多任务槽位,或在特殊事件中临时扩充产能上限。与 add_mio_task_capacity 不同,此 effect 直接设置绝对值而非叠加,适合用于初始化或重置场景。

# 完成某国策后,将指定 MIO 的任务容量设为 4
complete_national_focus = {
    mio:my_arms_manufacturer = {
        set_mio_task_capacity = 4
    }
}

# 也可以通过变量动态设置容量
mio:my_arms_manufacturer = {
    set_mio_task_capacity = var:mio_capacity_var
}

配合关系

  • [add_mio_task_capacity](/wiki/effect/add_mio_task_capacity):当需要相对增减而非绝对赋值时改用此命令,两者逻辑互补,通常先用 set_mio_task_capacity 做初始化,再用 add_mio_task_capacity 做后续叠加奖励。
  • [add_mio_size](/wiki/effect/add_mio_size):MIO 规模扩大时,任务容量往往也需要同步调整,两者常在同一事件或国策效果块中配合出现。
  • [has_mio_size](/wiki/trigger/has_mio_size):在执行容量调整前,先用此 trigger 判断 MIO 当前规模是否达到阈值,避免过早赋予过高容量破坏平衡。
  • [is_mio_assigned_to_task](/wiki/trigger/is_mio_assigned_to_task):在减少容量前检查当前任务分配状态,可用于触发警告事件或补偿逻辑,提升 mod 的叙事完整性。

常见坑

  1. 误将负数传入:官方明确禁止输入负值,若通过变量传入时变量值可能为负(如经过运算后),务必在执行前用 trigger 或 clamp 逻辑保证变量 ≥ 0,否则脚本行为未定义。
  2. add_mio_task_capacity 混淆导致叠加错误set_mio_task_capacity 是覆盖式赋值,若在循环触发的 on_action 中误用它代替 add_mio_task_capacity,每次触发都会重置为同一固定值,而不会累积增长,导致预期的渐进解锁逻辑失效。

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_mio_task_capacity is used to dynamically adjust the maximum task capacity of a Military Industrial Organization (MIO) in mods. Common use cases include unlocking additional task slots after the player completes a specific focus or research, or temporarily increasing production capacity during special events. Unlike add_mio_task_capacity, this effect sets an absolute value rather than accumulating, making it ideal for initialization or reset scenarios.

# After completing a focus, set the task capacity of a designated MIO to 4
complete_national_focus = {
    mio:my_arms_manufacturer = {
        set_mio_task_capacity = 4
    }
}

# Task capacity can also be set dynamically through variables
mio:my_arms_manufacturer = {
    set_mio_task_capacity = var:mio_capacity_var
}

Synergy

  • [add_mio_task_capacity](/wiki/effect/add_mio_task_capacity): Use this command when relative increases or decreases are needed rather than absolute assignment. The two effects complement each other logically—typically set_mio_task_capacity is used for initialization, followed by add_mio_task_capacity for subsequent bonus accumulation.
  • [add_mio_size](/wiki/effect/add_mio_size): When expanding MIO size, task capacity often needs to be adjusted in sync. These two effects commonly appear together in the same event or focus effect block.
  • [has_mio_size](/wiki/trigger/has_mio_size): Before executing capacity adjustments, use this trigger to check whether the MIO's current size meets the threshold, preventing premature allocation of excessive capacity that could break balance.
  • [is_mio_assigned_to_task](/wiki/trigger/is_mio_assigned_to_task): Before reducing capacity, check the current task assignment status. This can trigger warning events or compensation logic, enhancing narrative coherence in your mod.

Common Pitfalls

  1. Passing negative numbers by mistake: The game engine explicitly forbids negative values. If variables could potentially become negative (e.g., after calculations), always validate them with a trigger or clamp logic before execution to ensure the variable ≥ 0. Otherwise, script behavior is undefined.
  2. Confusing set_mio_task_capacity with add_mio_task_capacity, causing stacking errors: set_mio_task_capacity is an overwrite assignment. If you mistakenly use it instead of add_mio_task_capacity in a repeatedly-triggered on_action, each trigger will reset the value to the same fixed number rather than accumulating growth, breaking your intended progressive unlock logic.