Wiki

trigger · is_mio_trait_available

Definition

  • Supported scope:INDUSTRIAL_ORG
  • Supported target:none

Description

Checks if the Military Industrial Organisation in scope has a trait matching the input token, which is also available.
ex:
mio:my_mio = {
	is_mio_trait_available = my_trait_token
	is_mio_trait_available = {
		trait = my_trait_token
		check_mio_parent_completed = no # Optional, yes by default
        check_mio_mutually_exclusive = no # Optional, yes by default
	}
}

实战 · 配合 · 坑

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

实战用法

is_mio_trait_available 常用于在军工组织的特性解锁逻辑中,动态判断某个特性当前是否满足前置条件且尚未被互斥关系封锁,适合用在自定义 MIO 的 available 块或事件触发条件里,避免玩家绕过设计限制强行完成特性。例如,可以在一个决策的 visible 块中检查目标 MIO 是否已具备解锁高级特性的前提:

# 在某个 MIO 相关决策的 available 块中
mio:my_custom_mio = {
    is_mio_trait_available = {
        trait = advanced_production_line
        check_mio_mutually_exclusive = yes
        check_mio_parent_completed = yes
    }
}

配合关系

  • [is_mio_trait_completed](/wiki/trigger/is_mio_trait_completed):先用 is_mio_trait_completed 确认父级特性已完成,再用本 trigger 验证子特性是否可用,两者配合构成完整的解锁链条检查。
  • [complete_mio_trait](/wiki/effect/complete_mio_trait):在 effect 块中执行 complete_mio_trait 强制完成某特性之前,通常先用本 trigger 作为前置校验,防止跳过可用性检查直接完成导致逻辑异常。
  • [has_mio_trait](/wiki/trigger/has_mio_trait)has_mio_trait 只检查特性是否存在于 MIO 定义中,而本 trigger 额外验证可用性;两者组合可精确区分"存在但被锁定"与"存在且可选"两种状态。
  • [is_mio_available](/wiki/trigger/is_mio_available):在检查具体特性可用性之前,先用 is_mio_available 确保整个 MIO 本身处于激活状态,避免对未激活组织做无意义的特性检查。

常见坑

  1. check_mio_parent_completed 误设为 no 却期望父子关系生效:两个可选参数默认均为 yes,若显式写成 no 则会跳过父级完成检查,导致原本应被锁定的特性被判定为可用,逻辑与设计意图相反。
  2. 在非 INDUSTRIAL_ORG scope 下直接调用:本 trigger 只能在 MIO scope 内使用,若在国家 scope 或其他 scope 中裸写而不用 mio:token = { } 包裹,游戏不会报错但条件永远不会为真,难以排查。

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

is_mio_trait_available is commonly used in military industrial organization trait unlock logic to dynamically check whether a specific trait currently meets its prerequisites and has not been blocked by mutual exclusions. It works well in the available block of custom MIOs or event trigger conditions, preventing players from bypassing design constraints to forcibly complete traits. For example, you can check in a decision's visible block whether the target MIO has the prerequisites to unlock an advanced trait:

# In the available block of an MIO-related decision
mio:my_custom_mio = {
    is_mio_trait_available = {
        trait = advanced_production_line
        check_mio_mutually_exclusive = yes
        check_mio_parent_completed = yes
    }
}

Synergy

  • [is_mio_trait_completed](/wiki/trigger/is_mio_trait_completed): First use is_mio_trait_completed to confirm the parent trait is completed, then use this trigger to verify whether the child trait is available. Together they form a complete unlock chain verification.
  • [complete_mio_trait](/wiki/effect/complete_mio_trait): Before executing complete_mio_trait in an effect block to forcibly complete a trait, typically use this trigger as a precondition check first to prevent bypassing availability checks and causing logic errors.
  • [has_mio_trait](/wiki/trigger/has_mio_trait): has_mio_trait only checks whether a trait exists in the MIO definition, while this trigger additionally verifies availability. Combined, they can precisely distinguish between "exists but locked" and "exists and available" states.
  • [is_mio_available](/wiki/trigger/is_mio_available): Before checking specific trait availability, first use is_mio_available to ensure the entire MIO itself is in an active state, avoiding meaningless trait checks on inactive organizations.

Common Pitfalls

  1. Setting check_mio_parent_completed to no while expecting parent-child relationships to work: Both optional parameters default to yes. If explicitly set to no, parent completion checks are skipped, causing traits that should be locked to be judged as available, contradicting design intent.
  2. Calling directly outside INDUSTRIAL_ORG scope: This trigger only works within MIO scope. If used bare in country scope or other scopes without mio:token = { } wrapping, the game won't error but the condition will never evaluate true, making it difficult to debug.