Wiki

trigger · has_navy_size

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Checks for amount of ships, additionally of a specified type, archetype, or sub unit definition.

Examples:
	has_navy_size = { size > 10 type = convoy } # Must have more than 10 convoys.
	has_navy_size = { size < 1 archetype = ship_hull_light } # Must not have any ships with light hulls.
	has_navy_size = { size > 39 unit = heavy_cruiser } # Must have 40 or more heavy cruisers.
	has_navy_size = { size < 100 } # Must have fewer than 100 ships of any type.

实战 · 配合 · 坑

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

实战用法

has_navy_size 常用于判断某国是否达到一定海军规模,从而解锁特定国策、决议或事件选项,例如限制小国走海军强国路线,或为玩家设置"舰队成就"触发条件。也可用于 AI 策略的 available 块,在己方潜艇数量达标后才允许执行破交作战决议。

# 当玩家拥有超过 20 艘驱逐舰时,才能激活"海上霸主"决议
available = {
    has_navy_size = {
        size > 20
        type = destroyer
    }
}

配合关系

  • [has_army_size](/wiki/trigger/has_army_size) — 与 has_navy_size 并列使用,可同时检验陆海军规模,用于判断"全面武装"类条件。
  • [any_navy_leader](/wiki/trigger/any_navy_leader) — 检测是否存在海军将领,与 has_navy_size 搭配确保"有舰有将"才能触发特定海战事件。
  • [create_ship](/wiki/effect/create_ship) — 作为 has_navy_size 不满足时的补偿效果,在事件分支里给玩家补充舰船以满足后续判断。
  • [enemies_naval_strength_ratio](/wiki/trigger/enemies_naval_strength_ratio) — 在检查己方舰队数量的同时,通过此 trigger 评估相对敌方的海军强度比,构建更完整的海军优势判断逻辑。

常见坑

  1. 比较运算符方向混淆size < 1 表示"没有任何此类舰船",而非"少于 1 艘"在直觉上的含义——因为舰船数量是整数,< 1 等价于= 0,新手有时误写成 size = 0 却发现该字段不接受 = 运算符而报错。
  2. type/archetype/unit 三者混用type 对应舰船类别(如 convoydestroyer),archetype 对应船体大类(如 ship_hull_light),unit 对应具体子单位定义(如 heavy_cruiser);将三者填错字段会导致条件静默失效(始终返回 false),且不会报错,非常难以排查。

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

has_navy_size is commonly used to check whether a country has reached a certain naval size threshold, thereby unlocking specific national focuses, decisions, or event options. For example, it can restrict smaller nations from pursuing a naval superpower path, or set "fleet achievement" trigger conditions for players. It can also be used in AI strategy available blocks to permit commerce raiding decisions only after submarine counts meet the target.

# Allow the "Naval Supremacy" decision to be activated only when the player owns more than 20 destroyers
available = {
    has_navy_size = {
        size > 20
        type = destroyer
    }
}

Synergy

  • [has_army_size](/wiki/trigger/has_army_size) — Used alongside has_navy_size to simultaneously validate both land and naval force sizes, useful for checking "full mobilization" type conditions.
  • [any_navy_leader](/wiki/trigger/any_navy_leader) — Detects whether naval admirals exist; pair with has_navy_size to ensure "both ships and commanders" before triggering specific naval combat events.
  • [create_ship](/wiki/effect/create_ship) — Serves as a compensatory effect when has_navy_size is not satisfied, allowing you to grant additional ships to the player in event branches to meet subsequent checks.
  • [enemies_naval_strength_ratio](/wiki/trigger/enemies_naval_strength_ratio) — While checking your own fleet size, use this trigger to evaluate the relative naval strength ratio compared to enemies, building a more comprehensive naval advantage assessment logic.

Common Pitfalls

  1. Confusion over comparison operator direction: size < 1 means "no ships of this type exist," not "fewer than 1 ship" in the intuitive sense—since ship counts are integers, < 1 is equivalent to = 0. Beginners sometimes mistakenly write size = 0 only to discover that this field does not accept the = operator and throws an error.
  2. Mixing up type / archetype / unit: type corresponds to ship categories (e.g., convoy, destroyer), archetype corresponds to hull classes (e.g., ship_hull_light), and unit corresponds to concrete subunit definitions (e.g., heavy_cruiser). Filling in the wrong field for any of these causes the condition to silently fail (always returns false) without error reporting, making it extremely difficult to debug.