Wiki

trigger · has_country_leader

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

check if country has leader with specified ID. Don't localize this. Tooltip only for debug.
has_country_leader = {
	ruling_only = yes/no (default = yes)
	character = <string> # recommended criteria
	name = <string> # alternative criteria
	id = <ID> # alternative criteria
}

实战 · 配合 · 坑

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

实战用法

has_country_leader 常用于判断某个特定角色是否正在领导国家,从而触发专属剧情、解锁特定决议或限制科技树分支。例如在一个架空 mod 中,只有当某位领袖在位时才允许玩家激活特定的国家精神:

available = {
    has_country_leader = {
        character = GER_my_custom_leader
        ruling_only = yes
    }
}

配合关系

  • [has_country_leader_with_trait](/wiki/trigger/has_country_leader_with_trait):常与本 trigger 配合使用,在确认领袖身份的同时进一步验证其是否拥有特定特质,避免同名或同角色不同版本的误判。
  • [has_character](/wiki/trigger/has_character):用于区分"角色存在于国家池中"与"角色正在执政"两种状态,配合本 trigger 可构建更精确的条件链。
  • [add_country_leader_trait](/wiki/effect/add_country_leader_trait):确认目标领袖当前在位后,再通过此 effect 为其动态添加特质,防止对非执政角色误操作。
  • [create_country_leader](/wiki/effect/create_country_leader):常在 NOT = { has_country_leader = { character = ... } } 的条件下调用,确保不重复创建已存在的领袖。

常见坑

  1. 忽略 ruling_only 的默认值:该字段默认为 yes,若你需要检查角色即使未执政也在国家角色列表中(如担任顾问期间),必须显式写 ruling_only = no,否则条件永远不会为真。
  2. 将此 trigger 用于本地化文本:官方明确标注"Don't localize this",不要将其放入 custom_trigger_tooltip 对玩家展示,否则 tooltip 会显示无意义的调试文本而非可读信息;应另外用 [has_character](/wiki/trigger/has_character) 等 trigger 配合自定义 tooltip 来代替。

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

has_country_leader is commonly used to check whether a specific character is currently leading a nation, enabling you to trigger exclusive events, unlock specific decisions, or restrict technology tree branches. For example, in an alternate history mod, you might allow players to activate a particular national spirit only when a certain leader is in power:

available = {
    has_country_leader = {
        character = GER_my_custom_leader
        ruling_only = yes
    }
}

Synergy

  • [has_country_leader_with_trait](/wiki/trigger/has_country_leader_with_trait): Often paired with this trigger to confirm a leader's identity while further verifying whether they possess specific traits, avoiding misidentification of same-named or alternate versions of the same character.
  • [has_character](/wiki/trigger/has_character): Used to distinguish between "character exists in the nation's character pool" and "character is currently ruling," which can be combined with this trigger to construct more precise conditional chains.
  • [add_country_leader_trait](/wiki/effect/add_country_leader_trait): After confirming that a target leader is currently in power, use this effect to dynamically add traits to them, preventing accidental modifications to non-ruling characters.
  • [create_country_leader](/wiki/effect/create_country_leader): Commonly invoked under the condition NOT = { has_country_leader = { character = ... } } to ensure that already-existing leaders are not created twice.

Common Pitfalls

  1. Overlooking the default value of ruling_only: This field defaults to yes. If you need to check whether a character exists in the nation's character pool even if not currently ruling (such as while serving as an advisor), you must explicitly write ruling_only = no, otherwise the condition will never evaluate to true.
  2. Using this trigger in localization text: The game explicitly marks this as "Don't localize this"—do not place it inside custom_trigger_tooltip to display to players, as the tooltip will show meaningless debug text rather than readable information. Instead, use other triggers like [has_character](/wiki/trigger/has_character) paired with custom tooltips as a replacement.