Wiki

effect · transfer_ship

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Transfers ship from scope country to target country.
Example:
ENG={
  transfer_ship={
    prefer_name = "HMS Achilles"
    type = light_cruiser
    target = NZL
    exclude_refitting = yes #optional, default is no; Exclude ships currently being refitted from the search.
  }
}

实战 · 配合 · 坑

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

实战用法

transfer_ship 常用于历史事件 mod 中模拟真实的舰艇移交,例如英国将军舰转让给盟国海军,或在内战/分裂事件中将舰队分配给新生国家。下面示例模拟英国将"HMS Achilles"号巡洋舰转让给新西兰:

# 在某个 country_event 的 option 中
ENG = {
    transfer_ship = {
        prefer_name = "HMS Achilles"
        type = light_cruiser
        target = NZL
        exclude_refitting = yes
    }
}

配合关系

  • [create_ship](/wiki/effect/create_ship) — 在转让前先为来源国创建一艘具名舰艇,确保 prefer_name 指定的目标船只真实存在,避免转让空舰队。
  • [destroy_ships](/wiki/effect/destroy_ships) — 当剧情需要"击沉后残舰移交"或清理多余舰艇时,可在转让之后销毁特定舰型,保持舰队规模真实可信。
  • [has_country_flag](/wiki/trigger/has_country_flag) — 在触发转让事件前用标记判断条件是否已满足(如外交协议已签署),防止重复执行转让逻辑。
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier) — 转让完成后为双方添加关系修正,体现军事援助带来的外交红利。

常见坑

  1. prefer_name 匹配失败时不会报错而是随机转让:若来源国实际不存在该名称的舰艇(例如船只已沉没或从未建造),游戏会静默地改为按 type 随机挑一艘,导致结果与预期不符;务必配合 create_ship 或事先确认舰艇存在。
  2. scope 混淆导致转让方向反转transfer_ship 必须写在出让国的 scope 内,target 才是接收国;新手常误将整段代码写在接收国 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

transfer_ship is commonly used in historical event mods to simulate realistic naval transfers, such as Britain transferring warships to allied navies or distributing fleets to newly formed nations during civil wars or secessions. The following example simulates Britain transferring the light cruiser "HMS Achilles" to New Zealand:

# In an option within a country_event
ENG = {
    transfer_ship = {
        prefer_name = "HMS Achilles"
        type = light_cruiser
        target = NZL
        exclude_refitting = yes
    }
}

Synergy

  • [create_ship](/wiki/effect/create_ship) — Create a named ship for the source nation before the transfer to ensure the target ship specified by prefer_name actually exists, avoiding transfers of non-existent fleets.
  • [destroy_ships](/wiki/effect/destroy_ships) — When the narrative requires "transferring wreckage after sinking" or cleaning up surplus vessels, you can destroy specific ship types after the transfer to maintain realistic fleet sizes.
  • [has_country_flag](/wiki/trigger/has_country_flag) — Use flags to check conditions before triggering the transfer event (such as diplomatic agreements being signed), preventing duplicate transfer logic execution.
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier) — Add relationship modifiers to both parties after the transfer completes, reflecting the diplomatic benefits of military aid.

Common Pitfalls

  1. prefer_name matching failure produces no error and transfers a random ship instead — If the source nation doesn't actually have a ship with that name (for example, the ship has sunk or was never built), the game silently defaults to randomly selecting one by type, resulting in unexpected outcomes. Always pair this with create_ship or verify in advance that the ship exists.
  2. Scope confusion reverses the transfer directiontransfer_ship must be written within the source nation's scope; target is the receiving nation. Beginners often mistakenly place the entire block under the receiving nation's scope, causing the transfer direction to be completely reversed.