Wiki

effect · random_subject_country

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Executes 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 }
}

配合关系

  • is_subject_of — 在 limit 内用于进一步确认附属国是否隶属于当前宗主国,防止联动事件误选非直属附属国。
  • has_war — 在 limit 内过滤掉正在交战的附属国,确保效果只作用于和平状态的目标。
  • add_stability — 最常见的配合操作之一,用于给随机选中的附属国调整内政状态。
  • country_event — 向被选中的附属国派发后续事件,形成宗主国→附属国的事件链叙事。

常见坑

  1. 忘记 limit 导致效果作用于意外目标random_subject_country 只从"直接附属国"中随机抽取,但若不加 limit 限制意识形态或战争状态,可能将增益或惩罚意外施加给局势不合适的附属国,造成难以排查的逻辑 bug。
  2. 在非宗主国 scope 下调用:该 effect 只能在 COUNTRY scope 且该国拥有至少一个附属国时有意义;若宿主国本身是附属国或没有任何 subject,效果会静默失败且不报错,新手容易误以为脚本正常运行。

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_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 }
}

Synergy

  • is_subject_of — Used inside a limit block to further confirm that the subject belongs to the current overlord, preventing chained events from accidentally targeting non-direct subjects.
  • has_war — Used inside a limit block to filter out subjects currently at war, ensuring the effect only applies to targets that are at peace.
  • add_stability — One of the most common pairings; used to adjust the internal political state of the randomly selected subject.
  • country_event — Fires a follow-up event on the selected subject, creating an overlord → subject event chain narrative.

Common Pitfalls

  1. Forgetting 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.
  2. Calling this effect outside a valid overlord scope: This effect is only meaningful within a 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.