Wiki

trigger · has_focus_tree

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Does current country have the specified focus tree.

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

has_focus_tree is commonly used in mods where multiple nations share the same set of events or decisions. It restricts logic to only trigger for countries that possess a specific focus tree, preventing effects from being incorrectly applied to nations using the default tree. For example, if you've created a custom focus tree for a specific faction and need to verify whether the player has switched to it:

# In the available block of a decision:
available = {
    has_focus_tree = my_custom_focus_tree
    has_completed_focus = my_custom_first_focus
}

Synergy

  • [complete_national_focus](/wiki/effect/complete_national_focus): After switching focus trees, you often need to immediately complete a starting node. Pairing this with has_focus_tree allows you to verify that the tree has taken effect before executing further actions.
  • [has_completed_focus](/wiki/trigger/has_completed_focus): These two triggers frequently appear together. First confirm the country is using the target tree, then further check whether a specific node within that tree has been completed, preventing misidentification due to cross-tree node name conflicts.
  • [has_country_flag](/wiki/trigger/has_country_flag): When the same focus tree is shared by multiple tags, use country flags in conjunction with this trigger for more granular branching logic, distinguishing between countries following different paths within the same tree.
  • [exists](/wiki/trigger/exists): In any_country / all_country loops, first use exists to confirm the country exists, then use has_focus_tree to filter targets, preventing errors from attempting to evaluate conditions on deceased nations.

Common Pitfalls

  1. Using the focus tree filename instead of the id field: has_focus_tree accepts the id value defined by focus_tree = { id = ... } within the focus tree file, not the filename itself. If these differ, the condition will silently return false without any error message, making it extremely difficult to debug.
  2. Forgetting to synchronize set_politics / load_focus_tree: Beginners often assume that once an initial focus tree script is assigned to a country, all nations automatically possess it. However, if the tree is not explicitly loaded in the history file or through on_action, has_focus_tree will fail at game start, causing all logic depending on it to be skipped entirely.