Wiki

trigger · num_subjects

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

check the number of subjects of nation

实战 · 配合 · 坑

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

实战用法

num_subjects 常用于判断某国是否拥有足够数量的附庸/傀儡国,从而解锁特定决议、国策或事件,例如"帝国扩张"类 mod 中要求玩家控制一定数量傀儡后才能触发帝国宣言。也可用于 AI 策略的条件门槛,防止 AI 在羽翼未丰时就尝试宣战。

# 当玩家拥有至少 3 个附庸国时,解锁帝国宣言决议
available = {
    num_subjects > 2
}

配合关系

  • [any_subject_country](/wiki/trigger/any_subject_country) — 在确认附庸数量达标后,进一步筛选某个具体附庸是否满足额外条件(如意识形态、国力等),两者形成"量"与"质"的双重校验。
  • [has_autonomy_state](/wiki/trigger/has_autonomy_state) — 附庸数量达标的同时,还需检查特定附庸的自治状态等级,常用于控制傀儡晋升/降级的触发条件。
  • [every_subject_country](/wiki/effect/every_subject_country) — 数量条件通过后,用此 effect 对所有附庸批量执行操作(如添加 idea、转移资源),逻辑上构成"先判断数量,再批量处理"的标准流程。
  • [end_puppet](/wiki/effect/end_puppet) — 在附庸过多时触发裁减逻辑,与 num_subjects 构成上限保护机制,避免附庸数超出剧本设计上限。

常见坑

  1. 比较运算符混淆num_subjects 需配合 > / < / = 等运算符使用,直接写 num_subjects = 3 表示恰好等于 3,而非"至少 3",想表达"至少"应写 num_subjects > 2,新手常因此出现条件永远不触发的 bug。
  2. scope 对象错误:此 trigger 只能在 COUNTRY scope 下使用,若误放入 STATE scope(如 limit 块内的 state 循环中)会导致脚本报错或静默失效,使用前务必确认当前 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

num_subjects is commonly used to determine whether a nation possesses a sufficient number of subjects/puppets, thereby unlocking specific decisions, national focuses, or events—for example, in "Imperial Expansion"-style mods that require players to control a certain number of puppets before triggering an imperial declaration. It can also serve as a conditional threshold in AI strategies, preventing the AI from attempting warfare before it is fully prepared.

# Unlock the imperial declaration decision when the player owns at least 3 subjects
available = {
    num_subjects > 2
}

Synergy

  • [any_subject_country](/wiki/trigger/any_subject_country) — After confirming the subject count threshold is met, further filter whether a specific subject satisfies additional conditions (such as ideology or military strength), forming a dual verification of "quantity" and "quality."
  • [has_autonomy_state](/wiki/trigger/has_autonomy_state) — While the subject count reaches the target, also check the autonomy level of a particular subject, commonly used to control the trigger conditions for puppet promotion/demotion.
  • [every_subject_country](/wiki/effect/every_subject_country) — Once the quantity condition passes, use this effect to execute operations on all subjects in batch (such as adding ideas or transferring resources), logically forming a standard workflow of "check quantity first, then batch process."
  • [end_puppet](/wiki/effect/end_puppet) — Trigger reduction logic when there are too many subjects, forming an upper-limit protection mechanism with num_subjects to prevent the subject count from exceeding the scenario design ceiling.

Common Pitfalls

  1. Confusion with comparison operators: num_subjects must be paired with operators like > / < / =, and writing num_subjects = 3 directly means exactly equal to 3, not "at least 3." To express "at least," write num_subjects > 2. Beginners often introduce bugs where conditions never trigger due to this mistake.
  2. Incorrect scope object: This trigger can only be used in COUNTRY scope. Placing it mistakenly in STATE scope (such as within state loops in a limit block) causes script errors or silent failures. Always confirm that the current scope actually refers to a nation before use.