Wiki

effect · global_every_army_leader

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Executes children effects on every Army Leader (or \"random_select_amount\" of random leader if specified) for EVERY COUNTRY, that fulfills the \"limit\" trigger.
Better to use every_army_leader if you know the country to search in.
tooltip=key can be added to override tooltip title.
By default the effects are only displayed once, you may display them for each matching unit leader with display_individual_scopes.
global_every_army_leader = {
	tooltip = my_loc_key # Optional
	random_select_amount = 3 # Optional
	include_invisible = yes # Optional - default = no
	display_individual_scopes = yes # Optional - default = no
	... character scope effects ...
}

实战 · 配合 · 坑

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

实战用法

global_every_army_leader 适合在全局事件或决议中对所有国家的陆军将领批量施加 trait 或修改属性,例如世界大战爆发时为每位将领添加战时特质,或在游戏开局 immediate 块中清洗掉某类特质。当你明确知道目标国家时应优先使用 every_army_leader,只有需要遍历全体国家时才动用此命令以避免不必要的性能开销。

# 全局事件:为所有国家中技能≥4的陆军将领添加特质
global_every_army_leader = {
    limit = {
        skill > 3
    }
    add_trait = { trait = brilliant_strategist }
}

配合关系

  • [any_army_leader](/wiki/trigger/any_army_leader):在触发条件中先用此 trigger 验证某国是否存在符合条件的将领,再决定是否执行 global 遍历,避免无意义的循环。
  • [every_army_leader](/wiki/effect/every_army_leader):当已通过逻辑确定目标国家后,改用 every_army_leader 替代全局版本,性能更优,两者逻辑结构完全相同便于互换。
  • [add_trait](/wiki/effect/add_trait):最常见的内层执行命令,配合 limit 筛选将领后批量赋予或修改 trait。
  • [every_country_with_original_tag](/wiki/effect/every_country_with_original_tag):有时需要先遍历特定国家集合,再在内层调用 every_army_leader;而 global_every_army_leader 则是将这两层合并的便捷替代,了解两者关系有助于选择合适的写法。

常见坑

  1. 忽略性能代价global_every_army_leader 会遍历游戏内所有存在国家的所有陆军将领,在后期国家数量多时开销显著;若只需处理特定几个国家,务必改用 every_army_leader 并明确指定 scope,而不是用 limit 在全局版本里过滤国家——limit 只能过滤将领,无法在顶层过滤国家。
  2. 误用 scope:此命令的 scope 是 COUNTRY,但执行块内部已自动切换到 character scope,新手常在内层再套一层 every_army_leader 导致逻辑错误或死循环,内层应直接写 character scope 的 effect(如 add_traitadd_skill_level 等)。

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

global_every_army_leader is ideal for mass-applying traits or modifying attributes of army leaders across all nations in global events or decisions—for example, adding wartime traits to every leader when World War breaks out, or purging certain traits in the game's immediate block at startup. When you know the target nation explicitly, prefer every_army_leader instead; only resort to this command when you need to iterate over all nations to avoid unnecessary performance overhead.

# Global event: add a trait to all army leaders with skill ≥4 across all nations
global_every_army_leader = {
    limit = {
        skill > 3
    }
    add_trait = { trait = brilliant_strategist }
}

Synergy

  • [any_army_leader](/wiki/trigger/any_army_leader): Use this trigger in conditional blocks first to verify whether a nation has leaders matching your criteria, then decide whether to execute the global iteration—this avoids pointless loops.
  • [every_army_leader](/wiki/effect/every_army_leader): Once you've logically determined the target nation, switch to every_army_leader instead of the global variant for better performance; both share identical structure making them interchangeable.
  • [add_trait](/wiki/effect/add_trait): The most common inner execution command; pair it with limit to filter leaders, then batch-assign or modify traits.
  • [every_country_with_original_tag](/wiki/effect/every_country_with_original_tag): Sometimes you need to iterate over a specific nation set first, then call every_army_leader in the nested layer; global_every_army_leader merges these two steps into a convenient shortcut—understanding their relationship helps you choose the right approach.

Common Pitfalls

  1. Overlooking performance cost: global_every_army_leader iterates through all army leaders in every nation that exists in the game; late-game overhead becomes significant as nation count grows. If you only need to handle a few specific nations, switch to every_army_leader with explicit scope instead of filtering nations with limit in the global variant—limit can only filter leaders, not nations at the top level.
  2. Misusing scope: This command's scope is COUNTRY, but the execution block automatically switches to character scope. Newcomers often nest another every_army_leader inside, causing logic errors or infinite loops; the inner block should directly contain character-scoped effects (such as add_trait, add_skill_level, etc.).