Wiki

effect · create_purchase_contract

Definition

  • Supported scope:any
  • Supported target:none

Description

Creates a purchase contract between the countries.
Example:
create_purchase_contract = 
{
	seller = ENG
	buyer = RAJ
	civilian_factories = 2
	equipment = {
		type = infantry_equipment
		amount = 600
	}
	equipment = {
		type = armored_car1
		amount = 100
	}
}

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

create_purchase_contract is commonly used to establish military trade relationships between nations, such as simulating historical arms export agreements in focuses or events (e.g., Britain supplying equipment to colonies, smaller nations purchasing weapons from major powers). It allows simultaneous specification of factory aid and multiple equipment batches, making it ideal for building complex lend-lease or arms sales mod systems.

# British event providing military support to South African Union
country_event = {
    id = arms_trade.1
    immediate = {
        create_purchase_contract = {
            seller = ENG
            buyer = SAF
            civilian_factories = 1
            equipment = {
                type = infantry_equipment
                amount = 500
            }
            equipment = {
                type = support_equipment
                amount = 100
            }
        }
    }
}

Synergy

  • [every_purchase_contract](/wiki/effect/every_purchase_contract): After creating a contract, iterate through existing contracts for bulk modifications or cancellations. Commonly used to clean up old contracts before establishing new ones, preventing contract accumulation.
  • [any_country](/wiki/trigger/any_country): Used in trigger blocks to check whether the target nation meets specific conditions (e.g., faction membership), determining whether to trigger create_purchase_contract.
  • [if](/wiki/effect/if): Wrap contract creation logic in conditional branches to dynamically decide seller/buyer combinations or equipment types based on different game states (e.g., player-selected national focus options).
  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip): Since contract details won't display automatically in the event interface, pairing this command provides clear, readable tooltips for players explaining contract contents.

Common Pitfalls

  1. seller/buyer must be existing country tags: If the specified nation hasn't been activated in the game (e.g., a historically non-independent nation), the contract will silently fail without error. Newcomers often mistake this for a script problem; use [country_exists](/wiki/trigger/country_exists) to check beforehand.
  2. Repeated execution stacks contracts rather than overwriting: Each trigger creates an independent contract. If called in loops or repeatedly-triggered events, it produces massive contract bloat that slows the game. Clean up old contracts with [every_purchase_contract](/wiki/effect/every_purchase_contract) before creation.