Wiki

effect · get_supply_vehicles_temp

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

sets a temp variable to the number of supply vehicles in stockpile or that are needed. example 
get_supply_vehicles_temp = { 
	var = num_vehicles #variable to set 
	type = truck #can be truck or train 
	need = yes #default no. If yes, gets the number of needed vehicles 
}

实战 · 配合 · 坑

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

实战用法

get_supply_vehicles_temp 常用于后勤系统相关的 mod 场景,例如根据当前库存或缺口数量动态触发事件、调整资源补给,或在决策中判断玩家是否拥有足够的运输载具。典型场景是在一个后勤决策中先读取当前卡车缺口数量,再根据结果决定是否自动补充或给出警告提示。

# 在一个 hidden_effect 或 immediate 块中读取卡车缺口,并据此给出政治代价
hidden_effect = {
    get_supply_vehicles_temp = {
        var = my_truck_need
        type = truck
        need = yes
    }
    if = {
        limit = {
            check_variable = { my_truck_need > 500 }
        }
        add_political_power = -20
        country_event = { id = logistics.001 }
    }
}

配合关系

  • [get_supply_vehicles_temp](/wiki/trigger/get_supply_vehicles_temp):同名触发器版本,可在 limit 或条件块中直接比较库存/缺口数量,与 effect 版本形成"读值→判断→执行"的完整流程。
  • [get_supply_vehicles](/wiki/effect/get_supply_vehicles):非临时变量版本,将数值写入持久变量,适合需要跨事件链保存该数据时与本 effect 搭配对比使用。
  • [add_equipment_to_stockpile](/wiki/effect/add_equipment_to_stockpile):读取到缺口数量后,可直接用此命令向库存补充对应载具装备,是最直接的后续补救动作。
  • [country_event](/wiki/effect/country_event):根据临时变量的判断结果触发不同的后勤事件,实现动态的补给链反馈叙事。

常见坑

  1. 忘记 need 字段含义反转:不写 need 时默认为 no,获取的是库存中现有载具数量;写 need = yes 才是获取缺口(需要但没有)的数量。两者语义完全相反,混淆后逻辑判断会得出完全错误的结论。
  2. 临时变量作用域消失get_supply_vehicles_temp 写入的是 temp 变量,仅在当前 effect 执行块内有效,不会跨事件或跨 effect 块保留。若后续需要在另一个事件 option 中引用该数值,必须改用 get_supply_vehicles(非 temp 版)写入普通变量。

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

get_supply_vehicles_temp is commonly used in mod scenarios involving logistics systems, such as dynamically triggering events based on current inventory or shortage quantities, adjusting resource supplies, or determining in decisions whether the player possesses sufficient transport vehicles. A typical scenario involves reading the current truck shortage in a logistics decision block first, then deciding whether to automatically replenish or issue a warning based on the result.

# Read truck shortage in a hidden_effect or immediate block, then apply political penalties accordingly
hidden_effect = {
    get_supply_vehicles_temp = {
        var = my_truck_need
        type = truck
        need = yes
    }
    if = {
        limit = {
            check_variable = { my_truck_need > 500 }
        }
        add_political_power = -20
        country_event = { id = logistics.001 }
    }
}

Synergy

  • [get_supply_vehicles_temp](/wiki/trigger/get_supply_vehicles_temp): The trigger version with the same name, usable directly in limit or conditional blocks to compare inventory/shortage quantities, forming a complete "read → evaluate → execute" workflow with the effect version.
  • [get_supply_vehicles](/wiki/effect/get_supply_vehicles): Non-temporary variable version that writes values to persistent variables, suitable for scenarios where the data needs to be retained across event chains and compared with this effect.
  • [add_equipment_to_stockpile](/wiki/effect/add_equipment_to_stockpile): After reading shortage quantities, use this command directly to replenish corresponding transport vehicle equipment to inventory—the most straightforward follow-up remedial action.
  • [country_event](/wiki/effect/country_event): Trigger different logistics events based on the evaluation results of temporary variables, implementing dynamic supply chain feedback narratives.

Common Pitfalls

  1. Forgetting the semantic inversion of the need field: Without specifying need, it defaults to no, retrieving the existing vehicle quantity currently in inventory; writing need = yes retrieves the shortage (needed but unavailable) quantity instead. The semantics are completely opposite—confusing them will lead to entirely incorrect logical conclusions.
  2. Temporary variable scope disappears: get_supply_vehicles_temp writes to temp variables, valid only within the current effect execution block and not retained across events or effect blocks. If subsequent reference to this value is needed in another event option, you must use get_supply_vehicles (non-temp version) instead to write to regular variables.