Hands-On Usage
any_purchase_contract is commonly used to check whether a country has at least one purchase contract that meets specific conditions — for example, in mods related to the foreign arms purchasing DLC, determining whether a nation has an ongoing contract for a particular type of equipment in order to fire an event or unlock a decision. Typical use cases include gating a diplomatic option or AI behavior behind the requirement that at least one contract is at a specific delivery stage.
# Check whether Germany has at least one purchase contract containing a specific equipment type
GER = {
any_purchase_contract = {
contract_contains_equipment = {
type = infantry_equipment
}
}
}
Synergy
- buyer — Used inside the child block of
any_purchase_contract to further restrict whether the buyer of the contract is the target country, enabling more precise contract filtering.
- seller — The counterpart to
buyer; used to check the seller's identity on a contract. Frequently used alongside buyer to pinpoint a specific bilateral contract.
- contract_contains_equipment — The most common sub-condition, used to confirm the equipment type included in a contract. This is the most essential companion trigger for
any_purchase_contract.
- every_purchase_contract — The effect-side counterpart that iterates over all contracts to perform operations. The typical pattern is to use
any_purchase_contract first for an existence check, then use every_purchase_contract to process them in bulk.
Common Pitfalls
- Calling it in the wrong scope:
any_purchase_contract can only be used within a COUNTRY scope. Writing it inside a STATE or UNIT LEADER scope will cause it to silently fail or throw an error. Make sure the enclosing scope is a country scope (e.g., GER = { ... } or ROOT = { ... } where ROOT is a country).
- Confusing
any semantics with all semantics: any_purchase_contract returns true as long as at least one contract satisfies the sub-conditions. If you need all contracts to satisfy the conditions, use NOT + any_purchase_contract with inverted logic — do not assume that an all_purchase_contract command exists, as it is not present in the whitelist.