Wiki

effect · mark_focus_tree_layout_dirty

Definition

  • Supported scope:COUNTRY
  • Supported target:any

Description

Forces the refresh of the tree layout for the scoped country
mark_focus_tree_layout_dirty = yes

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 the focus tree layout through scripting (for example, by mass-completing focuses via complete_national_focus or indirectly affecting focus availability through add_ideas), the focus tree positions on the UI may not refresh immediately. Adding this command at the end of the same execution block forces a recalculation of the layout. This is common in "dynamic focus tree" mods to ensure players see the correct tree structure after an event is triggered.

country_event = {
    id = my_mod.1
    title = my_mod.1.t
    desc = my_mod.1.d

    option = {
        name = my_mod.1.a
        complete_national_focus = my_special_focus
        mark_focus_tree_layout_dirty = yes
    }
}

Synergy

  • [complete_national_focus](/wiki/effect/complete_national_focus) — After scripting forcefully completes a focus, the layout may shift. This command must immediately follow to refresh the tree's rendering positions.
  • [activate_shine_on_focus](/wiki/effect/activate_shine_on_focus) / [deactivate_shine_on_focus](/wiki/effect/deactivate_shine_on_focus) — When dynamically highlighting or unhighlighting a focus node, use this alongside to ensure visual state matches logical state.
  • [has_completed_focus](/wiki/trigger/has_completed_focus) — Serves as a conditional check to determine whether a focus has been completed, allowing you to decide whether a layout refresh is needed (call conditionally within if blocks as required).

Common Pitfalls

  1. Missing the call causes focus tree misalignment: Beginners often forget to add this command after bulk focus operations in scripts, causing players to see overlapping or shifted nodes in the UI. Players may mistakenly think the mod save is corrupted, when simply adding mark_focus_tree_layout_dirty = yes resolves the issue.
  2. Calling outside COUNTRY scope: This command only works in country scope. If mistakenly placed inside state scope such as every_owned_state, the game will error or silently skip it. Always ensure execution within country scope (such as ROOT, FROM, or a specific country tag).