小 (文本替换 - 替换“[[Category:”为“[[分类:”) |
无编辑摘要 |
||
(未显示2个用户的2个中间版本) | |||
第1行: | 第1行: | ||
{{Version|1. | {{Version|1.11}} | ||
{{需要翻译|译者=霜泽图书馆}} | |||
A building is a structure built using Civilian factories in states or provinces. | A building is a structure built using Civilian factories in states or provinces. | ||
== Buildings == | == Buildings == | ||
{{ | Buildings are defined within {{path|common/buildings/*.txt}}. Each building entry lies within the <code>buildings = { ... }</code> block, serving as its own block with arguments within defining the building, as this: | ||
<pre>buildings = { | |||
my_building = { | |||
<...> | |||
} | |||
}</pre> | |||
=== Cost === | |||
Each building has a set price in industrial capacity required. This cost is defined with the lines of <code>base_cost = 1000</code> and <code>per_level_extra_cost = 100</code>. | |||
base_cost is the primary cost to build the building, added to each building level, while per_level_extra_cost gets added for each building level in an arithmetic progression. With the example of 1000 base_cost and 100 per_level_extra_cost, the first level will cost 1000 IC to build, while the 5th level will cost 1400 IC, as 4 levels have been built before that. | |||
< | By default, each civilian factory provides 5 IC per day<ref>BASE_FACTORY_SPEED = 5 in common/defines/00_defines.lua</ref>, which can be taken into account when calculating the cost. For comparison, by default a civilian factory costs 10800 IC, while infrastructure costs 6000 IC. | ||
Additionally, <code>infrastructure_construction_effect = yes</code>, if included, will make the building get the building speed boost from any infrastructure built in the state, with a +20% boost per infastructure level<ref>INFRA_MAX_CONSTRUCTION_COST_EFFECT = 1 in common/defines/00_defines.lua means a +100% speed bonus for max infrastructure. By default, infrastructure has 5 max levels, making the boost be divided into 5 portions of 20%, depending on the building level.</ref>. | |||
=== Used slots === | |||
In general, buildings fall into 3 categories by used building slots: | |||
* Shared, which use the same, by default, 25 shared slots<ref>MAX_SHARED_SLOTS = 25 in common/defines/00_defines.lua</ref> for each state, such as civilian and military factories. | |||
* Non-shared, defined for states, but using slots that are unique for this building in particular, such as infrastructure or air bases. | |||
* Provincial, which get built for each province, using slots that are unique for this building in particular, such as forts or naval bases. | |||
If not specified otherwise, a building is assumed to be non-shared. The 3 categories have separate zones in the country construction view where they are located.<br/> | |||
<code>provincial = yes</code>, if added, will make the building be considered provincial, while <code>shares_slots = yes</code> will make it be considered shared if added. These cannot be combined. | |||
Adding <code>max_level = 10</code> can set a max level to which this building can be built. If it is unspecified, it gets assumed to be 15<ref>MAX_BUILDING_LEVELS = 15 in common/defines/00_defines.lua</ref> by default. | |||
By default, all levels of the building are unlocked by default. However, if there are [[Technology modding|technologies]] that enable construction of this building to a specified level, it becomes impossible to build without obtaining at least one of these technologies. It is to be noted that the [[effect|add_building_construction effect]] or the [[state modding|starting state buildings]] can still be used to bypass the technological limit, while still not being possible to bypass the max level total. | |||
=== Additional arguments === | |||
<code>value = 3</code> decides the base health of a building for air bombing campaigns, which gets multiplied for each level of the building. Additionally, this also determines the price of the state to get during peace conferences or the cost in {{icon|political power|1}} to occupy. | |||
= | <code>damage_factor = 0.3</code> modifies the damage that this building gets from air bombing or land combat. Positive values increase it, while negatives decrease it. | ||
< | <code>allied_build = yes</code>, if specified, makes the building count as an allied building, making its modifiers apply not just on the country that built it, but also its allies (i.e. subjects, overlord, and/or faction members). | ||
< | |||
= | <code>only_costal = yes</code> {{hover|Quoted exactly as written|(sic)}}, if specified, will make the building only be possible to build in either provinces that are [[Map modding#Province map|defined as coastal]] or states that contain any such provinces, depending on the type of the building. | ||
{{ | |||
<code>disabled_in_dmz = yes</code>, if added, will make the building impossible to build or use in states that are demilitarised zones. | |||
=== Icon === | |||
{{SVersion|1.11}} | |||
The building icon is defined as <code>icon_frame = 10</code>. The integer shows which frame within the GFX_buildings_strip sprite gets used for this building. | |||
By default, GFX_buildings_strip is defined within {{path|interface/countrystateview.gfx}}, however, it can be overwritten in any {{path|interface/*.gfx}} which is positioned later by filename order: | |||
<pre> | <pre> | ||
spriteType = { | spriteType = { | ||
name = "GFX_buildings_strip" | name = "GFX_buildings_strip" | ||
textureFile = "gfx/interface/buildings/building_icon_strip.dds" | textureFile = "gfx/interface/buildings/building_icon_strip.dds" | ||
noOfFrames = | noOfFrames = 16 # As of 1.11 | ||
} | } | ||
</pre> | </pre> | ||
The noOfFrames decides in how many frames the specified sprite is divided into, dividing the image horizontally into chunks of approximately equal width. If planning to add a new building icon rather than using a base game one, the building icon strip will need to be updated both in the noOfFrames and in the .dds file. By default, each building has a 46x46 resolution in pixels. | |||
== | Within the building construction menu, buildings are divided into 3 zones depending on their used building slots category. In order to change where they are to adjust for new or missing buildings, the elements within the possible_constructions container in {{path|interface/countryconstructionsview.gui}} can have their positions changed. | ||
{{ | |||
=== Models === | |||
<pre> | {{Main|Entity modding}} | ||
buildings | There are several arguments related to models within buildings.<br/> | ||
<code>show_on_map = 3</code> decides how many building models should there be per state or per province (depending on the building type) defined for the building. Each building construction will add one more model. If unspecified, will have no map models.<br/> | |||
<code>show_on_map_meshes = 2</code> decides how many entities are used for each building model. By default assumed to be 1.<br/> | |||
<code>always_shown = yes</code>, if specified, will make the building model appear regardless whether it's covered by the fog of war or not.<br/> | |||
<code>has_destroyed_mesh = yes</code>, if specified, will make the game use a separate model if the building has been destroyed by air bombing or occupation.<br/> | |||
<code>centered = yes</code>, if specified, will mak | |||
In order to assign an entity to a building, it must have a name of <code>building_<building name></code>, like <code>building_my_building</code>, within the {{path|gfx/entities/*.asset}} file. If a building is set to use several entities, then the number will get appended in the end like <code>building_my_building_1</code>, starting with 1. If there's a destroyed mesh, then it'll append _destroyed in the end as <code>building_my_building_destroyed</code> | |||
The locations of building models for each state are defined in {{path|map/buildings.txt}}. An entry in that file is defined as such (If unspecified, assume a number with up to 2 decimal digits): | |||
<pre>State ID (integer); building ID (string); X position; Y position; Z position; Rotation; Adjacent sea province (integer)</pre> | |||
*State ID defines which state the building is located in. Even for provincial buildings, this is the ID of the state, not the province. Instead, provincial buildings have several entries per state, with the XYZ position being used by the game to know which province it's for. | |||
*Building ID is defines which model is being located. While this includes each building, this also includes floating harbours as floating_harbor. | |||
*X, Y, and Z position represent the position on the map of the building model using the 3-dimensional Cartesian coordinate system. The X and Z positions are equivalent to the X and Y axes on the {{hover|map/provinces.bmp|province bitmap}} with 1 pixel equalling 1 unit, left-to-right and down-to-up respectively. This is also what the game uses to know which province it's for for provincial buildings. The Y position, on the scale of 0 to 25.5, can be calculated with the {{hover|map/heightmap.bmp|heightmap}} by taking the [[wp:Lightness|colour value]] of the pixel at that position and making it fit on the scale of 0 to 25.5 (Such as by dividing it by 10 if it's on the scale of 0 to 255). | |||
*Rotation is measured in radians. A rotation of 0 will result in the building model pointing in the same direction as the model is set, while positives will rotate it counter-clockwise and negatives will rotate it clockwise. A full rotation resulting in the same position as 0 is equal to the number π multiplied by 2, roughly 6.28. | |||
*Adjacent sea province is only necessary to define for naval bases and floating harbours, in order to let the game know from which sea province ships or convoys can access the land province where it is located. If the building type is not a naval base, it should be left at 0. | |||
It is preferable to generate the building models in the building section in the nudger, rather than filling it out manually. However, note that the game will crash if the currently-existing {{path|map/buildings.txt}} file is entirely empty, so there should be at least one definition, even if incorrect. | |||
=== Effects === | |||
{{SVersion|1.11}} | |||
Each building can accept any [[Modifiers#State_scope|state-scoped modifier]] within itself, applying that to the state when built. Some used in base game include <code>local_resources_<resource></code>, <code>air_defence</code> (for anti-air), and <code>nuclear_production_factor</code> (for nuclear reactors). In case of provincial buildings, province-level modifiers are accepted instead. This can also be used with [[Modifiers#Modifier tokens|modifier tokens]] to create a custom effect as a variable system. Adding <code>show_modifier = yes</code> will make the modifiers show up in the tooltip of the building. | |||
Aside from state-scoped modifiers, there are several other arguments to make the building have the same effect as a base game building or be considered one for the AI: | |||
{| class="wikitable sortable" width="100%" | |||
! width="10%" | Name | |||
! width="25%" | Effects | |||
! width="25%" | Examples | |||
! width="20%" | Type | |||
! width="20%" | Notes | |||
|- | |||
|military_production | |||
|Adds the specified amount of military factories to the controller. | |||
|<pre>military_production = 0.5</pre> | |||
|Flat. | |||
|A value that's larger than 1 will be the same as 1 factory, but it can fall between 0 and 1. | |||
|- | |||
|general_production | |||
|Adds the specified amount of civilian factories to the controller. | |||
|<pre>general_production = 0.5</pre> | |||
|Flat. | |||
|A value that's larger than 1 will be the same as 1 factory, but it can fall between 0 and 1. | |||
|- | |||
|naval_production | |||
|Adds the specified amount of dockyards to the controller. | |||
|<pre>naval_production = 0.5</pre> | |||
|Flat. | |||
|A value that's larger than 1 will be the same as 1 factory, but it can fall between 0 and 1. | |||
|- | |||
|infrastructure | |||
|Makes the building be marked as infrastructure. | |||
|<pre>infrastructure = yes</pre> | |||
|Boolean. | |||
|Includes the construction speed bonus and extra resources. | |||
|- | |||
|air_base | |||
|Makes the building be marked as an air base. | |||
|<pre>air_base = yes</pre> | |||
|Boolean. | |||
| | |||
|- | |||
|supply_node | |||
|Makes the building be marked as a supply node. | |||
|<pre>supply_node = yes</pre> | |||
|Boolean. | |||
| | |||
|- | |||
|is_port | |||
|Makes the building be marked as a naval port. | |||
|<pre>is_port = yes</pre> | |||
|Boolean. | |||
| | |||
|- | |||
|land_fort | |||
|Adds that many land forts to the province. | |||
|<pre>land_fort = 1</pre> | |||
|Flat. | |||
| | |||
|- | |||
|naval_fort | |||
|Adds that many coastal forts to the province. | |||
|<pre>naval_fort = 1</pre> | |||
|Flat. | |||
| | |||
|- | |||
|refinery | |||
|Makes the building be marked as a synthetic refinery. | |||
|<pre>refinery = yes</pre> | |||
|Boolean. | |||
| | |||
|- | |||
|fuel_silo | |||
|Makes the building be marked as a fuel silo. | |||
|<pre>fuel_silo = yes</pre> | |||
|Boolean. | |||
| | |||
|- | |||
|radar | |||
|Makes the building be marked as a radar station. | |||
|<pre>radar = yes</pre> | |||
|Boolean. | |||
| | |||
|- | |||
|rocket_production | |||
|Defines how much progress on rocket production is done daily. | |||
|<pre>rocket_production = 5</pre> | |||
|Flat. | |||
| | |||
|- | |||
|rocket_launch_capacity | |||
|Defines how many rockets the build can launch daily. | |||
|<pre>rocket_launch_capacity = 5</pre> | |||
|Flat. | |||
| | |||
|- | |||
|nuclear_reactor | |||
|Makes the building be marked as a nuclear reactor. | |||
|<pre>nuclear_reactor = yes</pre> | |||
|Boolean. | |||
| | |||
|} | |||
=== Example === | |||
<pre>buildings = { | |||
my_provincial_building = { | |||
base_cost = 10000 | |||
infrastructure_construction_effect = yes | |||
provincial = yes | |||
max_level = 3 | |||
value = 1 | |||
icon_frame = 17 | |||
show_on_map = 1 | |||
always_shown = yes | |||
army_attack_factor = 0.1 | |||
army_defence_factor = 0.3 | |||
} | |||
my_shared_building = { | |||
base_cost = 1000 | |||
per_level_extra_cost = 200 | |||
infrastructure_construction_effect = yes | |||
shares_slots = yes # Max level of 15 since undefined | |||
value = 15 | |||
only_costal = yes | |||
icon_frame = 18 | |||
show_on_map = 3 | |||
show_on_map_meshes = 3 | |||
has_destroyed_mesh = yes | |||
military_production = 1 | |||
general_production = 1 | |||
naval_production = 1 | |||
} | |||
my_non_shared_building = { | |||
base_cost = 1000 | |||
per_level_extra_cost = 2000 | |||
max_level = 2 | |||
value = 5 | |||
icon_frame = 19 # No model is defined | |||
recruitable_population_factor = 0.5 | |||
} | } | ||
} | }</pre> | ||
== Localization == | |||
{{SVersion|1.11}} | |||
Buildings use the following localization keys, using my_building as an example: | |||
<pre> | |||
my_building: "My building" | |||
my_building_desc: "My building's description" | |||
my_building_plural: "My buildings" | |||
modifier_production_speed_my_building_factor: "§Y$my_building$§! construction speed" | |||
modifier_production_speed_my_building_factor_desc: "Modifies the speed of §Y$my_building$§! construction." | |||
modifier_state_production_my_building_factor:0 "§Y$my_building$§! construction speed" | |||
modifier_state_production_my_building_factor_desc:0 "Modifies the speed of §Y$my_building$§! construction in this state." | |||
</pre> | </pre> | ||
Note that | The first 3 are used for the building itself in various UI elements, while the last 4 are used to localise the modifiers automatically created for each building: <code>production_speed_<building>_factor</code> and <code>state_production_speed_<building>_factor</code>. | ||
== Types == | |||
{{SVersion|1.12}} | |||
These are the different types of buildings in the game as of 1.11 (Can also be found inside {{path|common/buildings/00_buildings.txt}}): | |||
{| class = "wikitable sortable" | |||
! class="unsortable" | Icon !! Localised name !! Internal name !! Maximum level !! Type | |||
|- id="infrastructure" | |||
| [[File:Infrastructure.png]] | |||
| Infrastructure | |||
| infrastructure | |||
| 5 | |||
| Non-shared | |||
|- id="arms_factory" | |||
| [[File:Military factory.png]] | |||
| Military factory | |||
| arms_factory | |||
| 20 | |||
| Shared | |||
|- id="industrial_complex" | |||
| [[File:Civilian factory.png]] | |||
| Civilian factory | |||
| industrial_complex | |||
| 20 | |||
| Shared | |||
|- id="air_base" | |||
| [[File:Air base.png]] | |||
| Air base | |||
| air_base | |||
| 10 | |||
| Non-shared | |||
|- id="supply_node" | |||
| [[File:Supply hub.png]] | |||
| Supply hub | |||
| supply_node | |||
| 1 | |||
| Provincial | |||
|- id="rail_way" | |||
| [[File:Railway.png]] | |||
| Railway | |||
| rail_way | |||
| {{hover|MAX_RAILWAY_LEVEL = 5 in common/defines/00_defines.lua|5}} | |||
| Provincial | |||
|- id="naval_base" | |||
| [[File:Naval base.png]] | |||
| Naval base | |||
| naval_base | |||
| 10 | |||
| Provincial | |||
|- id="bunker" | |||
| [[File:Land fort.png]] | |||
| Land fort | |||
| bunker | |||
| 10 | |||
| Provincial | |||
|- id="coastal_bunker" | |||
| [[File:Coastal fort.png]] | |||
| Coastal fort | |||
| coastal_bunker | |||
| 10 | |||
| Provincial | |||
|- id="dockyard" | |||
| [[File:Naval dockyard.png]] | |||
| Naval dockyard | |||
| dockyard | |||
| 20 | |||
| Shared | |||
|- id="anti_air_building" | |||
| [[File:Anti-air (building).png]] | |||
| Anti-air | |||
| anti_air_building | |||
| 5 | |||
| Non-shared | |||
|- id="synthetic_refinery" | |||
| [[File:Synthetic refinery.png]] | |||
| Synthetic refinery | |||
| synthetic_refinery | |||
| 3 | |||
| Shared | |||
|- id="fuel_silo" | |||
| [[File:Fuel silo.png]] | |||
| Fuel silo | |||
| fuel_silo | |||
| 15 | |||
| Shared | |||
|- id="radar_station" | |||
| [[File:Radar station.png]] | |||
| Radar station | |||
| radar_station | |||
| 6 | |||
| Non-shared | |||
|- id="rocket_site" | |||
| [[File:Rocket site.png]] | |||
| Rocket site | |||
| rocket_site | |||
| 2 | |||
| Non-shared | |||
|- id="nuclear_reactor" | |||
| [[File:Nuclear reactor.png]] | |||
| Nuclear reactor | |||
| nuclear_reactor | |||
| 1 | |||
| Non-shared | |||
|} | |||
Note that while railways and supply nodes are buildings, not all traditional building operations apply to them. Their starting level is defined [[Map_modding#Supply_nodes_and_railways|outside of state history]] and [[Effect#build_railway|a separate effect]] must be used to construct railways mid-game, with the default [[Effect#add_building_construction|add_building_construction]] or other building-related effects crashing the game. | |||
== References == | |||
<references /> | |||
{{Modding navbox}} | {{Modding navbox}} | ||
[[分类:Modding]] | [[分类:Modding]] |
2024年8月10日 (六) 02:01的最新版本
A building is a structure built using Civilian factories in states or provinces.
Buildings
Buildings are defined within /Hearts of Iron IV/common/buildings/*.txt. Each building entry lies within the buildings = { ... }
block, serving as its own block with arguments within defining the building, as this:
buildings = { my_building = { <...> } }
Cost
Each building has a set price in industrial capacity required. This cost is defined with the lines of base_cost = 1000
and per_level_extra_cost = 100
.
base_cost is the primary cost to build the building, added to each building level, while per_level_extra_cost gets added for each building level in an arithmetic progression. With the example of 1000 base_cost and 100 per_level_extra_cost, the first level will cost 1000 IC to build, while the 5th level will cost 1400 IC, as 4 levels have been built before that.
By default, each civilian factory provides 5 IC per day[1], which can be taken into account when calculating the cost. For comparison, by default a civilian factory costs 10800 IC, while infrastructure costs 6000 IC.
Additionally, infrastructure_construction_effect = yes
, if included, will make the building get the building speed boost from any infrastructure built in the state, with a +20% boost per infastructure level[2].
Used slots
In general, buildings fall into 3 categories by used building slots:
- Shared, which use the same, by default, 25 shared slots[3] for each state, such as civilian and military factories.
- Non-shared, defined for states, but using slots that are unique for this building in particular, such as infrastructure or air bases.
- Provincial, which get built for each province, using slots that are unique for this building in particular, such as forts or naval bases.
If not specified otherwise, a building is assumed to be non-shared. The 3 categories have separate zones in the country construction view where they are located.
provincial = yes
, if added, will make the building be considered provincial, while shares_slots = yes
will make it be considered shared if added. These cannot be combined.
Adding max_level = 10
can set a max level to which this building can be built. If it is unspecified, it gets assumed to be 15[4] by default.
By default, all levels of the building are unlocked by default. However, if there are technologies that enable construction of this building to a specified level, it becomes impossible to build without obtaining at least one of these technologies. It is to be noted that the add_building_construction effect or the starting state buildings can still be used to bypass the technological limit, while still not being possible to bypass the max level total.
Additional arguments
value = 3
decides the base health of a building for air bombing campaigns, which gets multiplied for each level of the building. Additionally, this also determines the price of the state to get during peace conferences or the cost in 政治点数 to occupy.
damage_factor = 0.3
modifies the damage that this building gets from air bombing or land combat. Positive values increase it, while negatives decrease it.
allied_build = yes
, if specified, makes the building count as an allied building, making its modifiers apply not just on the country that built it, but also its allies (i.e. subjects, overlord, and/or faction members).
only_costal = yes
(sic), if specified, will make the building only be possible to build in either provinces that are defined as coastal or states that contain any such provinces, depending on the type of the building.
disabled_in_dmz = yes
, if added, will make the building impossible to build or use in states that are demilitarised zones.
Icon
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.11。 |
The building icon is defined as icon_frame = 10
. The integer shows which frame within the GFX_buildings_strip sprite gets used for this building.
By default, GFX_buildings_strip is defined within /Hearts of Iron IV/interface/countrystateview.gfx, however, it can be overwritten in any /Hearts of Iron IV/interface/*.gfx which is positioned later by filename order:
spriteType = { name = "GFX_buildings_strip" textureFile = "gfx/interface/buildings/building_icon_strip.dds" noOfFrames = 16 # As of 1.11 }
The noOfFrames decides in how many frames the specified sprite is divided into, dividing the image horizontally into chunks of approximately equal width. If planning to add a new building icon rather than using a base game one, the building icon strip will need to be updated both in the noOfFrames and in the .dds file. By default, each building has a 46x46 resolution in pixels.
Within the building construction menu, buildings are divided into 3 zones depending on their used building slots category. In order to change where they are to adjust for new or missing buildings, the elements within the possible_constructions container in /Hearts of Iron IV/interface/countryconstructionsview.gui can have their positions changed.
Models
- 主条目:Entity modding
There are several arguments related to models within buildings.
show_on_map = 3
decides how many building models should there be per state or per province (depending on the building type) defined for the building. Each building construction will add one more model. If unspecified, will have no map models.
show_on_map_meshes = 2
decides how many entities are used for each building model. By default assumed to be 1.
always_shown = yes
, if specified, will make the building model appear regardless whether it's covered by the fog of war or not.
has_destroyed_mesh = yes
, if specified, will make the game use a separate model if the building has been destroyed by air bombing or occupation.
centered = yes
, if specified, will mak
In order to assign an entity to a building, it must have a name of building_<building name>
, like building_my_building
, within the /Hearts of Iron IV/gfx/entities/*.asset file. If a building is set to use several entities, then the number will get appended in the end like building_my_building_1
, starting with 1. If there's a destroyed mesh, then it'll append _destroyed in the end as building_my_building_destroyed
The locations of building models for each state are defined in /Hearts of Iron IV/map/buildings.txt. An entry in that file is defined as such (If unspecified, assume a number with up to 2 decimal digits):
State ID (integer); building ID (string); X position; Y position; Z position; Rotation; Adjacent sea province (integer)
- State ID defines which state the building is located in. Even for provincial buildings, this is the ID of the state, not the province. Instead, provincial buildings have several entries per state, with the XYZ position being used by the game to know which province it's for.
- Building ID is defines which model is being located. While this includes each building, this also includes floating harbours as floating_harbor.
- X, Y, and Z position represent the position on the map of the building model using the 3-dimensional Cartesian coordinate system. The X and Z positions are equivalent to the X and Y axes on the province bitmap with 1 pixel equalling 1 unit, left-to-right and down-to-up respectively. This is also what the game uses to know which province it's for for provincial buildings. The Y position, on the scale of 0 to 25.5, can be calculated with the heightmap by taking the colour value of the pixel at that position and making it fit on the scale of 0 to 25.5 (Such as by dividing it by 10 if it's on the scale of 0 to 255).
- Rotation is measured in radians. A rotation of 0 will result in the building model pointing in the same direction as the model is set, while positives will rotate it counter-clockwise and negatives will rotate it clockwise. A full rotation resulting in the same position as 0 is equal to the number π multiplied by 2, roughly 6.28.
- Adjacent sea province is only necessary to define for naval bases and floating harbours, in order to let the game know from which sea province ships or convoys can access the land province where it is located. If the building type is not a naval base, it should be left at 0.
It is preferable to generate the building models in the building section in the nudger, rather than filling it out manually. However, note that the game will crash if the currently-existing /Hearts of Iron IV/map/buildings.txt file is entirely empty, so there should be at least one definition, even if incorrect.
Effects
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.11。 |
Each building can accept any state-scoped modifier within itself, applying that to the state when built. Some used in base game include local_resources_<resource>
, air_defence
(for anti-air), and nuclear_production_factor
(for nuclear reactors). In case of provincial buildings, province-level modifiers are accepted instead. This can also be used with modifier tokens to create a custom effect as a variable system. Adding show_modifier = yes
will make the modifiers show up in the tooltip of the building.
Aside from state-scoped modifiers, there are several other arguments to make the building have the same effect as a base game building or be considered one for the AI:
Name | Effects | Examples | Type | Notes |
---|---|---|---|---|
military_production | Adds the specified amount of military factories to the controller. | military_production = 0.5 |
Flat. | A value that's larger than 1 will be the same as 1 factory, but it can fall between 0 and 1. |
general_production | Adds the specified amount of civilian factories to the controller. | general_production = 0.5 |
Flat. | A value that's larger than 1 will be the same as 1 factory, but it can fall between 0 and 1. |
naval_production | Adds the specified amount of dockyards to the controller. | naval_production = 0.5 |
Flat. | A value that's larger than 1 will be the same as 1 factory, but it can fall between 0 and 1. |
infrastructure | Makes the building be marked as infrastructure. | infrastructure = yes |
Boolean. | Includes the construction speed bonus and extra resources. |
air_base | Makes the building be marked as an air base. | air_base = yes |
Boolean. | |
supply_node | Makes the building be marked as a supply node. | supply_node = yes |
Boolean. | |
is_port | Makes the building be marked as a naval port. | is_port = yes |
Boolean. | |
land_fort | Adds that many land forts to the province. | land_fort = 1 |
Flat. | |
naval_fort | Adds that many coastal forts to the province. | naval_fort = 1 |
Flat. | |
refinery | Makes the building be marked as a synthetic refinery. | refinery = yes |
Boolean. | |
fuel_silo | Makes the building be marked as a fuel silo. | fuel_silo = yes |
Boolean. | |
radar | Makes the building be marked as a radar station. | radar = yes |
Boolean. | |
rocket_production | Defines how much progress on rocket production is done daily. | rocket_production = 5 |
Flat. | |
rocket_launch_capacity | Defines how many rockets the build can launch daily. | rocket_launch_capacity = 5 |
Flat. | |
nuclear_reactor | Makes the building be marked as a nuclear reactor. | nuclear_reactor = yes |
Boolean. |
Example
buildings = { my_provincial_building = { base_cost = 10000 infrastructure_construction_effect = yes provincial = yes max_level = 3 value = 1 icon_frame = 17 show_on_map = 1 always_shown = yes army_attack_factor = 0.1 army_defence_factor = 0.3 } my_shared_building = { base_cost = 1000 per_level_extra_cost = 200 infrastructure_construction_effect = yes shares_slots = yes # Max level of 15 since undefined value = 15 only_costal = yes icon_frame = 18 show_on_map = 3 show_on_map_meshes = 3 has_destroyed_mesh = yes military_production = 1 general_production = 1 naval_production = 1 } my_non_shared_building = { base_cost = 1000 per_level_extra_cost = 2000 max_level = 2 value = 5 icon_frame = 19 # No model is defined recruitable_population_factor = 0.5 } }
Localization
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.11。 |
Buildings use the following localization keys, using my_building as an example:
my_building: "My building" my_building_desc: "My building's description" my_building_plural: "My buildings" modifier_production_speed_my_building_factor: "§Y$my_building$§! construction speed" modifier_production_speed_my_building_factor_desc: "Modifies the speed of §Y$my_building$§! construction." modifier_state_production_my_building_factor:0 "§Y$my_building$§! construction speed" modifier_state_production_my_building_factor_desc:0 "Modifies the speed of §Y$my_building$§! construction in this state."
The first 3 are used for the building itself in various UI elements, while the last 4 are used to localise the modifiers automatically created for each building: production_speed_<building>_factor
and state_production_speed_<building>_factor
.
Types
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.12。 |
These are the different types of buildings in the game as of 1.11 (Can also be found inside /Hearts of Iron IV/common/buildings/00_buildings.txt):
Note that while railways and supply nodes are buildings, not all traditional building operations apply to them. Their starting level is defined outside of state history and a separate effect must be used to construct railways mid-game, with the default add_building_construction or other building-related effects crashing the game.
References
- ↑ BASE_FACTORY_SPEED = 5 in common/defines/00_defines.lua
- ↑ INFRA_MAX_CONSTRUCTION_COST_EFFECT = 1 in common/defines/00_defines.lua means a +100% speed bonus for max infrastructure. By default, infrastructure has 5 max levels, making the boost be divided into 5 portions of 20%, depending on the building level.
- ↑ MAX_SHARED_SLOTS = 25 in common/defines/00_defines.lua
- ↑ MAX_BUILDING_LEVELS = 15 in common/defines/00_defines.lua
文件 | 效果 • 条件 • 定义 • 修正 • 修正列表 • 作用域 • 本地化 • on action • 数据结构 (标记, 临时标记, 国家别名, 变量, 数组) |
脚本 | 成就修改 • AI修改 • AI focuses • 自治领修改 • 权力平衡修改 • 剧本/标签 (游戏规则)• 建筑修改 • 人物修改 • 修饰性TAG修改 • 国家创建 • 军队修改 • 决议制作 • 装备修改 • 事件修改 • Idea修改 • 意识形态修改 • 军工商修改 • 国策制作 • 资源修改 • Scripted GUI • 科技制作 • 单位修改 |
地图 | 地图 • 省份 • 补给区域 • 战略区域 |
图形图像 | 界面 • 图形资产 • 实体模型 • 后期特效 • 离子效果 • 字体 |
装饰性 | 肖像 • 命名列表 • 音乐 • 音效 |
其他 | 控制台指令 • 故障排除 • 模组结构 • 成就代码分析 • Mod相关 • Nudger修改 |