effect · random_enemy_country
Definition
- Supported scope:
COUNTRY - Supported target:
none
Description
Executes children effects on random enemy country that fulfills the "limit" trigger.
random_enemy_countryCOUNTRYnoneExecutes children effects on random enemy country that fulfills the "limit" trigger.
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
random_enemy_country 常用于战争事件中,对当前国家的某一个随机敌对国施加惩罚或附加效果,例如降低其战争支持、添加负面 idea 或宣布额外战争目标。它会自动从所有处于交战状态的敌国中随机选取一个,结合 limit 可进一步筛选目标。
country_event = {
id = my_mod.10
# ...
option = {
name = my_mod.10.a
random_enemy_country = {
limit = {
has_war = yes
is_major = yes
}
add_war_support = -0.10
add_ideas = my_war_exhaustion_idea
}
}
}
limit 内使用,精确筛选出与本国处于特定战争关系的敌国,而非泛指所有敌对方。limit 内限定只对大国生效,避免效果浪费在小型傀儡或炮灰国上。limit 不等于保证有目标:若当前国家没有任何符合条件的敌对国,整个 block 静默跳过,不会报错也不会有任何输出,新手常误以为是脚本语法写错了。建议在调试时配合 print_variables 或日志验证作用域。random_enemy_country 依赖实际的战争关系,若当前 scope 所指国家 has_war = no,则永远不会选到任何目标;不少新手在 on_startup 或和平期事件中误用此命令却得不到任何效果。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_enemy_country is commonly used in war events to apply penalties or additional effects to a random enemy of the current country — for example, reducing their war support, adding a negative idea, or declaring extra war goals. It automatically picks one country at random from all nations currently at war with the scoped country; pairing it with limit lets you narrow down the eligible targets further.
country_event = {
id = my_mod.10
# ...
option = {
name = my_mod.10.a
random_enemy_country = {
limit = {
has_war = yes
is_major = yes
}
add_war_support = -0.10
add_ideas = my_war_exhaustion_idea
}
}
}
limit to precisely target enemies that share a specific war with the scoped country, rather than matching all hostile parties indiscriminately.limit, preventing it from being wasted on minor puppets or cannon-fodder nations.limit does not guarantee a valid target exists: If the scoped country has no enemies that satisfy the conditions, the entire block is silently skipped — no error, no output. Beginners often assume their script syntax is broken. When debugging, use print_variables or log checks to verify the scope is resolving as expected.random_enemy_country relies on an actual war relationship. If the scoped country has has_war = no, no target will ever be selected. Many beginners mistakenly use this command in on_startup triggers or peacetime events and then wonder why nothing happens.