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