Wiki

trigger · num_of_owned_factories

Definition

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

Description

check the number of factories in owned states excluding any gained or lost through trade, relations, modifiers etc.

实战 · 配合 · 坑

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

实战用法

num_of_owned_factories 常用于判断一个国家的工业实力门槛,例如在国策、决议或事件中要求玩家或 AI 达到一定的工厂基础才能触发某条件。典型场景包括:限制小国走某条军事扩张路线、或作为决议 available 块的前置工业条件。

# 例:某决议仅当本国拥有至少 50 座工厂时才可用
available = {
    num_of_owned_factories > 50
}

配合关系

  • [has_completed_focus](/wiki/trigger/has_completed_focus) — 常与国策完成条件并用,确保玩家在完成特定工业化国策之后才达到工厂数量要求,两者共同构成"工业化路线完成度"的综合检查。
  • [controls_state](/wiki/trigger/controls_state) — 扩张型 mod 中,往往同时检查占领了某关键工业州且工厂总数超过阈值,才解锁下一阶段目标。
  • [any_owned_state](/wiki/trigger/any_owned_state) — 当需要进一步细化"哪些州贡献了工厂"时,可在子作用域内搭配使用,与 num_of_owned_factories 形成宏观与微观两层验证。
  • [add_cic](/wiki/effect/add_cic) — 触发满足工厂数量条件后,常用此 effect 奖励额外民用工厂,形成"工业滚雪球"的正反馈逻辑。

常见坑

  1. 误以为包含贸易/修正因子:该 trigger 统计的是直接拥有州内的工厂数量,通过贸易协议、傀儡上缴或 modifier 临时获得的工厂产能不计入,新手容易将其与实际产能混淆,导致条件判断与预期不符。
  2. Scope 写错导致静默失效num_of_owned_factories 只在 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_owned_factories is commonly used to check a country's industrial capacity threshold, particularly in national focuses, decisions, or events where the player or AI must meet a minimum factory baseline to trigger certain conditions. Typical scenarios include restricting minor nations from certain military expansion routes, or serving as a prerequisite industrial condition in the available block of a decision.

# Example: A decision becomes available only when the nation owns at least 50 factories
available = {
    num_of_owned_factories > 50
}

Synergy

  • [has_completed_focus](/wiki/trigger/has_completed_focus) — Often combined with focus completion checks to ensure players reach the factory count requirement only after completing a specific industrial focus, together forming a comprehensive "industrialization progress" verification.
  • [controls_state](/wiki/trigger/controls_state) — In expansion-oriented mods, typically paired to simultaneously check both occupation of key industrial states and total factory count exceeding a threshold before unlocking the next-stage objective.
  • [any_owned_state](/wiki/trigger/any_owned_state) — When finer-grained analysis of "which states contribute factories" is needed, can be used in conjunction within a child scope alongside num_of_owned_factories to create dual-layer validation at both macro and micro levels.
  • [add_cic](/wiki/effect/add_cic) — After conditions based on factory count are satisfied, commonly used to reward additional civilian factories, creating a positive feedback loop of "industrial snowballing."

Common Pitfalls

  1. Mistakenly assuming it includes trade/modifier factors: This trigger counts only factories directly owned within states. Factory capacity gained through trade agreements, puppet tribute, or temporary modifiers is not included. Newcomers often confuse this with actual production capacity, causing condition checks to diverge from expectations.
  2. Scope errors causing silent failures: num_of_owned_factories is only valid in COUNTRY scope. If accidentally placed within STATE scope (such as inside an any_owned_state sub-block), the script will not error but the check will silently always return false, making debugging extremely time-consuming.