Wiki

trigger · has_mio_flag

Definition

  • Supported scope:INDUSTRIAL_ORG
  • Supported target:any

Description

Check if flag has been set within the military industrial organization in scope.
May checks on the value or date/days since last modified date.
Examples:
has_mio_flag = my_flag
has_mio_flag = {
	flag = my_flag (mandatory)
	value < 12 (optional)
	date > 1936.3.25 (optional, compare with the date where the flag was last modified )
	days > 365 (optional, compare with the number of days since the flag was last modified )
}

实战 · 配合 · 坑

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

实战用法

has_mio_flag 常用于追踪军事工业组织的特定状态,例如判断某个 MIO 是否已完成过某次特殊任务、触发过某个剧情事件或达成过某个自定义里程碑。典型场景是在 MIO 的 trait 解锁条件或 available 块中,检查之前通过脚本打上的标记,从而实现阶段推进式的解锁逻辑。

# 在 MIO trait 的 available 中,判断是否设置过"完成第一阶段研究"的标记
some_mio_trait = {
    available = {
        has_mio_flag = first_phase_complete
    }
}

# 也可以结合值或天数做更精细的判断
available = {
    has_mio_flag = {
        flag = production_boosted
        days < 180
    }
}

配合关系

  • [set_mio_flag](/wiki/effect/set_mio_flag)has_mio_flag 检查的标记正是由 set_mio_flag 写入的,两者构成"写入—读取"的完整逻辑闭环,缺一不可。
  • [clr_mio_flag](/wiki/effect/clr_mio_flag):当某个条件达成后需要重置状态时,用 clr_mio_flag 清除标记,再由 has_mio_flag 在下一阶段重新判断,适合实现循环或多阶段流程。
  • [modify_mio_flag](/wiki/effect/modify_mio_flag)modify_mio_flag 可修改标记的数值,配合 has_mio_flagvalue 比较字段,可实现类似"计数器"的累计判断逻辑。
  • [is_mio_trait_completed](/wiki/trigger/is_mio_trait_completed):通常与 has_mio_flag 并列写在同一 trigger 块中,同时检查 MIO 的 trait 完成情况与自定义标记,共同构成复合解锁条件。

常见坑

  1. Scope 写错位置has_mio_flag 只能在 INDUSTRIAL_ORG scope 下使用,新手常将其直接写在国家或角色 scope 的 trigger 块中导致静默失效或报错,使用前务必确认已通过 any_mio / every_mio 等方式切换到正确 scope。
  2. flag 名拼写不一致set_mio_flaghas_mio_flag 引用的 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

has_mio_flag is commonly used to track specific states of military industrial organizations, such as determining whether a particular MIO has completed a special task, triggered a scripted event, or achieved a custom milestone. Typical use cases appear in the trait unlock conditions or available blocks of an MIO, where you check for markers previously set via script to implement phased unlock logic.

# In an MIO trait's available block, check if the "first phase research complete" marker has been set
some_mio_trait = {
    available = {
        has_mio_flag = first_phase_complete
    }
}

# You can also combine this with values or days for more granular checks
available = {
    has_mio_flag = {
        flag = production_boosted
        days < 180
    }
}

Synergy

  • [set_mio_flag](/wiki/effect/set_mio_flag): The flags checked by has_mio_flag are written by set_mio_flag; together they form a complete "write-read" logical loop that requires both to function.
  • [clr_mio_flag](/wiki/effect/clr_mio_flag): When you need to reset state after a condition is met, use clr_mio_flag to clear the flag, then have has_mio_flag re-evaluate it in the next phase. This is ideal for implementing cycles or multi-stage workflows.
  • [modify_mio_flag](/wiki/effect/modify_mio_flag): modify_mio_flag can modify the numeric value of a flag; combined with the value comparison field in has_mio_flag, this enables counter-like cumulative logic.
  • [is_mio_trait_completed](/wiki/trigger/is_mio_trait_completed): Typically written alongside has_mio_flag in the same trigger block to simultaneously check both the MIO's trait completion status and custom flags, forming a composite unlock condition.

Common Pitfalls

  1. Scope placed incorrectly: has_mio_flag can only be used within an INDUSTRIAL_ORG scope. Beginners often write it directly in a country or character scope's trigger block, resulting in silent failure or errors. Always confirm you've switched to the correct scope using any_mio / every_mio or similar constructs before use.
  2. Flag name spelling inconsistency: The flag names referenced by set_mio_flag and has_mio_flag must match exactly (case-sensitive). When copying and pasting across different files, beginners often introduce case or underscore differences, causing conditions to always return false while remaining difficult to debug.