Hands-On Usage
all_purchase_contracts is commonly used to check whether every arms purchase contract belonging to a country meets specific conditions — for example, verifying the buyer/seller identity or the equipment types included in the contracts when evaluating diplomatic or event decisions, in order to determine whether a subsequent effect should fire. Typical use cases include: restricting a special bonus to countries whose every active contract comes from the same supplier, or auditing contract states within AI behavior logic.
# Check whether all of GER's purchase contracts have USA as the seller
GER = {
all_purchase_contracts = {
tooltip = ger_all_contracts_from_usa_tt
seller = {
tag = USA
}
}
}
Synergy
- any_of_scopes: Use this when you only need "at least one contract satisfies the condition." Pair it with
all_purchase_contracts to create complementary "all must match" vs. "any must match" logic.
- buyer: Used inside a contract scope to check the purchasing country; it is one of the most common sub-conditions written inside
all_purchase_contracts.
- contract_contains_equipment: Checks the equipment type covered by a contract from within the contract scope. Combining it with
all_purchase_contracts lets you precisely filter contracts for a specific piece of equipment.
- every_purchase_contract: The effect-side iteration command. It is frequently paired with
all_purchase_contracts — first use the trigger to evaluate conditions, then use the effect to perform bulk operations on the matching contracts (e.g., cancelling them).
Common Pitfalls
- Wrong scope level:
all_purchase_contracts must be called from within a COUNTRY scope; only then do inner triggers such as seller/buyer correctly resolve as Purchase Contract scope triggers. Beginners often place it inside a STATE scope or at the root level, causing script errors or conditions that never evaluate correctly.
- Confusing "all satisfy" with "at least one satisfies": When the country has no purchase contracts at all,
all_purchase_contracts returns true immediately (a universal quantifier over an empty set is vacuously true). If your logic requires "at least one contract exists and satisfies the condition," you must separately confirm that a contract exists first — using any_purchase_contract, count_triggers, or a similar approach — otherwise a country with zero contracts will be incorrectly treated as meeting the condition.