Wiki

effect · modify_mio_flag

Definition

  • Supported scope:INDUSTRIAL_ORG
  • Supported target:none

Description

Modify the matching flag in the military industrial organization in scope. Happens only if the flag already exists.
ex:
var:my_mio_var = {
  modify_mio_flag = {
    flag = my_flag
    value = 5 (optional, default = 0. Will be added to the current value)
    days = 13 (optional, default = 0. if > 0, the flag will be deleted after this number of days)
  }
}

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

modify_mio_flag is suited for scenarios where you need to accumulate or modify existing counters or temporary states on a military industrial organization—for example, tracking how many times an organization has completed a specific task, or recording research progress stages. Unlike set_mio_flag, it only modifies existing flags, providing inherent protection with a "modify if exists, skip if absent" behavior. This makes it ideal for repeated triggering in event chains or decision trees without unwanted side effects.

# Each time a nation completes a weapon test, increment the corresponding MIO's progress flag by 1
# In an event option within an INDUSTRIAL_ORG scope:
modify_mio_flag = {
    flag = weapon_test_progress
    value = 1
}

Synergy

  • [has_mio_flag](/wiki/trigger/has_mio_flag): Use before executing modify_mio_flag to check whether the target flag exists, preventing logic branch errors. Also allows reading the current value to determine subsequent behavior.
  • [set_mio_flag](/wiki/effect/set_mio_flag): Typically used in initialization phase—first use set_mio_flag to create and assign an initial value, then delegate all subsequent accumulations to modify_mio_flag, forming a clear "creation-modification" division of labor.
  • [clr_mio_flag](/wiki/effect/clr_mio_flag): Clear the flag after a stage is completed, working with modify_mio_flag to form a complete "count→reset" lifecycle.
  • [has_mio_size](/wiki/trigger/has_mio_size): Often linked with flag values; when a flag accumulates to a certain threshold, combine it with organization size conditions to trigger rewards or unlock new features.

Common Pitfalls

  1. Calling on non-existent flags is ineffective: modify_mio_flag silently skips when a flag doesn't exist and won't auto-create it. Beginners often forget to initialize with set_mio_flag first, causing the entire accumulation logic to fail silently without error messages, making it extremely easy to overlook during troubleshooting.
  2. Overwrite behavior of the days parameter: Each call with days resets the timer to a new countdown instead of stacking on the remaining time. In repeatedly-triggered scripts, this causes the flag to never expire and delete, leaving behind permanent "zombie flags" in the system.