Building modding

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

A building is a structure built using Civilian factories in states or provinces.

Buildings[edit]

Here is a generic building example:

<building> = {
    base_cost = <int>               # Cost in CIC to build.
    base_cost_conversion = <int>    # Cost in CIC to convert to.
    per_level_extra_cost = <int>    # Added cost per building level.
    
    max_level = <int>               # The maximum level that can be built.
    value = <int>                   # The base health of the building. Is multiplied by the level of the building built.
   
    icon_frame = <int>              # Which icon frame in GFX_buildings_strip to use for the building.
    show_on_map = <int>             # The amount of <building> models to display on the map when one instance is built.
    show_on_map_meshes = <int>      # Number of models to display.
    always_shown = yes              # Whether to always show the <building> model.
    has_destroyed_mesh = yes         # Whether to show destroyed mesh for building.
    
    shares_slots = yes                          # Determines if this building uses building slots.
    infrastructure_construction_effect = yes    # Determines if this building benefits from infrastructure boosting construction speed.
    provincial = yes                            # Determines if this building is a province building.
    damage_factor = <float>                     # Modifies damage taken from bombing.
    
    only_costal = yes               # Limits this building to only coastal provinces/states.
    disabled_in_dmz = yes           # Limits this building, disabling in a DMZ state.
    
    infrastructure = yes            # Determines if this building is considered infrastructure.
    air_base = yes                  # Determines if this building is considered an air base.
    is_port = yes                   # Determines if this building is considered a port.
    anti_air = yes                  # Determines if this building is considered an anti-air installation.
    refinery = yes                  # Determines if this building is considered a refinery.
    radar = yes                     # Determines if this building is considered a radar station.
    nuclear_reactor = yes           # Determines if this building is considered a nuclear reactor.
    military_production = <float>   # Adds X amount of MIC production.
    general_production = <float>    # Adds X amount of CIC production.
    naval_production = <float>      # Adds X amount of NIC production.
    land_fort = <int>               # Adds X amount of land fort.
    naval_fort = <int>              # Adds X amount of naval fort.
    rocket_production = <int>       # Adds X amount of rocket production.
    rocket_launch_capacity = <int>  # Adds X amount of rocket capacity.
 
    local_resources_<resource> = <int>  # Adds resources to state.
    air_defence = <float>               # Adds air defence to the state.
    nuclear_production_factor = <float> # Adds Nuke production factor to owner of state.
}

See Construction for gameplay details regarding buildings.

Localization[edit]

Buildings have the following localization:

<building>: ""
<building>_desc: ""
<building>_plural: ""
modifier_production_speed_<building>: ""
modifier_production_speed_<building>_desc: ""
modifier_production_speed_<building>_factor: ""
modifier_production_speed_<building>_factor_desc: ""

Interface[edit]

If a new building is added, the building icon strip needs to be updated to include an icon for the building. This file is found at /Hearts of Iron IV/gfx/interface/buildings/building_icon_strip.dds.

The icon itself needs to be 46 pixels wide and high. It should be appended to the building icon strip and the noOfFrames should be changed to match the new number of icons.

Here is the GFX definition for the building icon strip /Hearts of Iron IV/interface/countrystateview.gfx:

spriteType = {
    name = "GFX_buildings_strip"
    textureFile = "gfx/interface/buildings/building_icon_strip.dds"
    noOfFrames = 14 #increse by 1 for every modded building
}

Types[edit]

Here are different types of buildings in the game as of 1.9.0 (Can also be found inside /Hearts of Iron IV/common/buildings/00_buildings.txt):

buildings = {
    # STATE BUILDINGS
    infrastructure     = <int> # 0 to 10 | Sets the Infrastructure level.          (STATE)
    air_base           = <int> # 0 to 10 | Sets the Air Base level.                (STATE)
    anti_air_building  = <int> # 0 to 5  | Sets the Anti-Air level.                (STATE)
    radar_station      = <int> # 0 to 5  | Sets the Radar Station level.           (STATE)

    # SHARED BUILDINGS
    arms_factory       = <int> # 0 to 20 | Sets the Military Factory level.        (STATE)
    industrial_complex = <int> # 0 to 20 | Sets the Civilian Factory level.        (STATE)
    dockyard           = <int> # 0 to 20 | Sets the Naval Dockyard level.          (STATE)
    synthetic_refinery = <int> # 0 to 3  | Sets the Synthetic Refinery level.      (STATE)
    fuel_silo          = <int> # 0 to ∞  | Sets the Fuel Silo level.               (STATE)
    rocket_site        = <int> # 0 to 5  | Sets the Rocket Site level.             (STATE)
    nuclear_reactor    = <int> # 0 to 1  | Sets the Nuclear Reactor level.         (STATE)    

    # PROVINCE BUILDINGS
    <province id> = {
        naval_base     = <int> # 0 to 10 | Sets the Naval Base level.              (PROVINCE)
        bunker         = <int> # 0 to 10 | Sets the Land Fort level.               (PROVINCE)
        coastal_bunker = <int> # 0 to 10 | Sets the Coastal Fort level.            (PROVINCE)
    }
}

Note that currently, factories seem to now have a capacity of 20, versus the previous unlimited capacity (as long as it was an integer).