命令百科

effect · create_equipment_variant

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Creates a new equipment variant.
Example:
create_equipment_variant = {
	name = "Yorktown Class" # Optional.
	name_group = USA_CV_HISTORICAL # Optional. If not set, parent's name group will be inherited.
	type = ship_hull_carrier_1 # Must be a type and not an archetype.
	allow_without_tech = yes # Optional. Default no. If yes, create the variant even if the type hasn't been unlocked yet. Otherwise created the variant once the type research completes.
	parent_version = 3 # Default 0. If not found the default variant will be used (or created).
	obsolete = yes # Optional. Default no.
	mark_older_equipment_obsolete = yes # Optional. Default no. Marks all older (non-chassis) equipment variants as obsolete as long as the following matches: Archetype, niche, mission set (for planes).
	role_icon_index = 3 # Optional. Default 'auto', leverage AI design logic.
	upgrades = { # Optional. The level on each upgrade is inherited from the parent.
		ship_deckspace_upgrade = 1
		carrier_armor_upgrade = 2
	}
	modules = { # Optional. The module installed in each slot is inherit from the parent.
		fixed_ship_engine_slot = carrier_ship_engine_2
		fixed_ship_secondaries_slot = empty # Clears the slot if the parent has any module installed.
	}
	model = "GER_light_armor_2_entity" # Optional.
	icon = "gfx/interface/technologies/ger_basic_light_tank.dds" # Optional. GFX names are also supported e.g. "GFX_GER_basic_light_tank_medium".
    design_team = mio:my_mio_token # Optional. accepts mio:token, variable or keyword
}

实战 · 配合 · 坑

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

实战用法

create_equipment_variant 常用于国家焦点或事件触发时,为玩家/AI 国家自动生成带有预设模块和升级的装备变体,无需玩家手动设计——例如历史 mod 中让美国在特定年份自动获得"约克城级"航母设计方案。也可用于开局初始化脚本,批量为各国生成符合历史的坦克、飞机变体。

focus = {
    id = USA_build_essex
    ...
    completion_reward = {
        create_equipment_variant = {
            name = "Essex Class"
            type = ship_hull_carrier_2
            allow_without_tech = yes
            mark_older_equipment_obsolete = yes
            modules = {
                fixed_ship_flight_deck_slot = ship_flight_deck_2
                fixed_ship_engine_slot = carrier_ship_engine_2
            }
            upgrades = {
                ship_deckspace_upgrade = 2
            }
        }
    }
}

配合关系

  • [has_completed_focus](/wiki/trigger/has_completed_focus):在 trigger 块中检查某焦点是否完成,确保只在适当研究进度下才触发变体创建,避免过早生成高级装备。
  • [add_equipment_to_stockpile](/wiki/effect/add_equipment_to_stockpile):创建变体后立即向库存添加该类装备,使部队可以直接装备新设计,两者配合实现"研发即到货"的剧情效果。
  • [can_research](/wiki/trigger/can_research):在条件块中判断国家是否已解锁相关科技,配合 allow_without_tech = no(默认)的逻辑,决定是否需要提前用该触发器做保护判断。
  • [add_tech_bonus](/wiki/effect/add_tech_bonus):通常在同一焦点奖励中同步给予科技加成,让国家能更快研发配套底盘,使新变体尽快实际生效。

常见坑

  1. type 必须填具体型号而非 archetype:新手常误写 type = ship_hull_carrier(archetype),导致脚本报错或静默失败;必须写带数字后缀的具体型号如 ship_hull_carrier_1,可在 common/units/equipment/ 下查找真实 key。
  2. 忘记处理科技未解锁的情况:默认 allow_without_tech = no,若目标国家尚未研究对应底盘科技,变体不会立即创建而是等科技完成后才生效,这在开局初始化脚本中会造成变体"消失"的假象——如需立即可用须显式加上 allow_without_tech = yes