Wiki

effect · every_neighbor_country

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Executes children effects on every neighbor Country of the country in scope (or \"random_select_amount\" of random country if specified) that fulfills the \"limit\" trigger.
tooltip=key can be added to override tooltip title.
By default the effects are only displayed once, you may display them for each matching country with display_individual_scopes.
ex:
SOV = {
	every_neighbor_country = {
		tooltip = my_loc_key # Optional
		random_select_amount = 3 # Optional
		display_individual_scopes = yes # Optional - default = no
		... country scope effects ...
	}
}

实战 · 配合 · 坑

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

实战用法

every_neighbor_country 常用于外交或战争触发场景,例如让一个国家向所有邻国施加外交压力、传播意识形态、或批量拉入阵营。配合 limit 可以精确筛选满足条件的邻国,例如只对尚未参战或未加入任何阵营的邻国执行操作。

GER = {
    every_neighbor_country = {
        limit = {
            is_in_faction = no
            has_war = no
        }
        add_threat = 5
        add_opinion = {
            target = GER
            value = -20
        }
    }
}

配合关系

  • is_neighbor_of:在外层 trigger 块中先判断两国是否相邻,与 every_neighbor_country 形成条件-执行的配合链。
  • has_war:置于 limit 内筛选邻国的战争状态,避免对已参战国家重复施加效果。
  • is_in_faction:在 limit 内过滤已加入阵营的邻国,常用于拉拢或威慑中立邻国的场景。
  • create_wargoal:对筛选后的邻国批量生成战争目标,是侵略性剧本事件的常见写法。

常见坑

  1. 忘记写 limit 导致效果作用范围过宽every_neighbor_country 默认对所有邻国生效,如果不加 limit 过滤,可能意外影响友好国家或盟友,务必在 limit 块中明确约束目标国家的状态。
  2. 误以为 scope 可以是 STATE:该 effect 只在 COUNTRY scope 下有效,如果在某个 state 事件或 every_owned_state 的子块内直接使用,会因 scope 不匹配导致脚本静默失效或报错,需先切回 country scope(如用 owner = { every_neighbor_country = { ... } })。

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

every_neighbor_country is commonly used in diplomatic or war-trigger scenarios — for example, having a country apply diplomatic pressure to all its neighbors, spread ideology, or bulk-invite nations into a faction. Pairing it with limit allows precise filtering of neighbors that meet specific conditions, such as only targeting countries that are not yet at war or not a member of any faction.

GER = {
    every_neighbor_country = {
        limit = {
            is_in_faction = no
            has_war = no
        }
        add_threat = 5
        add_opinion = {
            target = GER
            value = -20
        }
    }
}

Synergy

  • is_neighbor_of: Use this in an outer trigger block to first check whether two countries share a border, forming a condition-then-execute chain with every_neighbor_country.
  • has_war: Place inside limit to filter neighbors by war status, preventing effects from being applied to countries already at war.
  • is_in_faction: Use inside limit to exclude neighbors already in a faction — a common pattern when trying to court or intimidate neutral neighbors.
  • create_wargoal: Bulk-generate war goals against the filtered set of neighbors; a standard pattern in aggressive scripted events.

Common Pitfalls

  1. Forgetting limit causes the effect to apply too broadly: every_neighbor_country targets all neighboring countries by default. Without a limit filter, you risk accidentally affecting friendly nations or allies. Always use a limit block to explicitly constrain which countries should be targeted.
  2. Assuming the scope can be STATE: This effect is only valid within a COUNTRY scope. Using it directly inside a state event or as a child block of every_owned_state will cause a scope mismatch, resulting in the script silently failing or throwing an error. You must first switch back to a country scope — for example, by wrapping it as owner = { every_neighbor_country = { ... } }.