Wiki

effect · set_occupation_law_where_available

Definition

  • Supported scope:STATE, COUNTRY
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

See set_occupation_law for basic functionality. What differentiates this effect is that if the law is not available on the given level it will attempt to set it on a level below. I.e. if the law can't be set as the default law it will try to set it on each country, and if that fails it will try to set it on each state. Any existing law overrides below a level at which a law is successfully set will be cleared.

Example:
ITA = { set_occupation_law_where_available = colonial_police } # Set law in all countries/states where it's available.
ITA = { every_occupied_country = { set_occupation_law_where_available = default_law } } # Remove all country and state overrides.

实战 · 配合 · 坑

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

实战用法

set_occupation_law_where_available 常用于 mod 中批量推行占领政策的场景,例如在某国完成特定国策或事件后,自动将所有被占领地区切换到指定法律,同时无需手动判断哪些地区可以适用该法律。与 set_occupation_law 相比,它会自动降级尝试(默认→各国覆盖→各州覆盖),特别适合跨多国多州的大范围占领管理。

# 某国完成"殖民整合"国策后,在所有占领地区推行殖民警察制度
complete_national_focus = colonial_integration
hidden_effect = {
    ITA = {
        set_occupation_law_where_available = colonial_police
    }
}

# 清除所有国家/州级覆盖,恢复默认法律
ITA = {
    every_occupied_country = {
        set_occupation_law_where_available = default_law
    }
}

配合关系

  • [occupation_law](/wiki/trigger/occupation_law):在设置前用于检查当前占领法律状态,避免重复触发或产生逻辑冲突。
  • [set_occupation_law](/wiki/effect/set_occupation_law):当需要精确控制特定层级(不允许降级回退)时改用此命令,两者形成精细/粗放的互补关系。
  • [compliance](/wiki/trigger/compliance):占领法律的推行效果通常与顺从度挂钩,搭配该触发器可以设置顺从度门槛条件,例如达到一定顺从度后再推行更宽松的法律。
  • [add_compliance](/wiki/effect/add_compliance):更换占领法律后往往需要配合调整顺从度,模拟政策过渡期的民心变化。

常见坑

  1. 误以为此 effect 与 set_occupation_law 完全等价:新手常在只需设置单一层级法律时也使用此命令,导致意外清除了下层已有的州/国级覆盖("成功设置后会清除该层级以下所有覆盖"),破坏了精心设计的差异化占领政策。
  2. 在非占领地区的 STATE scope 中调用无效果却不报错:如果目标 STATE 不属于任何占领状态,该命令会静默失败而不给出任何提示,导致 mod 调试时难以发现法律未被正确应用的问题,建议配合 [occupation_law](/wiki/trigger/occupation_law) 或相关条件先行校验。

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

set_occupation_law_where_available is commonly used in mods for mass deployment of occupation laws across multiple territories. For example, after a nation completes a specific national focus or event, it can automatically switch all occupied regions to a designated law without manually checking which regions are eligible for that law. Compared to set_occupation_law, it automatically attempts degradation (default → country-wide coverage → state-wide coverage), making it especially suitable for large-scale occupation management across multiple nations and states.

# After a nation completes the "Colonial Integration" focus, deploy colonial police system across all occupied territories
complete_national_focus = colonial_integration
hidden_effect = {
    ITA = {
        set_occupation_law_where_available = colonial_police
    }
}

# Clear all nation/state-level overrides and restore default law
ITA = {
    every_occupied_country = {
        set_occupation_law_where_available = default_law
    }
}

Synergy

  • [occupation_law](/wiki/trigger/occupation_law): Check the current occupation law status before setting to avoid duplicate triggers or logical conflicts.
  • [set_occupation_law](/wiki/effect/set_occupation_law): Use this command when precise control over a specific tier (no degradation fallback) is required; the two commands form a complementary relationship between fine-grained and coarse-grained control.
  • [compliance](/wiki/trigger/compliance): The effects of occupation laws are typically linked to compliance levels. Pairing with this trigger allows you to set compliance thresholds before implementing more lenient laws.
  • [add_compliance](/wiki/effect/add_compliance): After changing occupation laws, compliance adjustments are often needed to simulate population sentiment changes during the policy transition period.

Common Pitfalls

  1. Mistaking this effect as completely equivalent to set_occupation_law: Beginners often use this command even when setting a single-tier law is sufficient, accidentally clearing state/nation-level overrides below that tier (the effect "clears all overrides below this tier after successful application"), destroying carefully designed differentiated occupation policies.
  2. Calling in STATE scope of non-occupied regions produces no effect but no error: If the target STATE is not under any occupation status, this command fails silently without any warning, making it difficult to detect unapplied laws during mod debugging. It's recommended to validate with [occupation_law](/wiki/trigger/occupation_law) or related conditions beforehand.