Military Industrial Organizations (MIOs) represent the applied research and development of your country. They boost your research in their area of focus and modify the stats of equipment produced with their aid.
Warning
Military Industrial Organizations and their policies are loaded only when creating a new game. it is not possible to inject new MIOs/policies into an ongoing game - for development / test runs, you must always create a new game.
You can freely modify what boni a trait grants, what icon to use or the localization. Adding traits is also possible, but removing existing traits can lead to errors.
Designing an MIO
What can you mod?
Fundamentally, MIO modding has four aspects you can modify:
- A fully independent Military Industrial Organization (Full MIO or Archetype)
- A MIO modification, based on another MIO, adding, removing or changing traits granted (Delta MIO)
- A Policy that can be applied to MIOs (typically after reaching Level 6+)
- AI Bonus Weights, which governs how the AI will prioritize boni granted by traits
Files and Folders
MIOs are defined in /Hearts of Iron IV/common/military_industrial_organization/organizations/, where you can place any number of MIOs in any number of txt files, encoded in UTF8 without a Byte Order Mark (BOM). For example, the game itself comes with one default "generic organization" file, containing the baseline templates, then one for each TAG that has alterations / extensions to that baseline.
Policies are defined in /Hearts of Iron IV/common/military_industrial_organization/policies/, again allowing any number of policies in any number of txt files, encoded in UTF8 without a Byte Order Mark (BOM).
Finally, AI Bonus Weights are defined in /Hearts of Iron IV/common/military_industrial_organization/ai_bonus_weights/
In all three directories of the game you can find a "documentation.info" text file describing some of the thoughts of the designers and some guidance.
The Error Log
While this is true for most aspects of modding, checking the error log has never been more critical than when modding MIOs: The simple fact that most errors impact the start of a game, are unfixable once it is running and that MIOs affect the game in the long run make it simple to waste a lot of time only to have to reset after all.
You can find the error.log text file in "%userprofile%\Documents\Paradox Interactive\Hearts of Iron IV\logs". Check it first after game start and browsing through the MIO menus (browsing the menus will trigger any errors associated with visibility filters).
Full MIO
Layout
<MIO Name> = { # Optional Localization Key name = LOC_infernal_mio_tanks icon = GFX_key equipment_type = { <equipment type> <equipment type> } research_categories = { <research type> <research type> } # Mandatory. In Country Scope. allowed = <condition> # Optional. In MIO Scope. FROM = country. visible = <condition> # Optional. In MIO Scope. FROM = country. available = <condition> # Additional Events if desired # on_design_team_assigned_to_tech = { ... } # on_design_team_assigned_to_variant = { ... } # on_industrial_manufacturer_assigned = { ... } # on_tech_research_cancelled = { ... } # on_tech_research_completed = { ... } # on_industrial_manufacturer_unassigned = { ... } # Bonus to assigned research research_bonus = 0.2 # How many tasks can the MIO perform simultaneously? task_capacity = 999 # Provide custom AI weights to help the AI choose the right MIO # ai_will_do = { # ... # } # As many headers as desired. tree_header_text = { text = "Label1" # Either plain text or localization key x = 0 # Just where on the header bar is the label placed. 0 = Leftmost, 9 = Rightmost } tree_header_text = { text = "Label2" x = 2 } tree_header_text = { text = "Label3" x = 4 } tree_header_text = { text = "LabelN" x = 8 } initial_trait = <initial trait> trait = <trait> trait = <trait> trait = <trait> # ... as many more as needed }
The Properties Explained
Key | Mandatory? | Description | Example |
---|---|---|---|
name | false | If provided, it will resolve the displayname of the MIO in the following order: 1. <tag>_<name> 2. <name> | name = LOC_infernal_mio_tanks |
icon | false | The Icon to use for the MIO in the interface | icon = GFX_idea_generic_tank_manufacturer_1 |
background | false | The background image for the Details window. If not specified, one of standard backgrounds will be used based on supported equipment types | background = GFX_key |
equipment_type | true | List of equipment types the MIO affects. Used to select which production lines the MIO can be applied to and what the various boni in the traits will affect | equipment_type = { mio_cat_eq_all_light_tank mio_cat_eq_all_medium_tank } |
research_categories | true | List of research categories affected by the MIO. | research_categories = { mio_cat_tech_light_armor_and_modules mio_cat_tech_medium_armor_and_modules } |
allowed | true | The condition checked AT GAME START whether the MIO is applicable to a given country. At this time, some conditions do not yet apply - for example, the player has not yet taken control, so the "is_ai" condition is meaningless. | allowed = { always = true } |
visible | false | Whether the MIO is visible to the nation. Is evaluated in the MIO scope, the country is available in the FROM scope. An MIO must be visible and available for the AI to be able to use it. | visible = { always = true } |
available | false | Whether the MIO is available to the nation. Will be grayed out in the UI if not. Is evaluated in the MIO scope, the country is available in the FROM scope. An MIO must be visible and available for the AI to be able to use it. | visible = { always = true } |
on_design_team_assigned_to_tech | false | Event that triggers when the MIO is attached to a research project | na |
on_design_team_assigned_to_variant | false | Event that triggers when the MIO is attached to a model in the ship/tank/aircraft designer | na |
on_industrial_manufacturer_assigned | false | Event that triggers when the MIO is attached to a production line | na |
on_industrial_manufacturer_unassigned | false | Event that triggers when unassigned from a production line | na |
on_tech_research_cancelled | false | Event that triggers when the associated research is cancelled (be sure to add some deeply annoyed researches with crippling country penalties) | na |
on_tech_research_completed | false | Event that triggers when the associated research is completed successfully | na |
research_bonus | false | How much research % bonus the MIO grants by default to associated research. Defaults to the DESIGN_TEAM_RESEARCH_BONUS define value | research_bonus = 0.2 |
task_capacity | false | How many things the MIO can do in parallel. Defaults to the DEFAULT_INITIAL_TASK_CAPACITY define value | task_capacity = 3 |
ai_will_do | false | How the AI prioritizes using this MIO compared to alternatively available MIOs | na |
tree_header_text | false | Can be provided multiple times. The headers shown above the trait tree in the MIO menu. "x" represents how far to the right it is placed with "0" being at the left border and "9" being as right as it goes. Text can be a localization key or the straight label. | tree_header_text = { text = my_flavor_text_loc_key x = 1 } |
initial_trait | true | The initial trait the MIO has without having to invest anything into it. | See "Trait Layout" |
trait | true | Can be repeated any number of times. The individual traits of the MIO that can be unlocked. | See "Trait Layout" |
Trait Layout
trait = { token = upgrade_1 # mandatory name = loc_key # optional icon = GFX_key # optional special_trait_background = yes # optional - default no parent = { traits = { parent traits } num_parents_needed = X } any_parent = { parent traits } all_parents = { parent traits} mutually_exclusive= { upgrade4 } position = { x=1 y=0 } relative_position_id = trait_token visible = <condition> available = <condition> on_complete = <event> limit_to_equipment_type = { ... } # optional equipment_bonus = <boni> production_bonus = <boni> organization_modifier = <boni> ai_will_do = <modifier> # optional }
Designing a trait
As we can see from the layout, designing a trait comes to a few key steps:
- Metadata
- Conditions
- Placement and relationship with other traits
- Boni granted
- AI (usually omitted)
From a metadata perspective, the "token" is a unique name within the current MIO. You can keep it simple without worrying about conflicts with other MIOs. A nice icon helps visually distinguish your trait. The easiest way to figure that one out is to search in "00_generic_organization.txt" for a trait that offers the same kind of boni as yours does and copy it from there. The name is if you want to select a custom localization key (by default it's "<mio_name>_<trait_token>").
Conditions are great to tie an MIO into the Focus tree of a nation. Use "available" for generic unlock conditions, while "visible" is great if the MIO is available in different situations. While for full TAG-based deltas, we would usually prefer going with a Delta MIO, consider the civil war situation in Spain, where you want to just replace one trait with another, depending on just which of the rebel factions - just define multiple traits on the same coordinates and switch between visibility.
Placement and relationship is where things easily get most complex. Fundamentally, you have a placement board of 10 slots wide and 5 high (you can go deeper, but then users have to scroll). This makes X go from 0 to 9 and y from 0 to 4. The parent settings determine the tree structure of your MIO. No parents means the trait can be picked right away - consider placing them at the top of your tree (y = 0) and build down from there. "any_parent" offers "any one among these" kind of parent logic, "all_parents" offers "every single one of them" kind of dependencies. The rarely seen plain "parent" node allows "at least X out of these" kinds of dependencies. Mutual exclusion, finally, is great for making the player pick between two or more options, where they can't just grab all of them. Be sure to place this condition on all traits in the mutual exclusion set, otherwise the player can first pick the trait with the exclusion and then afterwards the other one.
Boni granted - a list of those below in the Appendix - allow you to define the actual benefits (and trade-offs) the trait grants. These fall into three categories:
- Equipment: Effects that modify the equipment produced. This is what makes your tanks tougher, your ships faster and your fighters dodgier.
- Production: Effects that make production faster or cheaper, the line efficiency grow faster or to greater heights or conversion of equipment swifter.
- Organization: Effects that modify the MIO: Support more lines, greater research boni, faster growth, cheaper to assign, etc.
Finally, there's the AI, but best do not touch that unless you really want to. Trait prioritization is best handled through how the AI weighs boni (see chapter below on how to mod that).
Initial Trait
The initial trait you assign to a MIO differs in a few aspects:
- It has no position on the board
- It has no icon
- There is no decision to be made
In other words, most of the trait properties are not relevant to the initial trait. In fact, all properties are optional, but only these five matter at all:
- name: Localization key, overrides the default "<mio name>_initial_trait" key.
- limit_to_equipment_type: Narrows the equipment bonus of the initial trait to just a sub-set of its equipment types
- equipment_bonus: Boni granted to equipment
- production_bonus: Boni granted to the production of the related equipment
- organization_bonus: Boni granted to the MIO itself
Trait Properties Explained
Key | Mandatory? | Description | Example |
---|---|---|---|
token | true | System name of the trait. Must be provided, can be simple | token = gunnery_1 |
name | false | Localization key, overwriting the default key of "<mio name>_<trait token>". If defined, the system will prioritize "<tag>_<trait name>" over "<trait name>" | name = my_MIO_gunnery_1_Name |
icon | false | Icon to use for your trait. Defaults to GFX_idea_unknown. Check the icons other traits with the same boni use. | icon = GFX_generic_mio_trait_icon_hg_attack |
special_trait_background | false | If yes, trait background will be golden to indicate an interesting trait. Defaults to "no". | special_trait_background = yes |
parent | false | Provide a custom trait dependency link. This allows setting conditions such as "Have at least 2 out of these traits." See "any_parent" or "all_parents" for simpler dependencies | parent = { traits = { gunnery_1 stealth_1 mines_1 } num_parents_needed = 2 } |
any_parent | false | Any one of the listed traits must already have been selected. | any_parent = { gunnery_1 stealth_1 } |
all_parents | false | Every single one of the listed traits must already have been selected. | all_parents = { gunnery_1 stealth_1 } |
mutually_exclusive | false | Have multiple traits exclude each other. Must be defined in each of the traits to work as expected. | mutually_exclusive = { heavy_guns_specialization } |
position | true | Where on the board to place the trait. (x = 0 y = 0) is the upper-left corner, (x = 9 y = 4) is the lower right. It is possible (but not recommended) to go lower by using an y value greater than 4, but that requires the player to scroll and is not recommended. | position = { x = 0 y = 0 } |
relative_position_id | false | By providing this setting, turn the "position"-provided coordinates into coordinates relative to the listed trait. "position = { x=0 y=1 }" would then become "directly beneath the parent trait" | relative_position_id = gunnery_1 |
visible | false | Whether the trait is shown on the MIO traits menu. The condition executes in the current MIO's scope, the country is available in the FROM scope. | visible = { FROM = { has_country_flag = <flag name> } } |
available | false | Whether the trait is available (or greyed out). Useful for tying MIOs into the Focus Tree. The condition executes in the current MIO's scope, the country is available in the FROM scope. | available = { FROM = { has_completed_focus = <focus name> } } |
on_complete | false | Event that happens when the player selects the trait. Again, a way to integrate the MIO into the narrative of the country. The event executes in the current MIO's scope, the country is available in the FROM scope. | on_complete = { FROM = { set_country_flag = <flag name> } } |
limit_to_equipment_type | false | By default, Equipment and Production boni apply to all equipment types supported by the MIO. This condition allows you to narrow it down to a smaller subset. Useful for specialization traits. | limit_to_equipment_type = { mio_cat_eq_all_light_tank } |
equipment_bonus | false | Actual improvements applied to all produced equipment the MIO applies to (unless further constrained through limit_to_equipment_type) | equipment_bonus = { armor_value = -0.05 defense =-0.05 build_cost_ic = -0.03 } |
production_bonus | false | Improvements applied to the production lines, such as accelerated efficiency gains, greater output or improved conversion rates. | production_bonus = { production_efficiency_gain_factor = 0.15 production_resource_need_factor = -0.15 } |
organization_modifier | false | Boni granted to the MIO itself, such as cheaper assignment, improved research boni or increased task limit. | organization_modifier = { military_industrial_organization_research_bonus = 0.05 } |
ai_will_do | false | Override the default prioritization weights the AI would usually apply to this trait, based on the boni given. Usually not recommended. | ai_will_do = { base = 2 modifier = { factor = 1.5 date > 1937.1.1 } } |
Delta MIO
TODO: Write
Policies
Key | Mandatory? | Description | Example |
---|---|---|---|
name | false | Policy name. May use scripted localization, scope will be set with the country owning the policy. |
name = loc_key |
icon | false | Icon to use for your policy. | icon = GFX_mio_policy_my_policy |
cost | false | Attach cost in political power. Default is define DEFAULT INITIAL POLICY ATTACH COST " NDefines.NIndustrialOrganisation.DEFAULT_INITIAL_POLICY_ATTACH_COST = 25 ". |
cost = 10 |
cooldown | false | Cooldown in days after attaching a policy. Default is define DEFAULT INITIAL ATTACH POLICY COOLDOWN " NDefines.NIndustrialOrganisation.DEFAULT_INITIAL_ATTACH_POLICY_COOLDOWN = 180 ". |
cooldown = 60 |
allowed | true | Evaluated when starting the game. If trigger returns false, the policy will never be considered later in-game. |
allowed = { OR = { has_mio_equipment_type = motorized has_mio_equipment_type = mechanized } } |
visible | false | Evaluated when displaying the policy screen. Default is "always = yes". |
visible = { has_mio_size > 3 } |
available | false | Evaluated when displaying the policy screen. Default is "always = yes". |
available = { has_mio_size > 5} |
equipment_bonus | false | Defines the bonus given when the policy is attached and the MIO is assigned to an equipment variant. Note: it's different from equipment_bonus in traits. Here you have to give the equipment group/category/archetype/type. |
equipment_bonus = { infantry_equipment = { soft_attack = 0.1 } } |
production_bonus | false | Defines the bonus given when the policy is attached and the MIO is assigned to a production line. Note: it's different from production_bonus in traits. Here you have to give the equipment group/category/archetype/type. |
production_bonus = { infantry_equipment = { production_cost_factor = -0.1 } } |
organization_modifier | false | Defines modifiers that will apply on the MIOs. | organization_modifier = { military_industrial_organization_research_bonus = 0.1 } |
on_add | false | Effects executed when the policy is attached. | on_add = { ... } |
on_remove | false | Effects executed when the policy is un-attached. | on_remove = { ... } |
ai_will_do | false | AI weight modifier for this policy. Note: this affects how likely AI is to spend PP on this policy. |
ai_will_do = { ... } |
AI Bonus Weights
TODO: Write
Appendix: Boni
Equipment Boni
TODO: Write
Production Boni
All production boni apply to the production lines the MIO has been attached to.
Key | Description | Example |
---|---|---|
production_cost_factor | Reduces the production cost. | production_cost_factor = 0.05 |
production_capacity_factor | Increases the production output, accelerating the # items produced per day. | production_capacity_factor = 0.1 |
production_efficiency_cap_factor | Increase the maximum production efficiency. Keep in mind, ships don't have that ... | production_efficiency_cap_factor = 0.2 |
production_efficiency_gain_factor | Increase the rate, at which the production efficiency increases. Keep in mind, ships don't have that ... | production_efficiency_gain_factor = 0.24 |
production_resource_need_factor | Change the amount of raw resources (Iron, Tungsten, Chromium, ...) needed. | production_resource_need_factor = -0.1 |
production_resource_penalty_factor | Modify the penalty the production line suffers from not having enough resources. | production_resource_penalty_factor = -0.1 |
production_conversion_speed_factor | Change the speed, at which equipment conversions are performed. | production_conversion_speed_factor = 0.5 |
Organization Boni
Organization Boni apply to the MIO globally and not to a specific equipment line / product. As such they cannot be constrained.
Key | Description | Example |
---|---|---|
military_industrial_organization_research_bonus | A flat increase to the research bonus percentage applied by the MIO. If previously it gave 20% bonus and receives a "0.1" bonus here, it will then give a 30% bonus to research. | military_industrial_organization_research_bonus = 0.1 |
military_industrial_organization_design_team_assign_cost | Modifier over how much it costs to assign an MIO in the Tank/Aircraft/Ship designer. | military_industrial_organization_design_team_assign_cost = -0.2 |
military_industrial_organization_design_team_change_cost | Modifier over how much it costs to pull the latest changes from an already assigned MIO for a given Tank/Aircraft/Ship design. | military_industrial_organization_design_team_change_cost = -0.1 |
military_industrial_organization_industrial_manufacturer_assign_cost | How much does it cost to assign a MIO to an industrial (that is non-designer) production line. | military_industrial_organization_industrial_manufacturer_assign_cost = -0.2 |
military_industrial_organization_task_capacity | Flat increase to the number of tasks an MOI can be assigned to in parallel. | military_industrial_organization_task_capacity = 5 |
military_industrial_organization_size_up_requirement | Modifies the funds it takes to level up an MIO, effectively accelerating the rate at which you unlock traits. Consider applying this if you design a MIO with an above-average number of traits. | military_industrial_organization_size_up_requirement = -0.1 |
military_industrial_organization_funds_gain | Modifies the rate at which funds are obtained, which are then used to level the MIO and unlock molre traits. Another lever to increase the levelling rate of an MIO. | military_industrial_organization_funds_gain = 0.2 |
References
文件 | 效果 • 条件 • 定义 • 修正 • 修正列表 • 作用域 • 本地化 • on action • 数据结构 (标记, 临时标记, 国家别名, 变量, 数组) |
脚本 | 成就修改 • AI修改 • AI focuses • 自治领修改 • 权力平衡修改 • 剧本/标签 (游戏规则)• 建筑修改 • 人物修改 • 修饰性TAG修改 • 国家创建 • 军队修改 • 决议制作 • 装备修改 • 事件修改 • Idea修改 • 意识形态修改 • 军工商修改 • 国策制作 • 资源修改 • Scripted GUI • 科技制作 • 单位修改 |
地图 | 地图 • 省份 • 补给区域 • 战略区域 |
图形图像 | 界面 • 图形资产 • 实体模型 • 后期特效 • 离子效果 • 字体 |
装饰性 | 肖像 • 命名列表 • 音乐 • 音效 |
其他 | 控制台指令 • 故障排除 • 模组结构 • 成就代码分析 • Mod相关 • Nudger修改 |