State modding

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

States (and their history) are defined in /Hearts of Iron IV/history/states/*.txt.

Each state is typically stored in it's own file, although you can store multiple state definitions within the same file, as the ID is defined within the state definition, rather than the file title (as in Europa Universalis 4).

Here is a generic example of a state:

state = {
    id = <id>
    name = <localization key>
    manpower = <int>
    state_category = <category>
   
    provinces = {
        <province ids>
    }
    
    resources = {
        <resource> = <int>
    }
    
    history = {
        <effects>
        
        victory_points = {
            <province id> <points>
        }
        
        buildings = {
            <building> = <amount>
            

            <province id> = {
                <building> = <amount>
            }
        }
    }
}
  • id defines the numerical id used by the state. The state IDs must be added sequentially, skipping numbers will cause crashes.
  • name defines the localization key the state uses. You can use a non-localized string (i.e. "Paris"), but it is best practice to use localized strings.
  • manpower defines the manpower provided to the owner of the state. Typically values are as low as 10,000 in wasteland type states, and as high as 2,000,000 in highly populated states.
  • state_category defines the state category used by the state. These categories are found in /Hearts of Iron IV/common/state_category/*.txt.
  • provinces scope defines which provinces belong to the state.
  • resources scope defines the resources found in the state and the amount of said resources. Resources are found in /Hearts of Iron IV/common/resources/*.txt.
  • history scope defines the effects to execute when the state is loaded during history setup. Typically this is used to add ownership with owner = <tag> and add_core_of = <tag>.
  • victory_points scope is nested within the history scope and defines the victory point for a state. Multiple victory points require multiple scopes.
  • buildings scope is nested within the history scope, and defines which state buildings are set in the state during history setup. Buildings are found in /Hearts of Iron IV/common/buildings/*.txt. Provincal buildings are added by adding the specific province you want to add the building in as a scope.