Wiki

trigger · 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 scenarios where you need to dynamically detect a country's supply vehicle inventory or shortfall, such as checking truck reserves in a decision's available block or evaluating supply gaps in event triggers to present relevant options. Combined with variable comparisons, you can implement logic like "unlock emergency procurement decisions only when inventory is insufficient."

# In a decision's available block: open emergency supply decision only when truck inventory falls below required amount
available = {
    get_supply_vehicles_temp = {
        var = needed_trucks
        type = truck
        need = yes
    }
    get_supply_vehicles_temp = {
        var = owned_trucks
        type = truck
        need = no
    }
    check_variable = { owned_trucks < needed_trucks }
}

Synergy

  • [get_supply_vehicles](/wiki/effect/get_supply_vehicles): Non-temporary variable version that directly writes vehicle counts to persistent variables; use this when you need to retain data across events, whereas get_supply_vehicles_temp only works within the current scope—they complement each other.
  • [get_supply_vehicles_temp](/wiki/effect/get_supply_vehicles_temp) (when used in effect blocks): This command functions as both trigger and effect, allowing you to assign values in an effect block and immediately use check_variable for subsequent logic judgments, creating an "assign → check → execute" pipeline.
  • [add_equipment_to_stockpile](/wiki/effect/add_equipment_to_stockpile): After obtaining shortage quantities, this effect is commonly paired to directly replenish the difference in truck inventory, achieving precise numerical restocking.
  • [has_country_flag](/wiki/trigger/has_country_flag): In judgment chains, typically use country flags first for coarse filtering, then invoke get_supply_vehicles_temp for precise numerical judgment, avoiding expensive variable calculations repeated every frame.

Common Pitfalls

  1. Forgetting to distinguish temporary variable lifespans: Values written by get_supply_vehicles_temp are temp variables, valid only within the current script execution frame and cannot be read across event options or different on_action calls. Beginners often set it in one event option then reference it in another option or subsequent effect block, only to find the variable has been cleared and reads 0.
  2. Confusing the semantics of need = yes and need = no: need = yes retrieves "how many are currently lacking," while need = no (default) retrieves "how many are currently in stock." Beginners often assume the default means "required amount," using the two meanings backwards and resulting in completely inverted judgment logic.