Wiki

effect · create_ship

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

create a ship from another country and assign it to the reserve fleet.
'creator' is optional. If not set, it will be the scoped country.
'name' is optional.
FRA = {
  create_ship = {
    type = ship_hull_submarine_1
    equipment_variant = "S Class"
    creator = ENG
    name = "My ship name"
    amount = 5 #amount to add
  }
}

实战 · 配合 · 坑

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

实战用法

create_ship 常用于剧情事件或国策奖励中,为某国凭空生成一艘舰船并直接加入预备舰队,例如模拟战争赔偿、缴获敌舰或盟友援助舰艇的场景。creator 字段可用来标记舰船的"原造国",影响其装备模板来源——若想生成某国特有的命名变体,必须使用该国已定义的 equipment_variant 名称。

# 英国通过国策获得法国赠予的潜艇
ENG = {
    create_ship = {
        type = ship_hull_submarine_1
        equipment_variant = "S Class"
        creator = ENG
        name = "HMS Gift"
        amount = 3
    }
}

配合关系

  • [create_equipment_variant](/wiki/effect/create_equipment_variant):在调用 create_ship 之前先为目标国创建装备变体,确保 equipment_variant 字段所引用的变体名称确实存在,否则舰船无法生成。
  • [destroy_ships](/wiki/effect/destroy_ships):与 create_ship 形成"换代"逻辑,先销毁旧舰船,再生成新型号,常用于舰队现代化改造事件。
  • [has_design_based_on](/wiki/trigger/has_design_based_on):用于判断某国是否拥有特定舰船设计模板,可在 create_ship 执行前做条件检查,避免因变体不存在导致静默失败。
  • [add_equipment_to_stockpile](/wiki/effect/add_equipment_to_stockpile):在不需要命名或指定变体的情况下,可作为更简便的替代手段往库存添加装备,两者按需选用。

常见坑

  1. equipment_variant 名称必须与目标国已有的设计完全匹配(包括大小写和空格),若该变体在 creator 国中不存在,效果会静默失败,不会报错但也不会生成任何舰船,排查时极易忽略。
  2. scope 必须是接收舰船的国家,而非 creator,新手常误将 creator 国作为外层 scope,导致舰船被分配给错误的国家,creator 仅用于指定装备模板的来源国,不影响归属。

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

create_ship is commonly used in scripted events or national focus rewards to generate a ship for a country out of thin air and add it directly to the reserve fleet. This simulates scenarios such as war reparations, captured enemy vessels, or allied ship donations. The creator field can be used to mark the ship's "original builder nation," which affects the source of its equipment template—if you want to generate a nation-specific naming variant, you must use an equipment_variant name that has been defined for that nation.

# Britain acquires a submarine gifted by France through a national focus
ENG = {
    create_ship = {
        type = ship_hull_submarine_1
        equipment_variant = "S Class"
        creator = ENG
        name = "HMS Gift"
        amount = 3
    }
}

Synergy

  • [create_equipment_variant](/wiki/effect/create_equipment_variant): Before calling create_ship, first create an equipment variant for the target nation to ensure that the variant name referenced by the equipment_variant field actually exists; otherwise, the ship will fail to generate.
  • [destroy_ships](/wiki/effect/destroy_ships): Forms a "replacement" logic with create_ship—destroy old ships first, then generate new models. Commonly used in fleet modernization events.
  • [has_design_based_on](/wiki/trigger/has_design_based_on): Used to check whether a nation possesses a specific ship design template. Can be used for conditional checks before executing create_ship to avoid silent failure due to missing variants.
  • [add_equipment_to_stockpile](/wiki/effect/add_equipment_to_stockpile): When you don't need to name or specify a variant, this serves as a simpler alternative for adding equipment to stockpile. Use either approach as needed.

Common Pitfalls

  1. The equipment_variant name must exactly match an existing design for the target nation (including capitalization and spaces). If the variant doesn't exist in the creator nation, the effect will fail silently without throwing an error, making the ship generation fail invisibly and difficult to debug.
  2. The scope must be the nation receiving the ship, not the creator nation. Beginners often mistakenly use the creator nation as the outer scope, causing the ship to be assigned to the wrong nation. The creator field only specifies the source nation for the equipment template and does not affect ownership.