Wiki

trigger · has_resources_rights

Definition

  • Supported scope:STATE, COUNTRY
  • Supported target:none

Description

Checks for resources rights in state.Warning! this always returns false if the state has no resource.
Example:
has_resources_rights = {
	state = 60 # optional - can be used in state scope instead
	receiver = GER # optional - can be used in country scope instead
	resources = {steel oil} # optional - if not provided checks all resources.

实战 · 配合 · 坑

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

实战用法

has_resources_rights 常用于判断某国是否对特定州的资源拥有开采权,典型场景包括:检查傀儡国是否仍在向宗主国输送资源、或在事件/决策中验证资源协议是否生效后再触发后续效果。以下示例在 COUNTRY scope 中检查德国是否持有 60 号州的钢铁与石油权益:

# 在 COUNTRY scope 中使用(德国视角)
trigger = {
    has_resources_rights = {
        state = 60
        receiver = GER
        resources = { steel oil }
    }
}

配合关系

  • [resource_count_trigger](/wiki/trigger/resource_count_trigger):先用 resource_count_trigger 确认目标州实际存在该资源(规避"州无资源必然返回 false"的陷阱),再用 has_resources_rights 检查权益归属,两者形成安全的双重门控。
  • [add_resource](/wiki/effect/add_resource):当权益判断为 false 时,可在 else 分支通过 add_resource 调整州内资源量,间接影响后续权益逻辑的前提条件。
  • [controls_state](/wiki/trigger/controls_state):与 controls_state 联用,可区分"物理占领"与"资源权益"这两种不同的控制形式,避免把占领等同于拥有资源开采权的逻辑错误。
  • [create_import](/wiki/effect/create_import):确认资源权益存在后,配合 create_import 建立正式进口协议,形成"验证权益→建立贸易"的完整流程。

常见坑

  1. 忽略"州无资源必返回 false"的前提:若目标州的对应资源数量为 0,该 trigger 无论如何都不会返回 true,新手常误以为是写法错误而反复调试脚本逻辑,应先用 resource_count_trigger 做前置检查。
  2. STATE/COUNTRY scope 参数混用:在 STATE scope 下无需填 state,在 COUNTRY scope 下无需填 receiver,但若两个参数同时省略,游戏无法定位目标,条件将静默失效,务必根据当前 scope 保留对应的定位参数。

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

has_resources_rights is commonly used to verify whether a country holds extraction rights to resources in a specific state. Typical scenarios include: checking if a puppet state continues to supply resources to its overlord, or validating whether a resource agreement is active before triggering subsequent effects in events/decisions. The following example checks in COUNTRY scope whether Germany holds steel and oil rights in state 60:

# Usage in COUNTRY scope (from Germany's perspective)
trigger = {
    has_resources_rights = {
        state = 60
        receiver = GER
        resources = { steel oil }
    }
}

Synergy

  • [resource_count_trigger](/wiki/trigger/resource_count_trigger): Use resource_count_trigger first to confirm the target state actually contains the resource (avoiding the pitfall where "no resource in state always returns false"), then use has_resources_rights to check rights ownership. These two form a safe double-gate check.
  • [add_resource](/wiki/effect/add_resource): When rights verification returns false, you can use add_resource in an else branch to adjust resource quantities in the state, indirectly affecting the preconditions for subsequent rights logic.
  • [controls_state](/wiki/trigger/controls_state): When used together with controls_state, you can distinguish between "physical occupation" and "resource rights"—two different forms of control. This prevents the logical error of treating occupation as equivalent to holding extraction rights.
  • [create_import](/wiki/effect/create_import): After confirming resource rights exist, pair it with create_import to establish a formal import agreement, forming a complete "verify rights → establish trade" workflow.

Common Pitfalls

  1. Overlooking the "state with no resources always returns false" premise: If the target state's corresponding resource quantity is 0, this trigger will never return true regardless of conditions. Beginners often mistake this for a syntax error and repeatedly debug script logic. Always use resource_count_trigger for preliminary validation first.
  2. Mixing STATE/COUNTRY scope parameters: In STATE scope, you don't need to fill state; in COUNTRY scope, you don't need to fill receiver. However, if both parameters are omitted simultaneously, the game cannot locate the target and the condition silently fails. Always retain the appropriate locating parameters based on your current scope.