Hands-On Usage
all_enemy_country is commonly used to check whether all countries currently at war with the scope nation simultaneously meet a given condition — for example, determining whether every enemy is on the verge of collapse, already has a valid war goal against them, or all belong to a specific political ideology. This allows modders to fire special events or unlock exclusive decisions. Typical use cases include automatically triggering a victory event when all enemy nations have surrendered or been occupied, or checking whether every member of the opposing faction is a fascist regime in order to unlock special diplomatic options.
# Example: only allow the peace resolution event to fire when all enemy countries have capitulated
available = {
has_war = yes
all_enemy_country = {
has_capitulated = yes
}
}
Synergy
- any_enemy_country: The counterpart to
all_enemy_country — one requires "all must match," the other requires "at least one must match." They are frequently used together to distinguish between a "total victory" branch and a "partial advantage" branch.
- has_war: You should almost always confirm the country is at war before calling
all_enemy_country. Without an active war there are no enemies to iterate over, and the trigger's return value in that state can be unpredictable.
- has_war_with: Used to narrow the war relationship down to a specific nation. Combined with the iteration of
all_enemy_country, this lets you build composite conditions such as "are we at war with every member of a particular enemy faction?"
- controls_state: Used inside the
all_enemy_country block to check whether each enemy has lost control of key provinces or states, enabling a "complete territorial conquest" victory condition check.
Common Pitfalls
- Misreading the return value when there are no enemies: When the scoped country has no active enemies, the iteration set of
all_enemy_country is empty. In HOI4, all_ series triggers evaluated against an empty set return true (vacuous truth — "the proposition holds for all elements of an empty set"). Beginners often assume the result would be false, which can cause content intended only for post-war victory to fire unexpectedly during peacetime. Always guard against this with has_war = yes in the outer scope.
- Logic inversion when mixing
all_enemy_country with any_enemy_country: It is easy to confuse the semantics of the two. Using all_enemy_country in a situation that only requires "at least one enemy satisfies the condition" makes the check far too strict and it will likely never trigger. When reviewing your logic, be explicit about whether you need a universal quantifier (all) or an existential quantifier (any).