effect · set_state_flag
Definition
- Supported scope:
STATE - Supported target:
none
Description
set state flag
set_state_flagSTATEnoneset state flag
Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.
set_state_flag is commonly used in event chains or decisions to mark a specific region as "processed," preventing the same effect from being triggered repeatedly, or to track special narrative states of a province (such as "has been developed" or "uprising has occurred"). A typical scenario is marking that region's initialization process as complete during occupation or liberation events.
# In the complete_effect of a decision, mark the state as having completed industrial development
complete_effect = {
FROM = { # FROM is the target STATE scope
set_state_flag = industrial_developed
add_building_construction = {
type = industrial_complex
level = 1
instant_build = yes
}
}
}
[has_state_flag](/wiki/trigger/has_state_flag): The most direct counterpart, used in trigger blocks to check whether the flag has been set, enabling "execute only once" logic.[clr_state_flag](/wiki/effect/clr_state_flag): Clears a set flag; the two together form a state machine "switch" that dynamically toggles special markings for a region.[modify_state_flag](/wiki/effect/modify_state_flag): When you need to attach numeric values (counters) to a flag, use it alongside set_state_flag—first set to initialize, then modify to accumulate.[state_event](/wiki/effect/state_event): Commonly triggers a region event immediately after a flag is set, linking the marking behavior with the event chain.set_state_flag must be executed under STATE scope; calling it directly in a COUNTRY scope's effect block will cause an error. You need to use capital_scope or explicitly enter a specific state's scope before calling it.set_state_flag = my_Flag and has_state_flag = my_flag will always evaluate as false due to case differences. It is recommended to use a consistent naming convention of lowercase with underscores throughout.