Wiki

trigger · is_dynamic_country

Definition

  • Supported scope:COUNTRY
  • Supported target:any

Description

returns true if the country is a dynamic country (tag is D01-D50)

实战 · 配合 · 坑

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

实战用法

is_dynamic_country 常见于需要排除或专门处理动态生成国家(如内战分裂国、傀儡衍生国)的场景,例如防止 AI 策略、决策或国家事件错误地触发到这些临时标签国家上。比如在一个"仅对真实国家生效"的决策中用来过滤掉动态国家:

available = {
    NOT = { is_dynamic_country = yes }
}

也可以反向使用,在专门针对动态国家的清理/合并逻辑中作为触发前提。

配合关系

  • [exists](/wiki/trigger/exists):动态国家有时处于已消亡状态,配合 exists = yes 可确保目标国家既存在又是动态国家,避免空指针式逻辑错误。
  • [any_other_country](/wiki/trigger/any_other_country)(→ [any_enemy_country](/wiki/trigger/any_enemy_country)):在遍历所有敌对国时,常用 is_dynamic_country 在 limit 块内排除或筛选动态标签,保证逻辑只作用于预期的国家集合。
  • [has_country_flag](/wiki/trigger/has_country_flag):动态国家通常会被 mod 打上自定义 flag 来标记其来源,两者配合可进一步区分是哪类动态国家(内战方、傀儡等)。
  • [annex_country](/wiki/effect/annex_country):在处理动态国家消除逻辑时,常先用 is_dynamic_country = yes 确认身份,再执行吞并操作,防止误吞真实国家。

常见坑

  1. 混淆"动态国家"与"傀儡/受保护国":新手容易以为所有由事件或决策创建的国家都是动态国家,实际上只有标签落在 D01–D50 范围内的才返回 true;通过 set_cosmetic_tag 改了外观的普通国家并不受影响,不要用此 trigger 代替 has_cosmetic_tag 做外观判断。
  2. 在 COUNTRY 以外的 scope 使用:该 trigger 仅支持 COUNTRY scope,若写在 STATE 或 CHARACTER scope 的条件块内会静默失败(始终返回 false),排查时不会有明显报错,需要特别留意当前 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

is_dynamic_country is commonly used in scenarios where you need to exclude or specifically handle dynamically generated countries (such as civil war splinter states or puppet-derived tags). For example, it prevents AI strategies, decisions, or country events from incorrectly triggering on these temporary country tags. Here's an example of using it in a decision that should only apply to "real" countries:

available = {
    NOT = { is_dynamic_country = yes }
}

It can also be used in reverse—as a prerequisite trigger in cleanup or merging logic specifically targeting dynamic countries.

Synergy

  • [exists](/wiki/trigger/exists): Dynamic countries sometimes exist in a destroyed state. Combining with exists = yes ensures the target country both exists and is dynamic, avoiding null-pointer-like logic errors.
  • [any_other_country](/wiki/trigger/any_other_country) (→ [any_enemy_country](/wiki/trigger/any_enemy_country)): When iterating through all hostile countries, is_dynamic_country is commonly used within a limit block to exclude or filter dynamic tags, ensuring the logic only applies to the intended set of countries.
  • [has_country_flag](/wiki/trigger/has_country_flag): Dynamic countries are typically marked with custom flags by mods to indicate their origin. Combined with this trigger, you can further distinguish which type of dynamic country you're dealing with (civil war faction, puppet, etc.).
  • [annex_country](/wiki/effect/annex_country): When handling dynamic country elimination logic, first confirm the identity with is_dynamic_country = yes, then execute the annexation, preventing accidental annexation of real countries.

Common Pitfalls

  1. Confusing "dynamic countries" with "puppets/subject states": Beginners often assume all countries created by events or decisions are dynamic countries. In reality, only tags falling within the D01–D50 range return true. Regular countries whose appearance has been changed via set_cosmetic_tag are not affected—don't use this trigger as a substitute for has_cosmetic_tag for appearance checks.
  2. Using outside COUNTRY scope: This trigger only supports COUNTRY scope. If written in a condition block within STATE or CHARACTER scope, it will silently fail (always returning false). No obvious error will be logged during debugging, so pay special attention to whether the current scope has switched to country level.