Wiki

trigger · has_resources_in_country

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

checks for amount of resources in country (the balance by default)
	Example:
	```
	has_resources_in_country = {
		resource = chromium
		amount > 10
		only_imported = no # (optional, default: no) checks only imported resources instead of country balance
		extracted = no # (optional, default: no) checks extracted amount instead of country balance
		buildings = no # (optional, default: no) checks only amount from local buildings instead of country balance
	}
	```

实战 · 配合 · 坑

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

实战用法

常用于判断某国是否拥有足够的战略资源储备,从而解锁特定决议、国策或事件选项。例如在资源外交类 mod 中,可以检测某国铬矿或橡胶的国内余量是否充足,以决定是否触发贸易谈判事件;也可以结合生产类 mod,要求玩家积累一定量的稀土资源才能开启特殊科技路线。

# 仅当国内铬矿余额超过 10 时,决策才可用
available = {
    has_resources_in_country = {
        resource = chromium
        amount > 10
    }
}

配合关系

  • [building_count_trigger](/wiki/trigger/building_count_trigger):常与本 trigger 共同作为决策前提,同时检查资源量和相关建筑等级,避免玩家在基础设施不足时就触发高级工业决策。
  • [add_resource](/wiki/effect/add_resource):当资源条件满足后,通过 effect 进一步调整资源量,形成"检测-消耗"或"检测-奖励"的完整逻辑闭环。
  • [add_ideas](/wiki/effect/add_ideas):在资源储量达标时给予对应国策思潮或工业加成,模拟"资源充裕→产业升级"的叙事流程。
  • [has_built](/wiki/trigger/has_built):配合检测是否已建造采矿站,与 buildings = yes 参数联用时语义更完整,可区分"来自本地建筑的产出"与"国家总余额"。

常见坑

  1. 混淆 extractedbuildings 参数的含义extracted = yes 检查的是全国已开采总量,而 buildings = yes 仅统计本国本土建筑产出,两者都会绕过正常的贸易余额逻辑;新手经常将两者混用,导致在有大量进口资源时条件意外不满足或意外满足。
  2. 忘记该 trigger 只在 COUNTRY scope 下有效:若将其写在 STATE scope 的 limit 块中(例如 every_owned_state 的内层),脚本不会报错但判断对象会指向错误的 scope,产生难以察觉的逻辑漏洞;务必在进入 state 循环前于国家层面先行判断。

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

Commonly used to check whether a nation possesses sufficient strategic resource reserves, thereby unlocking specific decisions, national focuses, or event options. For example, in resource diplomacy mods, you can detect whether a nation's domestic chromium or rubber surplus is adequate to trigger trade negotiation events; it can also be combined with production mods to require players to accumulate a certain amount of rare earth resources before unlocking special tech trees.

# Decision is only available when domestic chromium balance exceeds 10
available = {
    has_resources_in_country = {
        resource = chromium
        amount > 10
    }
}

Synergy

  • [building_count_trigger](/wiki/trigger/building_count_trigger): Often works alongside this trigger as a decision prerequisite, simultaneously checking resource quantities and building levels to prevent players from triggering advanced industrial decisions when infrastructure is insufficient.
  • [add_resource](/wiki/effect/add_resource): Once resource conditions are met, further adjust resource quantities through effects, forming a complete logical loop of "detection-consumption" or "detection-reward".
  • [add_ideas](/wiki/effect/add_ideas): Grant corresponding national spirits or industrial bonuses when resource reserves meet the threshold, simulating the narrative flow of "abundant resources → industrial upgrade".
  • [has_built](/wiki/trigger/has_built): Combined with checking whether mining stations have been constructed; when used together with the buildings = yes parameter, the semantics become more complete, allowing distinction between "output from domestic buildings" and "national total balance".

Common Pitfalls

  1. Confusing the extracted and buildings parameters: extracted = yes checks the total amount extracted nationwide, while buildings = yes only counts domestic domestic building output; both bypass normal trade balance logic. Beginners often mix the two up, causing conditions to unexpectedly fail or succeed when large quantities of imported resources are present.
  2. Forgetting this trigger is only valid under COUNTRY scope: If placed in a limit block under STATE scope (for example, within every_owned_state), the script won't error but the judgment target will point to the wrong scope, creating hard-to-detect logic flaws; always evaluate at the national level before entering state loops.