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
random_other_countryanynoneExecutes 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 }
}
limit 中过滤"是否已处于战争状态",避免对交战国或非交战国误触发。limit 中筛选特定意识形态的国家,使效果只落在目标政体上。limit 导致选中意外国家:不加 limit 时,游戏会从所有存在的国家(exists = yes 不是默认保证的)中随机抽取,可能抽到已亡国或无意义的傀儡,应在 limit 中至少加 exists = yes 作为基础过滤。random_other_country 获取"随机敌方国":该效果的范围是所有国家(排除自身),"敌方"需要在 limit 里通过 has_war_with = ROOT 或 any_enemy_country 等 trigger 显式限制,否则选取范围远超预期。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.
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 }
}
limit to filter on whether a country is already at war, preventing accidental triggers on belligerents or non-belligerents.limit to restrict selection to countries with a specific ideology, so the effect only lands on the intended government type.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.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.