Event trigger.png We are conducting a survey to learn how we can improve the Paradox Wikis experience for our users. Please take the time to fill the Survey Event trigger.png

National Focus modding

From Hearts of Iron 4 Wiki
Jump to navigation Jump to search

The definitions of national focuses are found in /Hearts of Iron IV/common/national_focus/*.txt.

Focus[edit]

Individual national focuses are tied to a focus tree (see below).

Attributes[edit]

id[edit]

(Type: string) A unique identifier for the focus.

text[edit]

(Type: string, default: id) An alternative text identifier. This allows multiple focuses to use the same display name and description.

dynamic[edit]

(Type: boolean, default: no) If true, the localized strings can contain placeholders, for example to change focus names depending on ideology.

cost[edit]

(Type: number (three decimal places precision), default: 0) How much progress the focus needs in multiples of 7 days.

allow_branch[edit]

(Type: AND trigger, default: { }) If this trigger is non-empty it decides exclusively whether a focus is available. If it is false, the focus and all its dependents will be unavailable and invisible. mark_focus_tree_layout_dirty = yes (Note that this is an effect, not an argument for a focus) can be used to force the game to re-evaluate this trigger, in order to dynamically show or hide parts of a focus tree.

prerequisite[edit]

Defines a set of focuses, at least one of which needs to be completed to make this focus available. The IDs of the prerequisite focuses can be provided with focus and OR. Can appear multiple times, in which case each of the prerequisites needs to be fulfilled. Example:

prerequisite = { focus = GER_kdf_wagen OR = GER_synthetic_rubber }
prerequisite = { focus = GER_important_focus }

In this example, the focus fulfills its prerequisites if at least one of GER_kdf_wagen and GER_synthetic_rubber is completed, but GER_important_focus needs to be completed as well. The first line can be equivalently written as prerequisite = { focus = GER_kdf_wagen focus = GER_synthetic_rubber }.

mutually_exclusive[edit]

Defines a set of focuses, each of which is mutually exclusive to this focus. The syntax is the same as for prerequisites. Can be provided multiple times, to make the focus part of multiple sets of mutually exclusive focuses.

available[edit]

(Type: AND trigger, default: { }) In the absence of allow_branch, a focus will not be available if this trigger is false. l

available_if_capitulated[edit]

(Type: boolean, default: no) If false, the focus is unavailable to countries that are capitulated, and if currently active, it will cancel when the country capitulates.

cancelable[edit]

(Type: boolean, default: yes) If set to false, the focus may not be cancelled explicitly.

cancel[edit]

(Type: AND trigger, default: { }) When a focus is in progress and the cancel trigger becomes true, the progress will get canceled. In contrast to normal AND triggers, an empty trigger is treated as false.

cancel_if_invalid[edit]

(Type: boolean, default: yes) If true, the active focus will cancel when available becomes false.

continue_if_invalid[edit]

(Type: boolean, default: no) If true, cancel and cancel_if_invalid get ignored

select_effect[edit]

(Type: effect) When the focus gets selected, this effect will be executed. This will also make the focus impossible to manually cancel once the country starts doing it.

completion_reward[edit]

(Type: effect) When the focus completes, this effect will be executed.

bypass[edit]

(Type: AND trigger, default: { }) Any focus that is currently running or available will bypass if this trigger is true. In contrast to normal AND triggers, an empty trigger is treated as false. Bypassing ignores the available trigger. If a focus has a mutually exclusive choice, the player needs to bypass it explicitly, otherwise the bypass happens automatically as soon as the conditions are fulfilled.

icon[edit]

(Type: string) Graphical icon name, normally defined in /Hearts of Iron IV/interface/goals.gfx.

x[edit]

(Type: integer, default: 0) Horizontal visual position of the focus, in grid columns.

y[edit]

(Type: integer, default: 0) Vertical visual position of the focus, in grid rows.

offset[edit]

An additional shift of the x and y attributes, conditioned on a trigger. The x and y attributes are integers, trigger is an AND trigger. mark_focus_tree_layout_dirty = yes (Note that this is an effect, not an argument for a focus) can be used to force the game to re-evaluate this trigger, in order to dynamically rearrange parts of a focus tree. Multiple offsets can be coded into one focus. Example:

offset = {
	x = -1
	y = 0
	trigger = {
		NOT = { has_dlc = "Man the Guns" }
	}
}

relative_position_id[edit]

(Type: string) The graphical coordinates of this focus will be taken relative to the referenced focus. Usually this is one of the prerequisites, allowing an entire branch to moved around by just moving the root focus.

historical[edit]

(Type: boolean, default: no) unused

historical_ai[edit]

(Type: AND trigger, default: { }) If historical AI focus is enabled, the AI will only pick the focus if this trigger is true.

ai_will_do[edit]

(Type: MTTH, default: { base = 1 }) Defines the probability of the AI picking this focus. The value is further modified by +50% if the focus is not at the root of a branch, proportionately reduced if a mutually exclusive choice, as well as multiplied by any focus_factors in AI strategy plans. For each available focus, the AI generates a random number between 0 and the calculated value. It chooses the focus with the highest resulting number.

For example, if two focuses are available with calculated values of 1.5 and 3 respectively, the former has a chance of 1-in-6 to be picked and the latter 5-in-6.

will_lead_to_war_with[edit]

(Type: country tag) The specified country will receive a warning that war goals are being justified against it while the focus is running. Can appear multiple times.

Localization[edit]

The localization keys of focuses are prefixed with its id (or text). Given a focus with id = XYZ, the localization keys are

  • XYZ: name
  • XYZ_desc: description

National focus tree[edit]

Each country is assigned a focus tree, which is a collection of national focuses. It can get amended by continuous focuses and shared focuses.

Attributes[edit]

id[edit]

(Type: string) A unique identifier for the focus tree.

country[edit]

(Type: MTTH, default: { base = 1 }) A score for the fit of this tree for the given tag. A country uses the national focus tree with the highest score. To assign a tree to a particular country, the score should be zero by default and modified to a high value for just that country.

default[edit]

(Type: boolean, default no) If set to yes, this focus tree will be used for all countries that did not get a score greater than 0 on any focus tree. Only one focus tree should be set to be the default, generic_focus in the base game.

reset_on_civil_war[edit]

(Type: boolean, default: yes) If set to no, if the newly spawned tag in a civil war gets the same focus tree, it will copy the progress unlocked by the original country. Otherwise it starts the focus tree from the beginning.

continuous_focus_position[edit]

(Type: point, default: { x = 0, y = 0 }) The visual location of the continuous focus palette.

focus[edit]

(Type: national focus) Defines a national focus as described above that is added to this tree. Can appear multiple times.

shared_focus[edit]

(Type: string) Causes the referenced shared focus and its dependants to be inserted in this tree. Can appear multiple times. A shared focus is declared outside of any focus tree using shared_focus. It otherwise has the same semantics as a normal national focus.

Example[edit]

shared_focus = {
    id = shared_1
    x = 10
    offset = {
        x = 10
        trigger = {
            tag = LIT
        }
    }
    select_effect = {
        add_political_power = 10
    }
    completion_reward = {
        army_experience = 10
    }
}
focus_tree = {
    id = lithuania_focus
    country = {
        base = 0
        modifier = {
            add = 10
            tag = LIT
        }
    }
    shared_focus = shared_1

    focus = {
        id = LIT_focus_1
        x = 10
        completion_reward = {
            navy_experience = 10
        }
    }
    focus = {
        id = LIT_focus_2
        prerequisite = { focus = LIT_focus_1 }
        relative_position_id = LIT_focus_1
        y = 10
        completion_reward = {
            navy_experience = 10
        }
    }
}
focus_tree = {
    id = basic_focus
    country = {
        base = 1
    }
    shared_focus = shared_1
}