effect · random_subject_country
Definition
- Supported scope:
COUNTRY - Supported target:
none
Description
Executes child effects on random subject country that fulfills the limit.
random_subject_countryCOUNTRYnoneExecutes child effects on random subject country that fulfills the limit.
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
random_subject_country 常用于宗主国向旗下所有附属国之一随机分发资源、科技或想法,也可在事件触发时随机挑选一个符合条件的附属国作为剧情对象。配合 limit 块可精确筛选只对尚未参战或满足特定意识形态的附属国生效,避免逻辑错误。
# 宗主国随机选一个未参战的附属国,给予稳定度与额外研究槽
random_subject_country = {
limit = {
has_war = no
is_subject = yes
}
add_stability = 0.05
add_research_slot = 1
country_event = { id = my_mod.42 days = 3 }
}
limit 内用于进一步确认附属国是否隶属于当前宗主国,防止联动事件误选非直属附属国。limit 内过滤掉正在交战的附属国,确保效果只作用于和平状态的目标。limit 导致效果作用于意外目标:random_subject_country 只从"直接附属国"中随机抽取,但若不加 limit 限制意识形态或战争状态,可能将增益或惩罚意外施加给局势不合适的附属国,造成难以排查的逻辑 bug。COUNTRY scope 且该国拥有至少一个附属国时有意义;若宿主国本身是附属国或没有任何 subject,效果会静默失败且不报错,新手容易误以为脚本正常运行。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_subject_country is commonly used to randomly distribute resources, technologies, or ideas from a overlord to one of its subjects. It can also be used during event triggers to randomly select a qualifying subject country as the narrative target. Pairing it with a limit block lets you precisely filter for subjects that have not yet entered a war or meet specific ideological conditions, preventing logic errors.
# The overlord randomly selects one subject that is not at war, granting stability and an extra research slot
random_subject_country = {
limit = {
has_war = no
is_subject = yes
}
add_stability = 0.05
add_research_slot = 1
country_event = { id = my_mod.42 days = 3 }
}
limit block to further confirm that the subject belongs to the current overlord, preventing chained events from accidentally targeting non-direct subjects.limit block to filter out subjects currently at war, ensuring the effect only applies to targets that are at peace.limit causes the effect to hit unintended targets: random_subject_country draws only from direct subjects, but without a limit restricting ideology or war status, buffs or penalties may be accidentally applied to subjects in unsuitable situations, producing logic bugs that are difficult to track down.COUNTRY scope where that country has at least one subject. If the host country is itself a subject or has no subjects at all, the effect will silently fail without any error message — beginners can easily mistake this for the script running correctly.