Division modding:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.10
(汉化)
无编辑摘要
第1行: 第1行:
{{Version|1.5}}
{{Version|1.10}}
本教程页面向您展示了如何制作师以及如何在HOI4修改中加载师。
{{Hatnote|This article is for creating divisions as part of a country's military. For sub-units making up the construction of division templates, see [[Unit modding]].}}
==如何制作oob文件==
Units are the foundations of Hearts of Iron, and can be broken down into air wings, divisions and naval task forces. The definitions are located within {{path|history/units/*.txt}} files and can be loaded by using the [[Effect#load_oob|load_oob effect]] or [[Country creation#Order of battle|various attributes inside of country history]]. The filename is irrelevant for interpretation, but it must match up with the effect or the attribute used to load it.
===制作师===
您需要启用-debug可执行命令和tdebug控制台命令才能正常工作


==使用国家/地区文件创建师==
__TOC__
你必须把这个写入国家历史文件才能在启动时加载oob,如果没有这些,这个国家在加载oob文件之前不会建立军队和训练师


1936开局:
The game uses orders of battle to define the state of the country's military. Traditionally, the starting equipment production is defined in them, using an [[effect]] block. Optionally, the current focus progress may be included.<br/>
'''Each order of battle must be loaded in order for the units to show up.''' For the starting state of the country's military, [[Country creation#Order of battle|this is done in country history]]. [[Effect#load_oob|The load_oob effect]] can be used to load one mid-game, which will add the information in the order of battle to the current information of the country, creating division templates and units and executing the effects.
 
The internal names for sub-units can be found in {{path|common/units/*.txt}} files, [[Modding#Searching multiple files|localisation can be checked as well]].
== Land units ==
{{SVersion|1.12}}
The land unit order of battle is usually the one that's loaded with <code>oob</code> or <code>set_oob</code> in country history. Most commonly, one is used since most definitions don't differ by DLC. However, if tank equipment types are referenced, such as when a unit is forced to use a certain tank equipment type or starting equipment production includes tanks, this is split into 2 files divided by the {{icon|nsb|1}} DLC, with an if statement in the place that loads it deciding whether one should be loaded, such as the following in a country history file:
<pre>if = {
   limit = { has_dlc = "No Step Back" }
   set_oob = "TAG_1936_nsb"
   else = { set_oob = "TAG_1936_legacy" }
}</pre>
===Division template===
{{Anchor|Division templates}}
{{See also|Effect|division_template|section=yes}}
Land units require a template of some sort, which assigns the necessary information. The template definition is equivalent to the <code>division_template</code> effect internally. A simple template can be defined as such:
<pre>division_template = {
   name = "Blueskirt Division"
   regiments = {
     infantry = { x = 0 y = 0 }
     infantry = { x = 0 y = 1 }
     artillery_brigade = { x = 1 y = 0 }
     artillery_brigade = { x = 1 y = 1 }
   }
   support = {
     artillery = { x = 0 y = 0 }
   }
}</pre>
* <code>name = ""</code> is the name of the division template as it shows up in the template selection. This will also get used for creating or modifying units.
* <code>regiments = { ... }</code> and <code>support = { ... }</code> decide the sub-units of the template, meaning [[Division#Combat Battalions|combat battalions]] and [[Division#Support companies|support companies]] respectively. In particular:
** <code>subunit = { x = 0 y = 0 }</code> decides the placement of the specified sub-unit. The coordinates represent the [[wp:Cartesian coordinate system|Cartesian coordinate system]], where (0,0) is the top-left corner, x goes left-to-right, and y goes up-to-down. For a unit to be placed as a support company, it must have <code>group = support</code> in its definition, and to be placed in combat battalions, it must have a different group. The group cannot change in a single y column.
:: By default, the combat battalions have {{rd|NMilitary|MAX_DIVISION_BRIGADE_WIDTH}} columns and {{rd|NMilitary|MAX_DIVISION_BRIGADE_HEIGHT}} rows, while the support companies have {{rd|NMilitary|MAX_DIVISION_SUPPORT_WIDTH}} column and {{rd|NMilitary|MAX_DIVISION_SUPPORT_HEIGHT}} rows.<ref>{{cd2|NMilitary|MAX_DIVISION_BRIGADE_WIDTH|MAX_DIVISION_BRIGADE_HEIGHT|MAX_DIVISION_SUPPORT_WIDTH|MAX_DIVISION_SUPPORT_HEIGHT}} in [[Defines]]</ref> The max index is one less than the total amount.
<noinclude>There are also optional arguments:</noinclude>
<includeonly>There are other arguments that can be used in a division template, as outlined in [[Division modding]]. The most common one to include is <code>division_names_group = USA_INF_01</code>: this</includeonly><noinclude>* <code>division_names_group = USA_INF_01</code></noinclude> forcefully changes the name group used for new divisions, defined in {{path|common/units/names_divisions/*.txt}} files. This is used to automatically generate names and numeration for new divisions, such as a division newly created by the player being named "1st 'Big Red One' Division". If not set, the template automatically picks the name group based on the sub-units.<noinclude>
* <code>is_locked = yes</code> will make the division locked, preventing the player from changing any of its information and creating/deleting/editing units with it. Defaults to no if unset.
* <code>force_allow_recruiting = yes</code> will allow recruiting new divisions from the template even if it locked. Has no effect on non-locked templates. Default to no if unset.
* <code>division_cap = 12</code> is the maximum amount of divisions that may be recruited with this template. The template has to be locked. Defaults to no cap if unset.
* <code>priority = 0</code> is the supply receiving priority. The options are 0 for "Reserves", 1 for default, and 2 for "Elite". Default to 1 if unset.
* <code>template_counter = 10</code> is used to override the default icon used for the position. The particular example with 10 will make sure that the sprites with the name of <code>GFX_div_templ_10_large</code> and <code>GFX_div_templ_10_small</code> will get used.
* <code>override_model = GER_infantry_entity</code> is used to change the [[Entity modding|entity]] that is used by divisions made from this template. Defaults to automatically determining based on the sub-units if unset.</noinclude>
===Division placement===
The <code>units = { ... }</code> block is used for positioning land and naval divisions. In particular, a land division placement is done via <code>division = { ... }</code>:
<pre>units = {
   division= {
     name = "1st Blueskirt Division"
     location = 9392 # Edinburgh
     division_template = "Blueskirt Division"
     start_experience_factor = 0.2
     start_equipment_factor = 0.3
   }
   division= {
     division_name = {
       is_name_ordered = yes
       name_order = 35
     }
     location = 6488
     division_template = "Infanterie-Division"
     force_equipment_variants = { infantry_equipment_0 = { owner = "SCO" } }
     officer = {
       name = SCO_officer_1
       portraits = {
         army = {
           large = GFX_SCO_officer_1
           small = GFX_SCO_officer_generic_small
         }
       }
     }
   }
}</pre>
For the division naming, there are two mutually-exclusive ways to do so:
* <code>name = "Unit's name"</code> directly changes the name of the division to the given string.
* <code>division_name = { ... }</code> instead uses the name group assigned to the division template:
** <code>is_name_ordered = yes</code> is mandatory to include.
** <code>name_order = 35</code> sets the number that gets used for the numeration. If the name group's <code>ordered = { ... }</code> includes this number, that entry gets used. Otherwise, the <code>fallback_name</code> is used.
There are these mandatory arguments in addition to the name:
* <code>location = 1234</code> is the province where the unit should be positioned.
* <code>division_template</code> is the name of the template that the unit should use. Generally best to limit to the one that's defined in the same file.
There are also optional arguments:
* <code>start_experience_factor = 0.2</code> sets the experience level of the division (from Greens to Veterans) in the range from 0 to 1. If unset, defaults to 0. The experience level boundaries in the base game are <code>{{rd|NMilitary|UNIT_EXP_LEVELS|ref=1|beforeref=</code>.}}
* <code>start_equipment_factor = 0.5</code> decides the starting equipment level of the division, not deciding on the manpower. The equipment is not subtracted from the reserves of the country. If unset, defaults to 1.
* <code>start_manpower_factor = 0.3</code> decides the starting manpower level of the division. If unset, then it's automatically subtracted from the reserves of the country until the highest possible level.
* <code>force_equipment_variants = { ... }</code> is a set of equipment types that the division should use, replacing the default. Each entry in there is <code>equipment_type = { ... }</code>, which may include:
** <code>owner = TAG</code> is the owner of the equipment that should be used. This should be the same as the country which gets the order of battle.
** <code>creator = TAG</code> is the original creator of the equipment that should be used. This is used to determine the variants, and it defaults to the owner if not specified.
** <code>amount = 14</code> is how much of the equipment should be there. The rest of required equipment within the archetype will remain ungiven.
** <code>version_name = "Variant's name"</code> is the name of the equipment variant that should be used. If the equipment type requires a variant to use, such as tanks in {{icon|nsb|1}}, this is mandatory. Otherwise, this is optional.
* <code>officer = { ... }</code> is a [[character modding|character definition]] that will be used for the divisional commander if promoted to a commander or the [[officer corps]] system is used. In particular, these attributes are common inside:
** <code>name = loc_key</code> is the [[localisation]] key to be used as the division commander's name.
** <code>portraits = { army = { large = "GFX_portrait_SCO_character" small = "GFX_idea_SCO_character" } }</code> is the portrait that the division commander must use. The large portrait will be used for the corps commander promotion and the small portrait will be used for the officer corps system. If both are unset, [[Country creation#Character portraits|randomly generates a portrait]]. If the large is set, the small portrait will default to the name of large portrait with _small appended to the end.
 
== Equipment production ==
{{SVersion|1.12}}
{{Main|Effect|add_equipment_production|section=yes}}
The equipment production is simulated using the <code>instant_effect = { ... }</code> block. This is a regular [[effect]] block, any effect can be used here. Usually, the production is added in this manner:
<pre>instant_effect = {
   add_equipment_production = {
     equipment = {
   type = infantry_equipment_0
   creator = "ARG"
}
requested_factories = 1
progress = 0.19
efficiency = 100
   }
}
</pre>
The <code>add_equipment_production = { ... }</code> has these attributes:
* <code>equipment = { ... }</code> decides on which equipment specifically should be made, in particular:
** <code>creator = TAG</code> is the creator of the equipment. Usually it's the same person who makes the equipment, but it may be different for lend-leases.
** <code>type = infantry_equipment_0</code> is the exact equipment type that should be produced. The technology to unlock it, if needed, must be researched by the creator. Equipment can be found in {{path|common/units/equipment/*.txt}} files.
** <code>version_name = "Variant name"</code> is the variant that should be used for equipment, [[Country creation#Variants|usually defined in country history]]. This is mandatory if the equipment requires a variant to produce, such as ships in {{icon|mtg|1}} or airplanes in {{icon|bba|1}}. Otherwise, it's optional.
* <code>requested_factories = 1</code> is the amount of military factories or dockyards that should be dedicated towards producing this equipment type. If unfulfilled, the factories will be assigned into the queue.
* <code>progress = 0.2</code> is used to assign the current amount of progress towards a single piece of equipment being finished. This is usually changed for expensive equipment, such as battleships.
* <code>efficiency = 100</code> is, with 0 as 0% and 100 as 100%, the [[production efficiency]] which the factories should have immediately.
== Adding Air Wings ==
{{SVersion|1.10}}
<pre>
<pre>
oob = "TAG_1936"
air_wings = {
</pre> 
   500 = {
     fighter_equipment_0 = {
       owner = "BRA"
       amount = 10
     }
   }
}
</pre>


1939开局:
* '''Air Wings''' is the command that creates the air wing.
* '''500''' is the state where the air wing spawns. The state should have an air base set there.
* '''fighter_equipment_0''' is the type of aircraft that is in the air wing.
* '''Owner''' is who created the type of aircraft. Does not need to be the country you are making the file for.
* '''Amount''' is how many of that type of equipment is in that air wing.
 
== Adding Navies ==
{{SVersion|1.10}}
=== Man the Guns ===


<pre>
<pre>
oob = "TAG_1939"
units = {
</pre> 
   fleet = {
     name = "Fleet De Custom" # Name 1
     naval_base = 10980
     task_force = {
       name = "Fleet De Custom" # Name 2
       location = 10980
       ship = {
         name = "NRB Minas Gerasis" # Name 3
         pride_of_the_fleet = yes
         definition = battleship
         equipment = {
           ship_hull_heavy_1 = {
             amount = 1
             owner = BRA
             version_name = "Minas Geras Class"
           }
         }
       }
     }
 
     task_force = {
       name = "Fleet De Submarine" # Name 1
       location = 10980
       ship = {
         name = "NRB Humayta" # Name 2
         definition = submarine
         equipment = {
           ship_hull_submarine_2 = {
             amount = 1
             owner = BRA
             version_name = "Humayta Class"
           }
         }
       }
     }
   }
}
</pre>
 
* '''Fleet''' begins a new fleet which can comprise of multiple task forces.
* '''Name 1''' is the name of the fleet.
* '''Naval Base''' is the location of where the fleet is headquartered.
* '''Name 2''' is the name of the task force.
* '''Location''' is where the task force spawns.
* '''Ship''' creates a new ship within the task force.
* '''Pride Of The Fleet''' designates a ship as the pride of the fleet. Only one ship can be the Pride Of The Fleet at a time. Optional.
* '''Definition''' sets what type of ship it is.
* '''Equipment''' sets what level of equipment the ship uses.
* '''Amount''' is how much of that equipment the ship uses. Should be kept at one.
* '''Owner''' is who created the equipment the ship uses.
* '''Version Name''' is for custom classes of ship. Optional
 
 
=== Non-Man The Guns ===
 
The only main difference between this section and the Man The Guns section is the equipment.


==使用国家/地区事件创建师==
如果你想通过事件加载oob,你需要知道如何修改事件。首先,您必须创建一个事件文件并写入:
===创建事件===
<pre>
<pre>
add_namespace = Tutorial_events
units = {
country_event = { 
   fleet = {
     name = "Armada Argentina"
     naval_base = 12364
     task_force = {
       name = "Armada Argentina"
       location = 12364
       ship = {
         name = "ARA Rivadavia"
         definition = battleship
         equipment = {
           battleship_1 = {
             amount = 1
             owner = ARG
             version_name = "Rivadavia Class"
           }
         }
       }
     }
   }
}
}
</pre> 
</pre>
 
* '''Fleet''' begins a new fleet which can comprise of multiple task forces.
* '''Name 1''' is the name of the fleet.
* '''Naval Base''' is the location of where the fleet is headquartered.
* '''Name 2''' is the name of the task force.
* '''Location''' is where the task force spawns.
* '''Ship''' creates a new ship within the task force.
* '''Definition''' sets what type of ship it is.
* '''Equipment''' sets what level of equipment the ship uses.
* '''Amount''' is how much of that equipment the ship uses. Should be kept at one.
* '''Owner''' is who created the equipment the ship uses.
* '''Version Name''' is for custom classes of ship. Optional
 
== List of Units ==
{{SVersion|1.10}}
=== Regiments ===
<pre>
infantry
cavalry
camelry
motorized
light_armor
medium_armor
heavy_armor
super_heavy_armor
modern_armor
marine
paratrooper
amphibious_armor
amphibious_mechanized
anti_tank_brigade
anti_air_brigade
armored_car
artillery_brigade
mot_artillery_brigade
mot_anti_tank_brigade
mot_anti_air_brigade
rocket_artillery_brigade
mot_rocket_artillery_brigade
motorized_rocket_brigade
bicycle_battalion
mountaineers
mechanized
light_sp_anti_air_brigade
medium_sp_anti_air_brigade
heavy_sp_anti_air_brigade
super_heavy_sp_anti_air_brigade
modern_sp_anti_air_brigade
light_sp_artillery_brigade
medium_sp_artillery_brigade
heavy_sp_artillery_brigade
super_heavy_sp_artillery_brigade
modern_sp_artillery_brigade
light_tank_destroyer_brigade
medium_tank_destroyer_brigade
heavy_tank_destroyer_brigade
super_heavy_tank_destroyer_brigade
modern_tank_destroyer_brigade
</pre>
 
=== Support Companies ===
 
<pre>
anti_air
anti_tank
armored_car_recon
artillery
engineer
field_hospital
logistics_company
maintenance_company
military_police
mot_recon
recon
rocket_artillery
signal_company
</pre>
 
=== Aircraft ===
 
CV references the carrier variant of the aircraft. All aircraft have a carrier variant unless otherwise specified.
 
<pre>
fighter_equipment_0
cv_fighter_equipment_0
fighter_equipment_1
fighter_equipment_2
fighter_equipment_3
jet_fighter_equipment_1
jet_fighter_equipment_2
 
CAS_equipment_1
cv_CAS_equipment_1
CAS_equipment_2
CAS_equipment_3
 
nav_bomber_equipment_1
cv_nav_bomber_equipment_1
nav_bomber_equipment_2
nav_bomber_equipment_3
 
tac_bomber_equipment_0
 
heavy_fighter_equipment_1
heavy_fighter_equipment_2
heavy_fighter_equipment_3
 
scout_plane_equipment_1
scout_plane_equipment_2
 
tac_bomber_equipment_1
tac_bomber_equipment_2
tac_bomber_equipment_3
 
jet_tac_bomber_equipment_1
jet_tac_bomber_equipment_2


这意味着游戏将把代码识别为事件代码,命名空间可以是它想要的任何名称
strat_bomber_equipment_1
strat_bomber_equipment_2
strat_bomber_equipment_3


=== 命名空间(ID、Title和Desc)的使用===
jet_strat_bomber_equipment_1
其次,您必须写入id、标题和说明:
 
rocket_suicide_equipment_1
</pre>
 
=== Ship Categories ===


<pre>
<pre>
country_event = {
battleship
   id = Tutorial_events.1
carrier
   title = "This is a title" ### 可以通过事件文件或本地化文件进行本地化
destroyer
   desc = "This is a description"
battle_cruiser
}
heavy_cruiser
</pre> 
light_cruiser
=== 触发条件===
submarine
第三,您想要放入<pre>'is_triggerd_only=yes</pre> 和<pre>fire_only_once=yes</pre> ,您可以使用它们来创建触发器。之后你可以输入选项!我将使用我自己的触发器示例
</pre>
 
=== MTG Ship Equipment ===
 
<pre>
<pre>
   id = Tutorial_events.1
ship_hull_carrier_1
   title = "This is a title" ### Can be localized via the event file or by the localization file
ship_hull_carrier_2
   desc = "This is a description"
ship_hull_carrier_3
   trigger = {
 
      date > 1939.1.1
ship_hull_carrier_conversion_bb
   }
ship_hull_carrier_conversion_ca
   is_triggered_only = yes
 
   fire_only_once = yes
ship_hull_cruiser_1
   option = {
ship_hull_cruiser_2
      name = "This is a name"
ship_hull_cruiser_3
   }  
ship_hull_cruiser_4
</pre> 
 
=== 选项===
ship_hull_pre_dreadnought
然后你可以放入
ship_hull_heavy_1
ship_hull_heavy_2
ship_hull_heavy_3
ship_hull_heavy_4
 
ship_hull_super_heavy_1
 
ship_hull_light_1
ship_hull_light_2
ship_hull_light_3
ship_hull_light_4
 
ship_hull_submarine_1
ship_hull_submarine_2
ship_hull_submarine_3
ship_hull_submarine_4
 
ship_hull_cruiser_submarine
 
torpedo_cruiser
ship_hull_torpedo_cruiser
ship_hull_cruiser_panzerschiff
 
ship_hull_cruiser_coastal_defense_ship
 
SH_battleship_1
SH_battleship_2
</pre>
 
=== Non-MTG Ship Equipment ===
 
<pre>
<pre>
option = {
carrier_1
  name = "This is a name"
carrier_2
  load_oob = "TAG_1936" ### Can be TAG_1939 for that start date
carrier_3
}  
carrier_4
</pre>
 
light_cruiser_1
light_cruiser_2
light_cruiser_3
light_cruiser_4
 
heavy_cruiser_1
heavy_cruiser_2
heavy_cruiser_3
heavy_cruiser_4
 
battleship_1
battleship_2
battleship_3
battleship_4
 
battle_cruiser_1
battle_cruiser_2
 
destroyer_1
destroyer_2
destroyer_3
destroyer_4


submarine_1
submarine_2
submarine_3
submarine_4
</pre>
== References ==
<references/>
{{Modding navbox}}
{{Modding navbox}}
[[分类:Modding]]
[[分类:Modding]]

2024年8月9日 (五) 16:29的版本

This article is for creating divisions as part of a country's military. For sub-units making up the construction of division templates, see Unit modding.

Units are the foundations of Hearts of Iron, and can be broken down into air wings, divisions and naval task forces. The definitions are located within /Hearts of Iron IV/history/units/*.txt files and can be loaded by using the load_oob effect or various attributes inside of country history. The filename is irrelevant for interpretation, but it must match up with the effect or the attribute used to load it.

The game uses orders of battle to define the state of the country's military. Traditionally, the starting equipment production is defined in them, using an effect block. Optionally, the current focus progress may be included.
Each order of battle must be loaded in order for the units to show up. For the starting state of the country's military, this is done in country history. The load_oob effect can be used to load one mid-game, which will add the information in the order of battle to the current information of the country, creating division templates and units and executing the effects.

The internal names for sub-units can be found in /Hearts of Iron IV/common/units/*.txt files, localisation can be checked as well.

Land units

The land unit order of battle is usually the one that's loaded with oob or set_oob in country history. Most commonly, one is used since most definitions don't differ by DLC. However, if tank equipment types are referenced, such as when a unit is forced to use a certain tank equipment type or starting equipment production includes tanks, this is split into 2 files divided by the 寸步不退寸步不退 DLC, with an if statement in the place that loads it deciding whether one should be loaded, such as the following in a country history file:

if = {
    limit = { has_dlc = "No Step Back" }
    set_oob = "TAG_1936_nsb"
    else = { set_oob = "TAG_1936_legacy" }
}

Division template

参见:Effect

Land units require a template of some sort, which assigns the necessary information. The template definition is equivalent to the division_template effect internally. A simple template can be defined as such:

division_template = {
    name = "Blueskirt Division"
    regiments = {
        infantry = { x = 0 y = 0 }
        infantry = { x = 0 y = 1 }
        artillery_brigade = { x = 1 y = 0 }
        artillery_brigade = { x = 1 y = 1 }
    }
    support = {
        artillery = { x = 0 y = 0 }
    }
}
  • name = "" is the name of the division template as it shows up in the template selection. This will also get used for creating or modifying units.
  • regiments = { ... } and support = { ... } decide the sub-units of the template, meaning combat battalions and support companies respectively. In particular:
    • subunit = { x = 0 y = 0 } decides the placement of the specified sub-unit. The coordinates represent the Cartesian coordinate system, where (0,0) is the top-left corner, x goes left-to-right, and y goes up-to-down. For a unit to be placed as a support company, it must have group = support in its definition, and to be placed in combat battalions, it must have a different group. The group cannot change in a single y column.
By default, the combat battalions have NDefines.NMilitary.MAX_DIVISION_BRIGADE_WIDTH = 5 columns and NDefines.NMilitary.MAX_DIVISION_BRIGADE_HEIGHT = 5 rows, while the support companies have NDefines.NMilitary.MAX_DIVISION_SUPPORT_WIDTH = 1 column and NDefines.NMilitary.MAX_DIVISION_SUPPORT_HEIGHT = 5 rows.[1] The max index is one less than the total amount.

There are also optional arguments:

  • division_names_group = USA_INF_01 forcefully changes the name group used for new divisions, defined in /Hearts of Iron IV/common/units/names_divisions/*.txt files. This is used to automatically generate names and numeration for new divisions, such as a division newly created by the player being named "1st 'Big Red One' Division". If not set, the template automatically picks the name group based on the sub-units.
  • is_locked = yes will make the division locked, preventing the player from changing any of its information and creating/deleting/editing units with it. Defaults to no if unset.
  • force_allow_recruiting = yes will allow recruiting new divisions from the template even if it locked. Has no effect on non-locked templates. Default to no if unset.
  • division_cap = 12 is the maximum amount of divisions that may be recruited with this template. The template has to be locked. Defaults to no cap if unset.
  • priority = 0 is the supply receiving priority. The options are 0 for "Reserves", 1 for default, and 2 for "Elite". Default to 1 if unset.
  • template_counter = 10 is used to override the default icon used for the position. The particular example with 10 will make sure that the sprites with the name of GFX_div_templ_10_large and GFX_div_templ_10_small will get used.
  • override_model = GER_infantry_entity is used to change the entity that is used by divisions made from this template. Defaults to automatically determining based on the sub-units if unset.

Division placement

The units = { ... } block is used for positioning land and naval divisions. In particular, a land division placement is done via division = { ... }:

units = {
    division= {
        name = "1st Blueskirt Division"
        location = 9392 # Edinburgh
        division_template = "Blueskirt Division"
        start_experience_factor = 0.2
        start_equipment_factor = 0.3
    }
    division= {
        division_name = {
            is_name_ordered = yes
            name_order = 35
        }
        location = 6488
        division_template = "Infanterie-Division"
        force_equipment_variants = { infantry_equipment_0 = { owner = "SCO" } }
        officer = {
            name = SCO_officer_1
            portraits = {
                army = {
                    large = GFX_SCO_officer_1
                    small = GFX_SCO_officer_generic_small
                }
            }
        }
    }
}

For the division naming, there are two mutually-exclusive ways to do so:

  • name = "Unit's name" directly changes the name of the division to the given string.
  • division_name = { ... } instead uses the name group assigned to the division template:
    • is_name_ordered = yes is mandatory to include.
    • name_order = 35 sets the number that gets used for the numeration. If the name group's ordered = { ... } includes this number, that entry gets used. Otherwise, the fallback_name is used.

There are these mandatory arguments in addition to the name:

  • location = 1234 is the province where the unit should be positioned.
  • division_template is the name of the template that the unit should use. Generally best to limit to the one that's defined in the same file.

There are also optional arguments:

  • start_experience_factor = 0.2 sets the experience level of the division (from Greens to Veterans) in the range from 0 to 1. If unset, defaults to 0. The experience level boundaries in the base game are NDefines.NMilitary.UNIT_EXP_LEVELS = { 0.1, 0.3, 0.75, 0.9 }
  • start_equipment_factor = 0.5 decides the starting equipment level of the division, not deciding on the manpower. The equipment is not subtracted from the reserves of the country. If unset, defaults to 1.
  • start_manpower_factor = 0.3 decides the starting manpower level of the division. If unset, then it's automatically subtracted from the reserves of the country until the highest possible level.
  • force_equipment_variants = { ... } is a set of equipment types that the division should use, replacing the default. Each entry in there is equipment_type = { ... }, which may include:
    • owner = TAG is the owner of the equipment that should be used. This should be the same as the country which gets the order of battle.
    • creator = TAG is the original creator of the equipment that should be used. This is used to determine the variants, and it defaults to the owner if not specified.
    • amount = 14 is how much of the equipment should be there. The rest of required equipment within the archetype will remain ungiven.
    • version_name = "Variant's name" is the name of the equipment variant that should be used. If the equipment type requires a variant to use, such as tanks in 寸步不退寸步不退, this is mandatory. Otherwise, this is optional.
  • officer = { ... } is a character definition that will be used for the divisional commander if promoted to a commander or the officer corps system is used. In particular, these attributes are common inside:
    • name = loc_key is the localisation key to be used as the division commander's name.
    • portraits = { army = { large = "GFX_portrait_SCO_character" small = "GFX_idea_SCO_character" } } is the portrait that the division commander must use. The large portrait will be used for the corps commander promotion and the small portrait will be used for the officer corps system. If both are unset, randomly generates a portrait. If the large is set, the small portrait will default to the name of large portrait with _small appended to the end.

Equipment production

The equipment production is simulated using the instant_effect = { ... } block. This is a regular effect block, any effect can be used here. Usually, the production is added in this manner:

instant_effect = {
    add_equipment_production = {
        equipment = {
	    type = infantry_equipment_0
	    creator = "ARG"
	}
	requested_factories = 1
	progress = 0.19
	efficiency = 100
    }
}

The add_equipment_production = { ... } has these attributes:

  • equipment = { ... } decides on which equipment specifically should be made, in particular:
    • creator = TAG is the creator of the equipment. Usually it's the same person who makes the equipment, but it may be different for lend-leases.
    • type = infantry_equipment_0 is the exact equipment type that should be produced. The technology to unlock it, if needed, must be researched by the creator. Equipment can be found in /Hearts of Iron IV/common/units/equipment/*.txt files.
    • version_name = "Variant name" is the variant that should be used for equipment, usually defined in country history. This is mandatory if the equipment requires a variant to produce, such as ships in 炮手就位炮手就位 or airplanes in 唯有浴血唯有浴血. Otherwise, it's optional.
  • requested_factories = 1 is the amount of military factories or dockyards that should be dedicated towards producing this equipment type. If unfulfilled, the factories will be assigned into the queue.
  • progress = 0.2 is used to assign the current amount of progress towards a single piece of equipment being finished. This is usually changed for expensive equipment, such as battleships.
  • efficiency = 100 is, with 0 as 0% and 100 as 100%, the production efficiency which the factories should have immediately.

Adding Air Wings

air_wings = {
    500 = {
        fighter_equipment_0 = {
            owner = "BRA"
            amount = 10
        }
    }
}
  • Air Wings is the command that creates the air wing.
  • 500 is the state where the air wing spawns. The state should have an air base set there.
  • fighter_equipment_0 is the type of aircraft that is in the air wing.
  • Owner is who created the type of aircraft. Does not need to be the country you are making the file for.
  • Amount is how many of that type of equipment is in that air wing.

Adding Navies

Man the Guns

units = {
    fleet = {
        name = "Fleet De Custom" # Name 1
        naval_base = 10980
        task_force = {
            name = "Fleet De Custom" # Name 2
            location = 10980
            ship = {
                name = "NRB Minas Gerasis" # Name 3
                pride_of_the_fleet = yes
                definition = battleship
                equipment = { 
                    ship_hull_heavy_1 = {
                        amount = 1
                        owner = BRA
                        version_name = "Minas Geras Class"
                    }
                }
            }
        }

        task_force = {
            name = "Fleet De Submarine" # Name 1
            location = 10980
            ship = {
                name = "NRB Humayta" # Name 2
                definition = submarine
                equipment = {
                    ship_hull_submarine_2 = {
                        amount = 1
                        owner = BRA
                        version_name = "Humayta Class"
                    }
                }
            }
        }
    }
}
  • Fleet begins a new fleet which can comprise of multiple task forces.
  • Name 1 is the name of the fleet.
  • Naval Base is the location of where the fleet is headquartered.
  • Name 2 is the name of the task force.
  • Location is where the task force spawns.
  • Ship creates a new ship within the task force.
  • Pride Of The Fleet designates a ship as the pride of the fleet. Only one ship can be the Pride Of The Fleet at a time. Optional.
  • Definition sets what type of ship it is.
  • Equipment sets what level of equipment the ship uses.
  • Amount is how much of that equipment the ship uses. Should be kept at one.
  • Owner is who created the equipment the ship uses.
  • Version Name is for custom classes of ship. Optional


Non-Man The Guns

The only main difference between this section and the Man The Guns section is the equipment.

units = {
    fleet = {
        name = "Armada Argentina"
        naval_base = 12364
        task_force = {
            name = "Armada Argentina"
            location = 12364
            ship = {
                name = "ARA Rivadavia"
                definition = battleship
                equipment = {
                    battleship_1 = {
                        amount = 1
                        owner = ARG
                        version_name = "Rivadavia Class"
                    }
                }
            }
        }
    }
}
  • Fleet begins a new fleet which can comprise of multiple task forces.
  • Name 1 is the name of the fleet.
  • Naval Base is the location of where the fleet is headquartered.
  • Name 2 is the name of the task force.
  • Location is where the task force spawns.
  • Ship creates a new ship within the task force.
  • Definition sets what type of ship it is.
  • Equipment sets what level of equipment the ship uses.
  • Amount is how much of that equipment the ship uses. Should be kept at one.
  • Owner is who created the equipment the ship uses.
  • Version Name is for custom classes of ship. Optional

List of Units

Regiments

infantry
cavalry
camelry
motorized
light_armor
medium_armor
heavy_armor
super_heavy_armor
modern_armor
marine
paratrooper
amphibious_armor
amphibious_mechanized
anti_tank_brigade
anti_air_brigade
armored_car
artillery_brigade
mot_artillery_brigade
mot_anti_tank_brigade
mot_anti_air_brigade
rocket_artillery_brigade
mot_rocket_artillery_brigade
motorized_rocket_brigade
bicycle_battalion
mountaineers
mechanized
light_sp_anti_air_brigade
medium_sp_anti_air_brigade
heavy_sp_anti_air_brigade
super_heavy_sp_anti_air_brigade
modern_sp_anti_air_brigade
light_sp_artillery_brigade
medium_sp_artillery_brigade
heavy_sp_artillery_brigade
super_heavy_sp_artillery_brigade
modern_sp_artillery_brigade
light_tank_destroyer_brigade
medium_tank_destroyer_brigade
heavy_tank_destroyer_brigade
super_heavy_tank_destroyer_brigade
modern_tank_destroyer_brigade

Support Companies

anti_air
anti_tank
armored_car_recon
artillery
engineer
field_hospital
logistics_company
maintenance_company
military_police
mot_recon
recon
rocket_artillery
signal_company

Aircraft

CV references the carrier variant of the aircraft. All aircraft have a carrier variant unless otherwise specified.

fighter_equipment_0
cv_fighter_equipment_0
fighter_equipment_1
fighter_equipment_2
fighter_equipment_3
jet_fighter_equipment_1
jet_fighter_equipment_2

CAS_equipment_1
cv_CAS_equipment_1
CAS_equipment_2
CAS_equipment_3

nav_bomber_equipment_1
cv_nav_bomber_equipment_1
nav_bomber_equipment_2
nav_bomber_equipment_3

tac_bomber_equipment_0

heavy_fighter_equipment_1
heavy_fighter_equipment_2
heavy_fighter_equipment_3

scout_plane_equipment_1
scout_plane_equipment_2

tac_bomber_equipment_1
tac_bomber_equipment_2
tac_bomber_equipment_3

jet_tac_bomber_equipment_1
jet_tac_bomber_equipment_2

strat_bomber_equipment_1
strat_bomber_equipment_2
strat_bomber_equipment_3

jet_strat_bomber_equipment_1

rocket_suicide_equipment_1

Ship Categories

battleship
carrier
destroyer
battle_cruiser
heavy_cruiser
light_cruiser
submarine

MTG Ship Equipment

ship_hull_carrier_1
ship_hull_carrier_2
ship_hull_carrier_3

ship_hull_carrier_conversion_bb
ship_hull_carrier_conversion_ca

ship_hull_cruiser_1
ship_hull_cruiser_2
ship_hull_cruiser_3
ship_hull_cruiser_4

ship_hull_pre_dreadnought
ship_hull_heavy_1
ship_hull_heavy_2
ship_hull_heavy_3
ship_hull_heavy_4

ship_hull_super_heavy_1

ship_hull_light_1
ship_hull_light_2
ship_hull_light_3
ship_hull_light_4

ship_hull_submarine_1
ship_hull_submarine_2
ship_hull_submarine_3
ship_hull_submarine_4

ship_hull_cruiser_submarine

torpedo_cruiser
ship_hull_torpedo_cruiser
ship_hull_cruiser_panzerschiff

ship_hull_cruiser_coastal_defense_ship

SH_battleship_1
SH_battleship_2

Non-MTG Ship Equipment

carrier_1
carrier_2
carrier_3
carrier_4

light_cruiser_1
light_cruiser_2
light_cruiser_3
light_cruiser_4

heavy_cruiser_1
heavy_cruiser_2
heavy_cruiser_3
heavy_cruiser_4

battleship_1
battleship_2
battleship_3
battleship_4

battle_cruiser_1
battle_cruiser_2

destroyer_1
destroyer_2
destroyer_3
destroyer_4

submarine_1
submarine_2
submarine_3
submarine_4

References

  1. NDefines.NMilitary.MAX_DIVISION_BRIGADE_WIDTH = 5, NDefines.NMilitary.MAX_DIVISION_BRIGADE_HEIGHT = 5, NDefines.NMilitary.MAX_DIVISION_SUPPORT_WIDTH = 1, and NDefines.NMilitary.MAX_DIVISION_SUPPORT_HEIGHT = 5 in Defines