Hands-On Usage
state_event is commonly used in scenarios where event logic needs to be bound to a specific state rather than a country, such as occupation events, resource conflicts, and regional uprisings. When triggered within a STATE scope, it allows precise control over event ownership. The trigger_for field enables the event to be delivered to the correct party even when multiple countries share the same state (such as when an occupying force differs from the owner), making it especially suitable for mods related to occupation and resistance systems.
# Send a warning event to the country controlling a state when resistance exceeds threshold
every_controlled_state = {
limit = {
has_active_resistance = yes
resistance_count_trigger > 50
}
state_event = {
id = resistance.10
days = 3
trigger_for = controller
}
}
Synergy
[has_active_resistance](/wiki/trigger/has_active_resistance): Commonly serves as a precondition for triggering state_event, checking whether active resistance exists in a state to avoid meaningless event triggers.
[compliance](/wiki/trigger/compliance): Checks compliance thresholds in event trigger conditions, working with state_event to implement narrative event chains with phased compliance changes.
[add_resistance](/wiki/effect/add_resistance): Frequently used in the option outcomes of state_event, adjusting state resistance values based on player choices to form a closed loop of "event → choice → state change."
[every_controlled_state](/wiki/effect/every_controlled_state): Serves as an outer loop to iterate through states, paired with state_event to batch-trigger events on all qualifying states one by one.
Common Pitfalls
- Overlooking scope causes event failure to trigger: When using
state_event in a COUNTRY scope without specifying trigger_for, the event's actual ownership becomes unclear; conversely, within a STATE scope you must ensure the current scope is indeed a state and not a country. Confusing the two will result in silent event failure with no error message.
- Mixing
random as both delay and conditional effect block: random = 6 denotes a random hour delay, whereas random = { chance = 50 ... } is a probability-based conditional effect block. These two syntaxes have completely different semantics, and mixing them indiscriminately in the same event will cause difficult-to-debug logic errors.