Wiki

trigger · num_of_available_naval_factories

Definition

  • Supported scope:COUNTRY
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

check amount of available naval factories

实战 · 配合 · 坑

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

实战用法

num_of_available_naval_factories 常用于判断某国是否具备足够的海军工业能力,以决定是否解锁特定决策、国策或事件选项,例如限制只有拥有一定闲置海军工厂的国家才能触发大规模造舰计划。在海军 mod 中也常用于 AI 策略的前提条件,避免 AI 在工厂不足时白白触发海军相关选项。

# 仅当国家有足够空闲海军工厂时才允许激活该决策
available = {
    num_of_available_naval_factories > 5
}

配合关系

  • [has_army_size](/wiki/trigger/has_army_size):与 num_of_available_naval_factories 配合,同时检查海军工厂余量与陆军规模,用于判断国家是否具备全面军事扩张的条件。
  • [building_count_trigger](/wiki/trigger/building_count_trigger):可用来确认船坞(naval base/dockyard)建筑数量,与本 trigger 搭配构成「有设施且有空闲产能」的双重门槛。
  • [add_equipment_production](/wiki/effect/add_equipment_production):作为 effect 端的配套,当 trigger 满足后启动舰船生产计划,逻辑上形成「检查产能→分配生产」的完整流程。
  • [any_owned_state](/wiki/trigger/any_owned_state):用于遍历本国州省,结合本 trigger 做更细粒度的产能分布判断,适合需要区分沿海州与内陆州产能的复杂脚本。

常见坑

  1. 混淆「可用」与「总量」:本 trigger 检查的是**空闲(available)**海军工厂数,而非全部海军工厂总数。新手常误以为它等价于总工厂数,导致在国家工厂已被生产线占满时条件仍意外成立或不成立,应结合实际生产队列理解。
  2. Scope 写错导致静默失败:该 trigger 只能在 COUNTRY scope 下生效;若误写在 STATE scope(如 any_owned_state 的子块内)里,游戏不会报错但条件永远无法正确求值,排查时需特别注意当前作用域。

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

num_of_available_naval_factories is commonly used to determine whether a nation possesses sufficient naval industrial capacity, allowing you to gate specific decisions, national focuses, or event options. For example, you can restrict large-scale shipbuilding programs to only nations with a certain number of idle naval factories. In naval mods, it's also frequently used as a prerequisite for AI strategies, preventing the AI from triggering naval-related options when factories are insufficient.

# Only allow this decision to be available if the country has enough idle naval factories
available = {
    num_of_available_naval_factories > 5
}

Synergy

  • [has_army_size](/wiki/trigger/has_army_size): Pair with num_of_available_naval_factories to simultaneously check idle naval factory capacity and army size, useful for determining whether a nation meets conditions for comprehensive military expansion.
  • [building_count_trigger](/wiki/trigger/building_count_trigger): Can be used to confirm the number of dockyard buildings, and combined with this trigger to create a dual threshold of "has facilities and has idle production capacity."
  • [add_equipment_production](/wiki/effect/add_equipment_production): Works as the complementary effect; once the trigger is satisfied, it initiates ship production plans, logically forming a complete "check capacity → allocate production" workflow.
  • [any_owned_state](/wiki/trigger/any_owned_state): Use to iterate through owned states and combine with this trigger for more granular production capacity distribution checks, ideal for complex scripts that need to distinguish between coastal and inland state production capacity.

Common Pitfalls

  1. Confusing "available" with "total": This trigger checks the number of idle (available) naval factories, not the total count of all naval factories. Beginners often mistakenly treat it as equivalent to total factory count, leading to unexpected condition evaluation when a nation's factories are fully occupied by production queues. Always interpret this in the context of actual production lines.
  2. Incorrect scope causing silent failure: This trigger only works in COUNTRY scope; if mistakenly placed in STATE scope (such as inside an any_owned_state block), the game won't error but the condition will never evaluate correctly. Pay special attention to the current scope when debugging.