Wiki

effect · set_occupation_law

Definition

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

Description

Sets the occupation law for an occupied country, occupied state, or the default occupation law of an occupying country.

- If THIS is a country and it's the same as the PREV country, then THIS's default law is set.
- If THIS is a country and it's different from the PREV country, then PREV's country law override for THIS is set.
- If THIS is a state, then PREV's state law override for THIS is set.

The token default_law is used to remove a country or state override, or to set a country's default law to the law defined with starting_law=yes.

Example:
GER = { set_occupation_law = foreign_civilian_oversight }
GER = { POL = { set_occupation_law = default_law } }
GER = { 123 = { set_occupation_law = military_governor_occupation } }

实战 · 配合 · 坑

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

实战用法

set_occupation_law 常用于占领事件或决策中,根据当前合规度、抵抗强度或战争进程动态切换占领政策,例如在 mod 中实现"当某地区合规度达到阈值时自动升级为更宽松的法律"。也可用于在国家被傀儡化或附属化时为占领国设置默认占领法,模拟更细致的政治控制逻辑。

# 德国对波兰 123 号州强制设置军事管制
GER = {
    123 = {
        set_occupation_law = military_governor_occupation
    }
}

# 移除德国对波兰的州级覆盖,回退为默认法律
GER = {
    POL = {
        set_occupation_law = default_law
    }
}

配合关系

  • [occupation_law](/wiki/trigger/occupation_law):先检查当前占领法是否已是目标类型,避免重复赋值或做条件分支判断(如仅在当前法律为某值时才升级)。
  • [compliance](/wiki/trigger/compliance):合规度是切换占领法的核心判断依据,常与 set_occupation_law 组合,在合规度达到特定区间时自动触发更宽松或更严苛的法律变更。
  • [add_compliance](/wiki/effect/add_compliance):在设置新占领法的同时调整合规度,模拟政策调整带来的即时民心效果。
  • [has_active_resistance](/wiki/trigger/has_active_resistance):判断是否存在活跃抵抗运动,配合使用可在抵抗强烈时强制切换为更严厉的占领法。

常见坑

  1. scope 层级写错:该 effect 需要在外层 scope 为占领国(COUNTRY)、内层 scope 为被占领国或州的嵌套结构下调用;如果直接在顶层国家 scope 内不嵌套地写 set_occupation_law,实际效果是修改该国自身的默认法律,而非对某个具体国家或州的覆盖,初学者容易误以为两者等价。
  2. 误用 default_law 当普通法律 tokendefault_law 是专用的重置/移除覆盖标记,而不是某个具体法律的名称;用它来"设置"占领法实际上是在清除覆盖或还原到 starting_law=yes 定义的初始法律,若本意是设置某个具体政策应改用对应的法律 token。

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 is commonly used in occupation events or decisions to dynamically switch occupation policies based on current compliance, resistance strength, or war progress. For example, in a mod you might implement "automatically upgrade to a more lenient law when a region's compliance reaches a threshold." It can also set default occupation laws for the occupying nation when a country is puppeted or made a subject, simulating more granular political control mechanics.

# Germany forcibly sets military governor occupation on Poland's state 123
GER = {
    123 = {
        set_occupation_law = military_governor_occupation
    }
}

# Remove Germany's state-level override on Poland, reverting to default law
GER = {
    POL = {
        set_occupation_law = default_law
    }
}

Synergy

  • [occupation_law](/wiki/trigger/occupation_law): First check if the current occupation law is already the target type to avoid redundant assignments or branch on conditions (e.g., only upgrade if the current law is a certain value).
  • [compliance](/wiki/trigger/compliance): Compliance is the core decision factor for switching occupation laws; commonly paired with set_occupation_law to automatically trigger more lenient or stricter law changes when compliance reaches specific thresholds.
  • [add_compliance](/wiki/effect/add_compliance): Adjust compliance while setting a new occupation law to simulate the immediate morale effects of policy adjustments.
  • [has_active_resistance](/wiki/trigger/has_active_resistance): Check for active resistance movements; combined use allows forcibly switching to harsher occupation laws when resistance is strong.

Common Pitfalls

  1. Incorrect scope nesting: This effect requires a nested structure where the outer scope is the occupying nation (COUNTRY) and the inner scope is the occupied nation or state. If you write set_occupation_law directly at the top-level country scope without nesting, it actually modifies that nation's own default law rather than applying an override to a specific country or state. Beginners often mistakenly treat these as equivalent.
  2. Misusing default_law as a regular law token: default_law is a special-purpose reset/remove override marker, not the name of an actual occupation law. Using it to "set" an occupation law actually clears the override or reverts to the initial law defined by starting_law=yes. If you intend to set a specific policy, use the corresponding law token instead.