Wiki

effect · mark_technology_tree_layout_dirty

Definition

  • Supported scope:COUNTRY
  • Supported target:any

Description

Forces the refresh of the hidden technologies for the scoped country
mark_technology_tree_layout_dirty = yes

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

当 mod 通过脚本动态修改某国的科技解锁状态(例如用 set_country_flag + 条件判断来隐藏或显示特定科技)后,游戏界面不会自动刷新隐藏科技的布局,此时需要调用此 effect 强制刷新。典型场景包括:自定义科技树 mod 在特定事件触发后改变科技可见性,或在国策完成时解锁隐藏科技分支。

country_event = {
    id = my_mod.1
    immediate = {
        set_country_flag = unlocked_secret_tech_branch
        mark_technology_tree_layout_dirty = yes
    }
}

配合关系

  • [has_country_flag](/wiki/trigger/has_country_flag):通常先用此触发器检查某个标记是否存在,再决定是否需要刷新科技树布局,形成"条件 → 刷新"的完整逻辑链。
  • [clr_country_flag](/wiki/effect/clr_country_flag):清除控制科技可见性的国家标记时,科技树布局同样会过时,配合此 effect 确保界面与实际状态同步。
  • [complete_national_focus](/wiki/effect/complete_national_focus):国策完成脚本中若会影响隐藏科技的显示条件,应在同一执行块内调用刷新,避免玩家看到旧的科技树状态。
  • [add_ideas](/wiki/effect/add_ideas):某些 idea 会通过 modifier 影响科技树的隐藏逻辑,添加 idea 后紧跟此 effect 可保证显示即时更新。

常见坑

  1. 忘记调用导致界面不同步:修改了影响隐藏科技可见性的标记或变量后,若不调用此 effect,玩家在同一游戏会话中打开科技界面时看到的布局仍是旧状态,需要重新载入存档才能刷新,这是新手最常漏掉的一步。
  2. 在错误的 scope 下调用:此 effect 只能在 COUNTRY scope 下生效,若在 STATE 或 CHARACTER scope 中误用(例如写在 every_owned_state 的块内),脚本不会按预期执行,需确保调用前已切换或处于正确的国家 scope。

Hands-On Notes

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.

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

  1. 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.
  2. 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.