命令百科

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 版)写入普通变量。