Hands-On Usage
When a mod dynamically modifies a country's technology unlock state through scripting (for example, using set_country_flag + conditional logic to hide or display specific technologies), the game interface does not automatically refresh the layout of hidden technologies. In such cases, this effect must be called to force a refresh. Typical scenarios include custom tech tree mods changing technology visibility after specific events trigger, or unlocking hidden technology branches upon national focus completion.
country_event = {
id = my_mod.1
immediate = {
set_country_flag = unlocked_secret_tech_branch
mark_technology_tree_layout_dirty = yes
}
}
Synergy
[has_country_flag](/wiki/trigger/has_country_flag): Typically use this trigger first to check whether a flag exists, then decide whether a tech tree layout refresh is needed, forming a complete logic chain of "condition → refresh".
[clr_country_flag](/wiki/effect/clr_country_flag): When clearing country flags that control technology visibility, the tech tree layout likewise becomes outdated. Pair with this effect to ensure the interface stays in sync with actual state.
[complete_national_focus](/wiki/effect/complete_national_focus): If national focus completion scripts affect the display conditions of hidden technologies, call the refresh within the same execution block to prevent players from seeing an outdated tech tree state.
[add_ideas](/wiki/effect/add_ideas): Some ideas influence tech tree hiding logic through modifiers. Immediately follow idea addition with this effect to guarantee display updates take effect.
Common Pitfalls
- Forgetting to call causes interface desynchronization: After modifying flags or variables that affect hidden technology visibility, if this effect is not called, players opening the tech interface in the same game session will see the old layout. A save reload is required to refresh, and this is the step new modders most commonly forget.
- Calling under the wrong scope: This effect only works under COUNTRY scope. If misused in STATE or CHARACTER scope (for example, written inside an
every_owned_state block), the script will not execute as intended. Always ensure you are in or have switched to the correct country scope before calling.