Wiki

effect · set_mio_icon

Definition

  • Supported scope:INDUSTRIAL_ORG
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

Set the icon GFX for the military industrial organization in scope.
ex:
mio:my_mio = {
  set_mio_icon = MY_NEW_MIO_ICON_GFX
}

实战 · 配合 · 坑

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

实战用法

set_mio_icon 常用于 mod 中动态更换军工组织的显示图标,例如当某个组织完成特定里程碑后切换为升级版图标,或根据剧本事件赋予不同的外观以区分阵营风格。注意图标 GFX 需要在 interface/ 目录下的 .gfx 文件中预先定义好精灵图,才能被正确引用。

# 当 MIO 完成某项特质后,更新其图标
mio:my_weapons_mio = {
    if = {
        limit = { is_mio_trait_completed = my_advanced_trait }
        set_mio_icon = MY_WEAPONS_MIO_UPGRADED_ICON
    }
}

配合关系

  • [is_mio_trait_completed](/wiki/trigger/is_mio_trait_completed):先检查组织是否完成了某个关键特质,再决定是否切换图标,使图标变化与研发进度挂钩。
  • [set_mio_name_key](/wiki/effect/set_mio_name_key):同步更换组织名称与图标,保持视觉和文本表现的一致性,常见于"组织升级改名"的脚本场景。
  • [complete_mio_trait](/wiki/effect/complete_mio_trait):在解锁特质的同一执行块内立即更新图标,确保游戏内呈现实时反映组织状态变化。
  • [has_mio_flag](/wiki/trigger/has_mio_flag):通过标志位判断图标是否已经被更换过,避免重复触发同一图标设置逻辑。

常见坑

  1. GFX 名称未定义就引用set_mio_icon 的参数必须是已在 .gfx 文件中用 spriteType 声明的图形名称,如果拼写错误或文件未加载,游戏不会报错但图标会显示为空白或默认图,新手容易误以为是脚本写法有问题。
  2. Scope 层级写错:此 effect 只能在 INDUSTRIAL_ORG scope 下执行,若直接写在国家或事件的顶层 effect 块中而不通过 mio:xxx = { } 进入正确 scope,命令将静默失效且不产生任何提示。

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_icon is commonly used in mods to dynamically change the display icon of military industrial organizations. For example, you can switch to an upgraded icon when an organization completes a specific milestone, or assign different appearances based on scenario events to distinguish faction styles. Note that the icon GFX must be predefined in a .gfx file located in the interface/ directory as sprite types before it can be properly referenced.

# Update MIO icon after completing a certain trait
mio:my_weapons_mio = {
    if = {
        limit = { is_mio_trait_completed = my_advanced_trait }
        set_mio_icon = MY_WEAPONS_MIO_UPGRADED_ICON
    }
}

Synergy

  • [is_mio_trait_completed](/wiki/trigger/is_mio_trait_completed): Check if the organization has completed a key trait before deciding whether to switch icons, tying icon changes to research progress.
  • [set_mio_name_key](/wiki/effect/set_mio_name_key): Simultaneously change both the organization name and icon to maintain consistency between visual and text presentation, commonly seen in "organization upgrade and rename" scripting scenarios.
  • [complete_mio_trait](/wiki/effect/complete_mio_trait): Update the icon immediately within the same execution block that unlocks a trait, ensuring the in-game display reflects organizational state changes in real time.
  • [has_mio_flag](/wiki/trigger/has_mio_flag): Use a flag to determine whether an icon has already been changed, preventing duplicate triggering of the same icon-setting logic.

Common Pitfalls

  1. Referencing undefined GFX names: The parameter passed to set_mio_icon must be a graphics name already declared with spriteType in a .gfx file. If there's a typo or the file isn't loaded, the game won't report an error but the icon will display as blank or default, misleading newcomers into thinking there's a scripting syntax problem.
  2. Incorrect scope level: This effect can only execute within INDUSTRIAL_ORG scope. If written directly in the top-level effect block of a country or event without entering the correct scope via mio:xxx = { }, the command will silently fail without any notification.