Hands-On Usage
Commonly used to detect whether a specific country is conducting an amphibious invasion against a particular state—for example, in defensive events or decisions to detect enemy landing threats and trigger emergency reinforcements or special bonuses. Can also be used in the available block of AI strategy decisions to confirm that your own naval invasion plan has reached a certain preparation level before allowing diplomatic or military actions.
# Detect whether an enemy has launched a naval invasion against a state of this country and the invasion is activated
add_ideas = emergency_coastal_defense
trigger = {
any_enemy_country = {
has_naval_invasion_against_state = {
state = 42
preparation > 0.5
activated = yes
}
}
}
Synergy
[any_enemy_country](/wiki/trigger/any_enemy_country): Iterates through all belligerent enemy nations; typically nested at the outer level to check whether any enemy is executing a landing. This is the most common wrapper for this trigger.
[controls_state](/wiki/trigger/controls_state): Used in combination to further confirm current control of the target state, distinguishing between "has an invasion plan but hasn't succeeded yet" and "already lost," preventing logical errors.
[divisions_in_state](/wiki/trigger/divisions_in_state): After detecting a landing threat, jointly determine whether the force in that state is sufficient, providing finer conditional branching for events or decisions.
[has_defensive_war_with](/wiki/trigger/has_defensive_war_with): Pair with this to confirm you are currently in a defensive war, preventing unintended trigger activation due to script bugs in non-war situations.
Common Pitfalls
- Overlooking the semantics of the
activated field: When activated is not specified, it only checks whether an invasion plan exists by default (regardless of activation status). Beginners often assume "has a plan = attack already initiated," causing emergency events to trigger prematurely while the invasion is still in preparation; to distinguish between "in preparation" and "activated," always explicitly write activated = yes or activated = no.
- Confusion about scope direction: The scope of this trigger is the country conducting the invasion, not the country being invaded. Beginners often use it directly under the scope of the attacked party, causing it to always return false; the correct approach is to first switch to the enemy scope (e.g., using
any_enemy_country), then call this trigger within it.