Wiki

effect · add_resource

Definition

  • Supported scope:STATE, COUNTRY
  • Supported target:none

Description

Adds/removes resource production to state

Example:
add_resource = {
  type = steel #resource type to add/destroy  amount = 5 #amount to add
  state = 42 #can be also read from scope
  days = 60 #a resource can be added/removed temporarily
  show_state_in_tooltip = no #Should we show in which state we add the resource(default = yes)?
}

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

add_resource is commonly used in events or decisions to dynamically adjust resource production in a state, such as increasing steel/aluminum output after unlocking a technology, or simulating temporary resource extraction agreements through limited-duration modifiers. Note that when used in COUNTRY scope, you must explicitly specify the target state ID via the state field, whereas in STATE scope this field can be omitted and the current scope is used directly.

# In a decision's complete_effect, temporarily add oil production to a state (automatically removed after 60 days)
complete_effect = {
    add_resource = {
        type = oil
        amount = 8
        state = 123
        days = 60
        show_state_in_tooltip = yes
    }
}

Synergy

  • [resource_count_trigger](/wiki/trigger/resource_count_trigger): Use before executing add_resource to check the current resource count in the target state, preventing resource stacking beyond reasonable limits or to satisfy "trigger only if threshold is met" conditional logic.
  • [add_state_modifier](/wiki/effect/add_state_modifier): Often paired with add_resource in the same event option to both directly increase resource production and apply modifiers (such as production bonuses), achieving a more complete "resource development" effect.
  • [add_building_construction](/wiki/effect/add_building_construction): Typically used together in the same logic block—build infrastructure first, then increase resources—to reflect the complete workflow of resource development.
  • [free_building_slots](/wiki/trigger/free_building_slots): Check in decision availability conditions whether the state has sufficient building slots, forming a logical prerequisite constraint with resource increase/decrease decisions.

Common Pitfalls

  1. Forgetting the state field in COUNTRY scope: When add_resource executes in country scope without specifying state, the script will error or silently fail, since a country itself has no resource concept and must explicitly target a specific state ID.
  2. Confusing "production" with "stockpile": add_resource modifies a state's resource production rate (weekly output), not the current strategic resource inventory quantity. Newcomers often mistakenly believe it directly adds resources to storage; in reality, it permanently (or temporarily) changes that state's weekly output value.