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 
}

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.