Wiki

trigger · has_military_access_to

Definition

  • Supported scope:COUNTRY
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

check country has military access to specified country

实战 · 配合 · 坑

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

实战用法

has_military_access_to 常用于外交或决策 mod 中,判断己方是否已取得某国的军事通行权,从而决定是否解锁特定战略决策或触发剧情事件。例如在一个"借道进攻"的任务链里,可以用它作为前置条件,防止玩家在尚未获得通行权时就执行穿越性战略部署:

available = {
    has_military_access_to = FROM
}

配合关系

  • [gives_military_access_to](/wiki/trigger/gives_military_access_to):两者互为镜像——has_military_access_to 检查"我能借道谁",gives_military_access_to 检查"我给了谁通行权",配合使用可完整描述双向通行状态。
  • [has_defensive_war_with](/wiki/trigger/has_defensive_war_with):判断双方是否处于战争状态,因为开战后通行协议通常失效,配合使用可避免逻辑矛盾。
  • [any_allied_country](/wiki/trigger/any_allied_country):在遍历盟友时嵌套 has_military_access_to,可以统计或确认联盟内哪些成员已授予通行权,用于复杂联合作战条件判断。
  • [diplomatic_relation](/wiki/effect/diplomatic_relation):当通行权条件满足时,用该 effect 进一步调整外交关系,形成"确认通行→更新关系"的完整逻辑链。

常见坑

  1. Scope 写错方向:新手容易把 scope 国和目标国搞反——has_military_access_to 的主语是"发起检查的国家",括号内填的是"被借道的目标国"。如果写反,条件永远不会按预期触发。
  2. 误以为包含战争状态:军事通行协议与交战状态是两套独立系统,与某国开战不等于自动拥有其通行权,依赖该 trigger 判断"是否能穿越领土作战"时须额外配合战争/联盟相关 trigger 做完整校验。

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_military_access_to is commonly used in diplomatic or decision mods to check whether your nation has obtained military passage rights from another country, thereby determining whether to unlock specific strategic decisions or trigger scripted events. For example, in a mission chain about "transit attack," you can use it as a prerequisite condition to prevent players from executing cross-territory strategic deployment without first obtaining passage rights:

available = {
    has_military_access_to = FROM
}

Synergy

  • [gives_military_access_to](/wiki/trigger/gives_military_access_to): The two are mirror images—has_military_access_to checks "whose territory can I pass through," while gives_military_access_to checks "to whom have I granted passage," using them together provides a complete picture of bidirectional passage status.
  • [has_defensive_war_with](/wiki/trigger/has_defensive_war_with): Determines whether both sides are at war, since passage agreements typically become invalid after warfare begins; combining these prevents logical contradictions.
  • [any_allied_country](/wiki/trigger/any_allied_country): When iterating through allies, nest has_military_access_to to count or confirm which alliance members have already granted passage rights, useful for complex joint operations condition evaluation.
  • [diplomatic_relation](/wiki/effect/diplomatic_relation): When passage conditions are met, use this effect to further adjust diplomatic relations, forming a complete logic chain of "confirm passage → update relations."

Common Pitfalls

  1. Scope direction reversed: Beginners often confuse the scope country and target country—the subject of has_military_access_to is "the country initiating the check," while the brackets contain "the target country being passed through." If reversed, the condition will never trigger as intended.
  2. Mistaking it for inclusion of war status: Military passage agreements and wartime state are two separate systems; being at war with a country does not automatically grant you passage rights through it. When relying on this trigger to judge "whether we can pass through territory to fight," you must additionally combine it with war/alliance-related triggers for complete verification.