trigger · country_exists
Definition
- Supported scope:
any - Supported target:
THIS,ROOT,PREV,FROM,OWNER,CONTROLLER,OCCUPIED,CAPITAL
Description
check if the specified country exist
country_existsanyTHIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITALcheck if the specified country exist
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
country_exists 常用于判断某个国家标签是否仍在游戏中存在(未被消灭/吞并),在事件、决议或 focus 中作为先决条件,避免对已消亡的国家执行无效操作。例如在一个联盟外交事件中,只有目标国依然存在时才显示相应选项:
available = {
country_exists = GER
country_exists = SOV
}
也可结合 NOT 使用,当某国家已被消灭时触发特殊剧情分支。
[any_country](/wiki/trigger/any_country) — 遍历所有国家时,通常先用 country_exists 在 limit 中过滤,确保只对仍然存在的国家执行逻辑。[scope_exists](/wiki/trigger/scope_exists) — 两者功能相近但作用对象不同;当不确定 event target 是否有效时,scope_exists 负责判断 scope 本身,而 country_exists 专门针对国家标签,常成对出现做双重保险。[has_global_flag](/wiki/trigger/has_global_flag) — 常与 country_exists 共同放在 trigger / available 块中,先确认国家存在、再检查与该国相关的全局旗帜,防止对已消亡国家的旗帜做出错误判断。[save_global_event_target_as](/wiki/effect/save_global_event_target_as) — 在 effect 块里保存某国为全局事件目标前,往往先用 country_exists 确认该国仍然存在,避免保存一个无效 scope。country_exists 的参数必须是硬编码的国家标签(如 GER),不能填写变量名或带引号的字符串;新手有时写成 country_exists = "GER" 或试图传入 var:some_tag,这在大多数版本下会静默失败或报错。country_exists 是纯 trigger,不能直接放在 effect 块的顶层;若需要在 effect 中做条件分支,必须包裹在 [if](/wiki/effect/if) 的 limit = { } 内部才能生效,直接写在 effect 块中会被解析器忽略。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.
country_exists is commonly used to check whether a specific country tag still exists in the game (i.e., has not been eliminated or annexed). It serves as a precondition in events, decisions, or focuses to prevent invalid operations on countries that have ceased to exist. For example, in a diplomatic alliance event, display an option only if the target country still exists:
available = {
country_exists = GER
country_exists = SOV
}
It can also be combined with NOT to trigger special story branches when a country has been eliminated.
[any_country](/wiki/trigger/any_country) — When iterating through all countries, country_exists is typically used in the limit clause to filter and ensure logic only applies to countries that still exist.[scope_exists](/wiki/trigger/scope_exists) — Similar functionality but applies to different targets; when uncertain whether an event target is valid, scope_exists checks the scope itself, while country_exists specifically targets country tags. Often used together as a double-check.[has_global_flag](/wiki/trigger/has_global_flag) — Frequently paired with country_exists in trigger / available blocks, first confirming the country exists, then checking related global flags to prevent incorrect judgments about flags belonging to dead nations.[save_global_event_target_as](/wiki/effect/save_global_event_target_as) — Before saving a country as a global event target in an effect block, use country_exists to confirm the country still exists, avoiding the storage of an invalid scope.country_exists must be a hardcoded country tag (e.g., GER); it cannot accept variable names or quoted strings. Beginners sometimes write country_exists = "GER" or attempt to pass var:some_tag, which silently fails or throws an error in most versions.country_exists is a pure trigger and cannot be placed at the top level of an effect block. To use conditional branching within an effect, it must be wrapped inside the limit = { } of [if](/wiki/effect/if) to take effect; writing it directly in an effect block will be ignored by the parser.