Wiki

effect · random_occupied_country

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

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

实战 · 配合 · 坑

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

实战用法

random_occupied_country 常用于对占领多国的大国玩家触发随机惩罚或奖励,例如随机从被占领国抽取资源、触发事件或添加理念。也可用于在 mod 中模拟"占领地傀儡化"逻辑,随机挑选一个符合条件的被占领国执行后续效果。

# 示例:随机对一个被占领国(非傀儡)执行吞并或释放为傀儡
random_occupied_country = {
    limit = {
        is_puppet = no
        has_war = no
    }
    release_puppet = yes
}

配合关系

  • is_puppet:在 limit 中过滤掉已经是傀儡的国家,确保操作目标是真正被占领但独立的政权。
  • annex_country:对筛选出的随机被占领国直接执行吞并,常用于游戏结束阶段的领土整合事件。
  • has_war:在 limit 中排除仍处于战争状态的国家,防止在不恰当时机触发效果。
  • set_autonomy:对随机被占领国调整自治等级,配合 random_occupied_country 批量处理占领国自治状态时非常实用。

常见坑

  1. limit 漏写导致逻辑错误:不加 limit 时,该 effect 会从所有被占领国中完全随机选取,可能命中预期之外的国家(如与玩家有特殊关系的国家)。建议始终用 limit 缩小候选范围。
  2. scope 混淆random_occupied_country 内部 scope 已切换到被占领国自身,直接在子块里用当前国家的 flag 或特定 tag 条件时需注意主体已变,应使用 ROOTFROM 引用来源国,否则触发或效果会作用在错误的国家上。

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_occupied_country is commonly used to trigger random penalties or rewards against a major power that occupies multiple countries — for example, randomly drawing resources from an occupied nation, firing events, or adding ideas. It can also be used in mods to simulate "puppet-from-occupation" logic, randomly selecting one qualifying occupied country to apply follow-up effects.

# Example: randomly pick one occupied country (non-puppet) and either annex or release it as a puppet
random_occupied_country = {
    limit = {
        is_puppet = no
        has_war = no
    }
    release_puppet = yes
}

Synergy

  • is_puppet: Use inside limit to filter out countries that are already puppets, ensuring the target is a genuinely occupied but nominally independent regime.
  • annex_country: Directly annex the randomly selected occupied country; commonly used in end-game territorial consolidation events.
  • has_war: Use inside limit to exclude countries still at war, preventing the effect from firing at an inappropriate moment.
  • set_autonomy: Adjust the autonomy level of a randomly selected occupied country. Particularly useful when using random_occupied_country to batch-process the autonomy status of multiple occupied nations.

Common Pitfalls

  1. Omitting limit causes logic errors: Without a limit, this effect picks entirely at random from all occupied countries, and may land on an unintended target — such as a country that has a special relationship with the player. Always use limit to narrow the candidate pool.
  2. Scope confusion: Inside random_occupied_country, the scope has already switched to the occupied country itself. If you reference the originating country's flags or a specific tag condition inside the child block, be aware that the subject has changed — use ROOT or FROM to refer back to the source country, otherwise triggers and effects will act on the wrong nation.