Wiki

effect · random_navy_leader

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Executes children effects on a random Navy Leader of the country in scope, that fulfills the \"limit\" trigger.
tooltip=key can be added to override tooltip title.
ex: GER = {
  random_navy_leader = {
	tooltip = my_loc_key # Optional
	include_invisible = yes # Optional - default = no
    ... character scope effects ...
  }
}

实战 · 配合 · 坑

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

实战用法

random_navy_leader 常用于随机为国家某位海军将领添加特性或提升技能,例如在事件或决策中奖励一名海军指挥官,而不必事先知道其具体 ID。也可结合 limit 筛选特定条件的将领,实现精准随机。

GER = {
    random_navy_leader = {
        limit = {
            is_navy_leader = yes
            skill > 2
        }
        add_trait = { trait = old_guard_navy }
        add_skill_level = 1
    }
}

配合关系

  • is_navy_leader:在 limit 块内使用,确保筛选对象确实是海军将领,避免误选陆军或空军指挥官。
  • has_trait:在 limit 块内配合使用,可以排除或锁定已拥有某特性的将领,防止重复添加。
  • add_unit_leader_trait:在执行块中与本命令配合,为随机选中的海军将领追加单位指挥官特性。
  • add_skill_level:搭配使用,对随机选中的将领直接提升技能等级,常见于奖励类事件。

常见坑

  1. 忘记 limit 导致误选非海军将领:即使是 random_navy_leader,若 limit 条件写得过宽(或完全省略),可能仍然选到当前未担任海军指挥官角色的角色,建议在 limit 中显式加上 is_navy_leader = yes 进行双重保险。
  2. scope 不是 COUNTRY 却直接调用:本 effect 只能在国家 scope 下执行,若在 character scope 或 state scope 中直接书写会导致脚本报错或静默失效,需先通过 GER = { ... } 等方式切换到正确的国家 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

random_navy_leader is commonly used to randomly grant a trait or boost the skill of one of a country's navy leaders — for example, rewarding a naval commander through an event or decision without needing to know their specific ID in advance. You can also pair it with a limit block to filter for leaders that meet specific conditions, enabling targeted random selection.

GER = {
    random_navy_leader = {
        limit = {
            is_navy_leader = yes
            skill > 2
        }
        add_trait = { trait = old_guard_navy }
        add_skill_level = 1
    }
}

Synergy

  • is_navy_leader: Use inside the limit block to ensure the selected character is actually a navy leader, preventing accidental selection of army or air force commanders.
  • has_trait: Use inside the limit block to exclude or target leaders who already possess a certain trait, avoiding duplicate additions.
  • add_unit_leader_trait: Use in the effect block alongside this command to append unit leader traits to the randomly selected navy leader.
  • add_skill_level: Pair with this command to directly increase the skill level of the randomly selected leader; commonly seen in reward-type events.

Common Pitfalls

  1. Forgetting limit and accidentally selecting non-navy leaders: Even with random_navy_leader, if the limit conditions are too broad — or omitted entirely — the game may still pick a character who is not currently acting as a navy leader. It is strongly recommended to explicitly include is_navy_leader = yes inside limit as an extra safeguard.
  2. Calling this effect outside a COUNTRY scope: This effect can only be executed within a country scope. Writing it directly inside a character scope or state scope will cause a script error or silent failure. Always switch to the correct country scope first via something like GER = { ... } before calling it.