Hands-On Usage
set_mio_flag is used to set flags on Military Industrial Organizations (MIOs), commonly employed to track special states of MIOs such as recording when a task has been triggered, an event has been executed, or timing limited-duration effects. A typical scenario involves setting a temporary flag with days after an MIO completes a certain trait, which automatically clears upon expiration, and combining it with has_mio_flag for conditional logic to form cooldown mechanisms.
# When an MIO unlocks a certain trait, set a cooldown marker lasting 30 days
var:my_mio_var = {
set_mio_flag = {
flag = production_surge_cooldown
days = 30
}
}
Synergy
[has_mio_flag](/wiki/trigger/has_mio_flag): The most direct partner, used to check if a flag exists after setting it, implementing "trigger only once" or cooldown logic.
[clr_mio_flag](/wiki/effect/clr_mio_flag): Manually clear a set flag early, suitable for scenarios where you need to reset state under specific conditions without waiting for days to naturally expire.
[modify_mio_flag](/wiki/effect/modify_mio_flag): When a flag needs to carry a numerical value that should dynamically accumulate, use alongside set_mio_flag — the former initializes, the latter handles subsequent modifications.
[is_mio_trait_completed](/wiki/trigger/is_mio_trait_completed): Often serves as a prerequisite condition before setting a flag, ensuring that the flag is only written after the corresponding trait is completed, preventing state pollution.
Common Pitfalls
- Forgetting that scope must be INDUSTRIAL_ORG: Calling
set_mio_flag directly in a country scope or province scope will silently fail; you must first enter the MIO scope using var:my_mio_var = { ... } or similar constructs. Beginners often mistakenly mix this with the standard set_country_flag.
- Unexpected default behavior when
value and days are omitted: Without days, the flag persists permanently and won't automatically clear; without value, the default value is 1 rather than 0. If you later read the value through means other than has_mio_flag, it may not match expectations. Always clarify at the design stage whether these two optional fields are necessary.