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
- 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.
- 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.