Wiki

effect · set_mio_flag

Definition

  • Supported scope:INDUSTRIAL_ORG
  • Supported target:none

Description

Set flag in the military industrial organization in scope.
ex:
var:my_mio_var = {
  set_mio_flag = my_flag
  set_mio_flag = {
    flag = my_flag (mandatory)
	value = 3 (optional, default = 1)
    days = 12 (optional, default = 0. if > 0, the flag will be deleted after this number of days)
  }
}

实战 · 配合 · 坑

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

实战用法

set_mio_flag 用于在军事工业组织(MIO)上打标记,常见于追踪 MIO 的特殊状态,例如记录某项任务已被触发、某次事件已被执行过,或为限时效果计时。典型场景是在 MIO 完成某个特性后设置一个带 days 的临时旗标,到期自动清除,配合 has_mio_flag 做条件判断形成冷却机制。

# 在 MIO 解锁某特性时,设置一个持续 30 天的冷却标记
var:my_mio_var = {
    set_mio_flag = {
        flag = production_surge_cooldown
        days = 30
    }
}

配合关系

  • [has_mio_flag](/wiki/trigger/has_mio_flag):最直接的搭档,用于在设置旗标后检测其是否存在,实现"仅触发一次"或冷却逻辑。
  • [clr_mio_flag](/wiki/effect/clr_mio_flag):手动提前清除已设置的旗标,适合需要在特定条件下重置状态而不等待 days 自然到期的场景。
  • [modify_mio_flag](/wiki/effect/modify_mio_flag):当旗标需要携带数值且该数值要动态累加时,与 set_mio_flag 配合——前者负责初始化,后者负责后续修改。
  • [is_mio_trait_completed](/wiki/trigger/is_mio_trait_completed):常作为设置旗标的触发前提条件,确保只有在对应特性完成后才写入旗标,避免状态污染。

常见坑

  1. 忘记 scope 必须是 INDUSTRIAL_ORG:直接在国家 scope 或省份 scope 下调用 set_mio_flag 会静默失败,必须先用 var:my_mio_var = { ... } 或类似方式进入 MIO scope,新手常误将其与普通的 set_country_flag 混用。
  2. valuedays 省略时的默认行为未预期:不写 days 时旗标永久存在,不会自动清除;不写 value 时默认值为 1 而非 0,若后续用 has_mio_flag 以外的方式读取数值可能与预期不符,务必在设计之初明确是否需要这两个可选字段。

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

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