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
  }
}

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.