Equipment模组制作
原页面:Equipment modding
装备
装备位于/Hearts of Iron IV/common/units/equipment/*.txt。装备分为两种类型:原型与常规。原型装备用于赋予更通用的属性,常规装备随后通过archetype属性继承这些属性。
原型装备遵循以下格式:
equipments = {
<equipment> = {
year = <int> # Limits the equipment from appearing before the specified year. Optional
picture = <name> # GFX reference used to define equipment picture in lend-lease
priority = <value> # ?
archetype = <equipment archetype name> - archetype of equipment, mutually exclusive with is_archetype = yes
parent = <equipment type name> - previous version of equipment, can't be archetype
can_be_produced = { # Optional, specifies when equipment of this category can be produced.
<triggers>
}
can_be_lend_leased = {
# a trigger to check if a country can lend lease to another country. scope is country, from is the country we will lend lease to
}
is_archetype = yes # Specifies an entry as an archetype entry. All non-archetype entries inherit
is_buildable = no # Prevents this equipment from being built.
active = yes # Determines if this equipment is available without unlocking from a technology.
type = <type> # Internal type: what kind of unit can use this equipment
is_frame = <yes|no> # Default yes for modular equipment, not applicable for non-modular equipment. Frame refers to tank chassis, ship hulls, and airplane frames.
group_by = <group> # How the equipment is grouped in the production screen
interface_category = <type> # Which category the equipment appears in the production screen
max_military_factories = <amount>/max_dockyard_factories = <amount> # Limit the amount of military factories or dockyards assignable to the type
module_slots = {
# List of module slots and their details
# Fixed slots will be grouped together in the equipment designer window, and always start with "fixed_". They represent slots that are used for a single purpose or related purposes.
fixed_<slot name> = {
required = <yes|no>
allowed_module_categories = {
# List of module category names
}
}
# Custom slots will be grouped together in the equipment designer window, and cannot start with "fixed_". They represent slots that can be used for a lot of different purposes.
<custom slot name> = {
required = <yes|no>
allowed_module_categories = {
# List of module category names
}
}
<slot name> = <earlier slot name> # A later slot can inherit the exact same attributes from an earlier slot.
<slot name> = inherit # A slot can inherit the exact same attributes from the parent equipment type.
}
module_slots = inherit # alternative way to setup modules, equipment will use same modules as parent
# Any number of module count limits can be specified.They are automatically inherited by child equipment types.
module_count_limit = {
# Match conditions: A module or slot only needs to match one of the specified conditions for the limit to apply.
module = <module name> # Match a specific module.
category = <module category name> # Match any module belonging to a category.
module = any # Match any module.
category = any # Match any module.
module = empty # Match an empty module slot.
# Specify the upper limit on the number of matching modules.
count < <number>
# -or- Specify the lower limit on the number of matching modules.
count > <number>
# -or- Specify the exact requirement on the number of matching modules.
count = <number>
# -or- Allow any number of matching modules. Useful for overriding limits inherited from parent equipment type.
count = any
# Optional override of the limitation title used in tool tips.
# If not specified, the single module, category, any, or empty configuration will be used if possible.
title = <text or localization key>
# An inherited limit is overridden if the child has a limit with exactly the same match conditions.
}
# Resources used to build this equipment
resources = {
<resource> = <amount>
}
upgrades = {
# List of upgrade names
} # Upgrades of equipment, mostly used for non equipment designer versions of equipment
# Modifiers the equipment uses
<unit stat name> = <value>
manpower = <value> # Manpower required to produce one unit of the equipment (naval only)
}
}
常规装备遵循以下格式:
equipments = {
<equipment> = {
year = <int> # Limits the equipment from appearing before the specified year. Optional
active = yes # Determines if this equipment is available without unlocking from a technology.
archetype = <equipment> # Which archetype equipment this equipment inherits from.
parent = <equipment> # Which equipment is parent to this equipment (i.e. which does it supercede)
priority = <int> # Priority for usage over other equipment.
visual_level = <int> # Image priority in production screen
# Resources used to build this equipment
resources = {
<resource> = <amount>
}
# Modifiers the equipment uses
<modifiers>
}
}
内部类型
陆军
- anti_air
- anti_tank
- 装甲
- 火炮
- heavy_tank_chassis
- 步兵
- light_tank_chassis
- mechanized
- medium_tank_chassis
- motorized
- rocket
- support_equipment
- capital_ship
- carrier
- convoy
- naval_transport
- screen_ship
- 潜艇
空军
- air_transport
- cas
- fighter
- interceptor
- tactical_bomber
- missile
- naval_bomber
- strat_bomber
- suicide
分组类型
- archetype
- type
界面分类
- interface_category_land
- interface_category_armor
- interface_category_capital_ships
- interface_category_screen_ships
- interface_category_other_ships
- interface_category_air
装备设计商
在全民持枪一步不退与唯有鲜血中加入的装备设计器,是用不同模块设计装备的界面,允许改变装备类型或仅为其添加额外属性。
任何使用模块的装备都必须设置装备设计器;如果未提供装备设计器,它将改为使用升级系统/
游戏中的装备设计器可在 interface/equipmentdesigner/type 中找到,其中 type 为 tanks/ships/planes。文件名无关紧要。装备的链接方式不同。
要把设计器连接到装备,你需要用以下 4 种类型之一来命名 containerWindowType:
「equipment_designer_」EQUIPMENT_TYPE「_」COUNTRY_TAG - 用于为特定标签与特定装备指定装备设计器
「equipment_designer_」EQUIPMENT_ARCHETYPE「_」COUNTRY_TAG - 用于为特定标签与特定装备原型指定装备设计器
「equipment_designer_」EQUIPMENT_TYPE - 用于为装备指定设计器
「equipment_designer_」EQUIPMENT_ARCHETYPE - 用于为装备原型指定装备设计器
在这些针对某件特定装备的装备设计器窗口内,有一个名为「module_slots」的内部容器窗口。任何使用此设计器窗口的装备所可能拥有的每个模块槽,都应在其中拥有自己的容器窗口,并使用与该模块槽相同的名称。
在模块槽容器窗口内部,应列出更多容器窗口,对应于可安装在该模块槽中的各个模块。在这些窗口内,你可以包含 iconType 元素,或任何其他适合用于在该槽位的装备上显示相关模块的元素
如前所述,新系统允许创建特殊类型的装备(例如反坦克坦克或防空坦克),要做到这一点,你需要一个允许该类型的模块,该类型必须存在于 script_enums 中,并且必须至少有一个营使用它。
要创建装备变体,你需要使用以下代码:
<equipment_archetype>_my_variant = {
archetype = <equipment_archetype>
type = { innitial_type anti_air }
for_each = {
variant_name = { find_and_replace = { "chassis" "equipment" } } # 可选,通过取出本应作为本地化键使用的名称(即该类型的名称)并对其执行查找替换来设置 variant_name。例如:light_tank_aa_chassis_1 得到 variant_name light_tank_aa_equipment_1。
hardness = { set = 0.5 } # additional stats new type of equipment would get
}
}
所有新变体都必须存在于 script_enums 中,因此如果你复制一个装备原型并带有 5 个装备变体,你必须在 scripted_enums 中把全部变体都写明(例如 <equipment_archetype>_my_variant、<equipment_archetype>_my_variant_0、<equipment_archetype>_my_variant_1……)
Stats
装备使用修正来决定它向其配属单位提供哪些属性。
通常一件装备会包含以下内容:
build_cost_ic = <float> lend_lease_cost = <float> reliability = <float> maximum_speed = <float> defense = <float> breakthrough = <float> hardness = <float> armor_value = <float> soft_attack = <float> hard_attack = <float> ap_attack = <float> air_attack = <float>
请注意默认maximum_speed为 4,因此当你希望装备提供默认maximum_speed时无需包含它
修正项
以下列表是可用于装备(以及单位)的全部有效修正:
All
lend_lease_cost = 1 # Space taken up in convoy build_cost_ic = 0.4 # Production Cost - How much factory output this piece of equipment needs manpower = 300 # Manpower - Cost in manpower to produce can_license = no # Can be licensed is_convertable = yes # Can be converted
陆军
基础
reliability = 0.9 # Reliability - The lower the reliability, the more likely the equipment will suffer random failure maximum_speed = 4 # Max Speed - How quickly this unit can traverse terrain under optimal circumtances, in kilometres per hour
Offensive
# Offensive soft_attack = -0.1 # Soft Attack - How many attacks the unit can make versus enemies with low hardness hard_attack = -0.5 # Hard Attack - How many attacks the unit can make versus enemies with high hardness air_attack = 1 # Air Attack - How much damage we can do against airplanes. High Air Attack also helps to counter enemy Air Superiority effects ap_attack = 1 # Piercing - Having equal or greater Piercing to the targets Armor value allows you to do more damage. breakthrough = 0.5 # Breakthrough - How many enemy attacks a unit can attempt to avoid while on the offensive, effectively allowing it to stay on the offense longer.
Defensive
# Defensive defense = 0.1 # Defense - How many enemy attacks a unit can avoid whilst on the defensive, effectively allowing it to stay on the defensive longer. max_strength = 2 # HP - Strength represents how much damage this unit can suffer before it is destroyed armor_value = 0 # Armor - Armor that is higher than the opponents Piercing value reduces damage taken and allows more attacks to occur hardness = 0.5 # Hardness - Represents how much of your divsion is made up of armoured vehicles. High Hardness = High Hard Attacks, Low Soft Attack entrenchment = 5 # Entrenchment - The ability to make proper defensive entrenchments before a hostile attack
Unique
recon = 1 # Reconnaissance - Increases the chance that this unit can pick better tactics in battle
naval_speed = 28 # Max Speed - maximum speed in kilometres per hour of the ship, higher means faster in combat and contributes to evasion fire_range = 32 # Fire Range - The range of the ship's main guns (OBSOLETE) lg_armor_piercing = 12 # Light gun armor piercing - Determines how much armor ship's light gun attack can pierce lg_attack = 18 # Light gun attack - How much damage the ship does with light guns (more effective against screens) hg_armor_piercing = 25 # Heavy gun armor piercing - Determines how much armor ship's heavy gun attack can pierce hg_attack = 12 # Heavy gun attack - How much damage the ship does with heavy guns (more effective against capitals and carriers) torpedo_attack = 1 # Torpedo attack - How much damage we can do when using the ship's torpedos (more effective against capitals and carriers) anti_air_attack = 5 # Anti-air - How much anti-air firepower the ship carries for shooting down enemy planes shore_bombardment = 8 # Shore Bombard - Ship's ability to help out in land battles neighbouring its sea province when on Hold mission (OBSOLETE, lg_attack and hg_attack determine shore bombardment) evasion = 15 # Evasion - Ship's ability to evade enemy fire through maneuvering. (OBSOLETE, naval_speed contributes to evasion instead) surface_detection = 12 # Surface detection - Ability to detect surface vessels sub_attack = 10 # Anti-submarine attack - How much damage this ship deals to enemy submarines using depth charges sub_detection = 5 # Sub detection - Ability to detect submarines surface_visibility = 25 # Surface Visibility - How easy to find this ship is (lower is better) sub_visibility = 20 # Sub Visibility - How easy it is to detect this submarine (lower is better) naval_range = 3000 # Naval Range - max distance in kilometres the ship can travel from it's nearest Naval Base port_capacity_usage = 1 # Port capacity usage - How much room the ship requires in port search_and_destroy_coordination = 0.1 convoy_raiding_coordination = 0.1
Air-specific
air_attack = 50 # Air Attack - amount of damage done against other planes air_defence = 50 # Air Defence - how many hits a plane takes before being shot down air_range = 500 # Range - How far away missions the plane can perform air_agility = 10 # Agility - How agile a plane is. Agility effects how easy it is to hit another plane, and avoid being hit air_ground_attack = 100 # Ground Attack - damage done to ground forces during CAS missions air_bombing = 300 # Strategic Bombing - how good the plane is at bombing air_superiority = 1 # Air Superiority - How much the plane helps the overall air superiority of a strategic area naval_strike_attack = 1.5 # Naval Attack - how much damage the plane does against ships naval_strike_targetting = 0.5 # Naval Targeting - how likely the plane is to hit a ship carrier_size = 0.05 default_carrier_composition_weight = 1 carrier_capable = yes # Is usable in carriers (air only)
Localization
每件装备都必须在你的模组中.yml文件夹内的本地化文件中进行本地化。
<equipment>: "" <equipment>_desc: "" <equipment>_short: ""
针对特定国家的本地化,需以标签作为前缀:
<tag>_<equipment>: "" <tag>_<equipment>_desc: "" <tag>_<equipment>_short: ""
| 文档 | 效果 • 触发器 • 定义文件 • 修正项 • 修正项列表 • 作用域 • 本地化文件 • 事件钩子 • 数据结构(标记、事件目标、国家标签别名、变量、数组) |
| 脚本 | 成就 • AI • AI 焦点 • 自治领 • 力量均势 • 书签/剧本 (游戏规则) • 建筑 • 角色与特质 • 外观标签 • 国家 • 师 • 决议 • 学说 • 装备 • 事件 • 阵营 • 理念 • 意识形态 • 军事工业组织 • 国策 • 资源 • 脚本化 GUI • 科技与学说 • 单位 |
| 地图 | 地图 • 州 • 补给区域 • 战略区域 |
| 图形 | 界面 • 图形资源 • 实体 • 后期特效 • 粒子 • 字体 |
| 外观 | 肖像 • 名称列表 • 音乐 • 音效 |
| 其他 | 控制台指令 • 疑难排查 • 模组结构 • 模组 • 地图编辑器 |