Wiki

trigger · fuel_ratio

Definition

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

Description

Compares the fuel ratio to a variable.
Example: fuel_ratio > 0.5

实战 · 配合 · 坑

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

实战用法

fuel_ratio 常用于战争经济相关 mod 中,根据国家燃油储备比例动态触发决议、国家精神或 AI 策略调整。例如在燃料危机模拟 mod 里,当燃料比例低于某阈值时锁定玩家的特定决策或触发警告事件:

# 在 decision 的 available 块中:检测燃料储备是否充足
available = {
    fuel_ratio > 0.3
}

# 在 trigger 块中:燃料不足时才显示补给警告任务
limit = {
    fuel_ratio < 0.2
}

配合关系

  • [add_fuel](/wiki/effect/add_fuel) — 当 fuel_ratio 低于阈值触发 effect 时,用此命令紧急补充燃料储备,形成"检测→补充"的完整逻辑闭环。
  • [add_ideas](/wiki/effect/add_ideas) — 根据燃料比例高低添加不同的国家精神(如"燃料短缺"惩罚或"能源充裕"加成),实现动态经济压力系统。
  • [has_country_flag](/wiki/trigger/has_country_flag) — 配合国家标记防止重复触发:先检查 flag 是否已设置,再结合 fuel_ratio 决定是否执行后续逻辑,避免事件/决议刷屏。
  • [command_power](/wiki/trigger/command_power) — 在同一 trigger 块中与 fuel_ratio 联合判断,模拟"燃料不足且指挥能力受损"的双重困境才允许某些特殊选项。

常见坑

  1. 比较运算符写法错误:新手容易写成 fuel_ratio = 0.5 想表达"等于",但实际上此 trigger 只支持 > / < / >= / <= 比较运算符,使用 = 不会报错但语义是"大于等于",与预期不符,务必明确写出所需的比较符号。
  2. 忽略 scope 限制fuel_ratio 只能在 COUNTRY scope 下使用,若在 state scope(如 every_owned_state 内部)直接调用会静默失败或报错,需先用 OWNER 等目标跳回国家 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

fuel_ratio is commonly used in war economy-related mods to dynamically trigger decisions, national spirits, or AI strategy adjustments based on a nation's fuel reserve ratio. For example, in a fuel crisis simulation mod, when the fuel ratio drops below a certain threshold, you can lock specific player decisions or trigger warning events:

# In the available block of a decision: check if fuel reserves are sufficient
available = {
    fuel_ratio > 0.3
}

# In a trigger block: show supply warning only when fuel is insufficient
limit = {
    fuel_ratio < 0.2
}

Synergy

  • [add_fuel](/wiki/effect/add_fuel) — When fuel_ratio drops below a threshold and triggers an effect, use this command to emergency-replenish fuel reserves, forming a complete "detect→replenish" logic loop.
  • [add_ideas](/wiki/effect/add_ideas) — Add different national spirits based on fuel ratio levels (such as "Fuel Shortage" penalties or "Energy Abundance" bonuses), implementing a dynamic economic pressure system.
  • [has_country_flag](/wiki/trigger/has_country_flag) — Combined with country flags to prevent duplicate triggers: first check if a flag is already set, then combine with fuel_ratio to decide whether to execute subsequent logic, avoiding event/decision spam.
  • [command_power](/wiki/trigger/command_power) — In the same trigger block, use joint conditions with fuel_ratio to simulate a "dual crisis" scenario where both fuel shortage and reduced command power must occur before allowing certain special options.

Common Pitfalls

  1. Incorrect comparison operator syntax: Beginners often write fuel_ratio = 0.5 intending to mean "equals", but this trigger only supports > / < / >= / <= comparison operators. Using = won't throw an error but semantically means "greater than or equal to", which doesn't match the intended logic. Always explicitly write the required comparison operator.
  2. Ignoring scope restrictions: fuel_ratio can only be used within COUNTRY scope. If called directly in state scope (such as inside every_owned_state), it will silently fail or throw an error. You must first use OWNER or similar target-switching to return to country scope before making the check.