Wiki

trigger · is_leading_army_in_province

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

is_leading_army_in_province = province_id # checks if the current unit leader is leading an army that has any division in a specific province. Block form { province = X include_field_marshal = yes } also counts a field marshal whose subordinate generals have a division in the province

实战 · 配合 · 坑

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

实战用法

此 trigger 常用于"将领在特定省份激活特殊事件或奖励"的 mod 场景,例如某位指挥官的部队踏入历史名城时触发纪念事件,或在边境省份检测前线指挥官以限制某些决议的执行。

# 示例:仅当该将领的部队位于指定省份时,才允许执行某个军事决策
custom_trigger_tooltip = {
    tooltip = leader_must_be_in_target_province_tt
    is_leading_army_in_province = 9999  # 目标省份 ID
}

配合关系

  • [is_army_leader](/wiki/trigger/is_army_leader):先确认角色是陆军指挥官再检查其部队所在省份,避免对非陆军角色的无效判断。
  • [is_corps_commander](/wiki/trigger/is_corps_commander) / [is_field_marshal](/wiki/trigger/is_field_marshal):与 is_leading_army_in_province 联合使用,可区分军团长与元帅在该省的不同触发逻辑。
  • [has_trait](/wiki/trigger/has_trait):在确认将领驻扎于目标省份后,进一步筛选拥有特定特质的将领,实现精准条件叠加。
  • [add_timed_unit_leader_trait](/wiki/effect/add_timed_unit_leader_trait):条件满足后为该将领临时赋予与省份相关的特质(如"城市攻坚专家"),形成"位置 → 临时增益"的完整逻辑链。

常见坑

  1. 省份 ID 与州 ID 混淆:此 trigger 接受的是省份(province)ID,而非州(state)ID,两者数值体系完全不同,填错会导致条件永远无法成立且不会报错,非常隐蔽。
  2. scope 指向错误:必须在 CHARACTER scope 下调用,若误将其写在 country 或 state scope 的条件块中,脚本不会按预期执行,调试时务必确认当前 scope 已通过 any_army_leader / any_corps_commander 等方式正确切入角色。

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

This trigger is commonly used in mod scenarios where "a general activates special events or rewards in a specific province," such as triggering a commemorative event when a commander's forces enter a historically significant city, or detecting frontline commanders in border provinces to restrict certain decision execution.

# Example: Allow a military decision to execute only when the general's forces are in a specified province
custom_trigger_tooltip = {
    tooltip = leader_must_be_in_target_province_tt
    is_leading_army_in_province = 9999  # Target province ID
}

Synergy

  • [is_army_leader](/wiki/trigger/is_army_leader): First confirm the character is a land force commander before checking their unit's province location, avoiding invalid checks against non-army characters.
  • [is_corps_commander](/wiki/trigger/is_corps_commander) / [is_field_marshal](/wiki/trigger/is_field_marshal): Use in conjunction with is_leading_army_in_province to distinguish different trigger logic for corps commanders versus field marshals in that province.
  • [has_trait](/wiki/trigger/has_trait): After confirming the general is stationed in the target province, further filter for generals with specific traits, enabling precise condition stacking.
  • [add_timed_unit_leader_trait](/wiki/effect/add_timed_unit_leader_trait): Once conditions are met, temporarily grant the general a province-related trait (such as "urban assault specialist"), forming a complete logic chain of "location → temporary bonus."

Common Pitfalls

  1. Confusing province ID with state ID: This trigger accepts province ID, not state ID—the two numbering systems are completely different. Using the wrong one causes the condition to never trigger silently without error, making it very difficult to debug.
  2. Incorrect scope targeting: Must be called within a CHARACTER scope. If written in a condition block under country or state scope, the script will not execute as expected. Always verify the current scope has been properly switched to a character context via any_army_leader / any_corps_commander, etc.