Wiki

effect · random_other_country

Definition

  • Supported scope:any
  • Supported target:none

Description

Executes children effects on random country that fulfills the "limit" trigger. Excludes current country

实战 · 配合 · 坑

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

实战用法

random_other_country 常用于"随机向一个满足条件的他国发送外交事件"或"对一个随机敌对/中立国执行惩罚/奖励效果",典型场景包括随机援助、随机宣战目标抽取、以及随机扩散意识形态等。注意它自动排除当前 scope 国家,无需额外过滤。

# 示例:随机向一个与本国没有战争、且是 AI 的小国宣传并增加其战争支持
random_other_country = {
    limit = {
        is_ai = yes
        has_war = no
        is_major = no
    }
    add_war_support = 0.05
    country_event = { id = my_mod.42 }
}

配合关系

  • has_war — 在 limit 中过滤"是否已处于战争状态",避免对交战国或非交战国误触发。
  • has_government — 在 limit 中筛选特定意识形态的国家,使效果只落在目标政体上。
  • country_event — 配合在选中的随机国家上触发一个专属事件,实现"被随机选中国家感知到该操作"。
  • add_ideas — 对随机选中国家直接叠加某个 idea,常用于意识形态扩散或阵营效果。

常见坑

  1. 忘记写 limit 导致选中意外国家:不加 limit 时,游戏会从所有存在的国家(exists = yes 不是默认保证的)中随机抽取,可能抽到已亡国或无意义的傀儡,应在 limit 中至少加 exists = yes 作为基础过滤。
  2. 误以为可以用 random_other_country 获取"随机敌方国":该效果的范围是所有国家(排除自身),"敌方"需要在 limit 里通过 has_war_with = ROOTany_enemy_country 等 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

random_other_country is most commonly used to "send a diplomatic event to a randomly selected foreign country that meets certain conditions" or "apply a penalty or reward effect to a random hostile/neutral nation." Typical use cases include random aid distribution, random war target selection, and random ideology spread. Note that it automatically excludes the current scope's country, so no extra filtering is needed for that.

# Example: randomly pick an AI-controlled minor nation not at war, boost its war support, and fire an event
random_other_country = {
    limit = {
        is_ai = yes
        has_war = no
        is_major = no
    }
    add_war_support = 0.05
    country_event = { id = my_mod.42 }
}

Synergy

  • has_war — Use inside limit to filter on whether a country is already at war, preventing accidental triggers on belligerents or non-belligerents.
  • has_government — Use inside limit to restrict selection to countries with a specific ideology, so the effect only lands on the intended government type.
  • country_event — Pair with this to fire a dedicated event on the randomly selected country, letting that country "react" to whatever just happened to it.
  • add_ideas — Directly stack an idea onto the randomly chosen country; commonly used for ideology spread or faction-wide effects.

Common Pitfalls

  1. Forgetting limit and picking an unintended country: Without a limit block, the game draws from all countries in the database — exists = yes is not guaranteed by default — which means it can land on a already-defeated nation or a meaningless puppet. Always include at least exists = yes in limit as a baseline filter.
  2. Assuming random_other_country inherently targets "random enemies": The scope of this effect is all countries (excluding the current scope). "Enemy" must be explicitly constrained inside limit using triggers such as has_war_with = ROOT or similar checks like any_enemy_country; otherwise the selection pool will be far larger than intended.