小 (文本替换 - 替换“[[Category:”为“[[分类:”) |
ExponentManx15(讨论 | 贡献) 小 (汉化了一小部分) |
||
第1行: | 第1行: | ||
{{version|1.5}} | {{version|1.5}} | ||
== | == 科技 == | ||
{{SVersion|1.5}} | {{SVersion|1.5}} | ||
有两个相关的科技文件夹, {{path|common/technologies}}, 其中包含实际的科技树和{{path|common/technology_tags}}, 其中包含分配给科技的类别。 | |||
科技的通用格式如下:<pre> | |||
<pre> | |||
technologies = { | technologies = { | ||
<technology> = { | <technology> = { | ||
# | # 这里可以使用任何国家级别的修饰符。 | ||
<modifier> | <modifier> | ||
doctrine = yes # | doctrine = yes # 把这项技术看作是一项学说科技。 | ||
research_cost = <float> # | research_cost = <float> # 时间成本,其中1是默认的研究时间长度。 | ||
start_year = <year> # | start_year = <year> # 这项科技在哪一年停止超前惩罚。 | ||
# | # 科技完成的效果 | ||
on_research_complete = { | on_research_complete = { | ||
<effects> | <effects> | ||
} | } | ||
show_effect_as_desc = yes # | show_effect_as_desc = yes # 在描述中显示效果。 | ||
# | # 改变单位属性和子属性 | ||
<unit> = { | <unit> = { | ||
<attribute> = <value> # | <attribute> = <value> # 必需的! | ||
<terrain> = { | <terrain> = { | ||
第32行: | 第31行: | ||
} | } | ||
# | # 更改类别的单位属性 | ||
<category> = { | <category> = { | ||
<attribute> <value> | <attribute> <value> | ||
} | } | ||
# | # 启用子单元 | ||
enable_subunits = { | enable_subunits = { | ||
<unit> | <unit> | ||
} | } | ||
# | # 启用装备。 | ||
enable_equipments = { | enable_equipments = { | ||
<equipment name> | <equipment name> | ||
第48行: | 第47行: | ||
show_equipment_icon = yes # Show the equipment icon that is unlocked | show_equipment_icon = yes # Show the equipment icon that is unlocked | ||
# | # 启用建筑 | ||
enable_building = { | enable_building = { | ||
building = <name> | building = <name> | ||
第54行: | 第53行: | ||
} | } | ||
# | # 链接角落里的科技。用于基础科技的变体科技 | ||
sub_technologies = { | sub_technologies = { | ||
<technology> | <technology> | ||
} | } | ||
# | # 采用该科技的科技依赖(而不是以前的科技) | ||
dependencies = { | dependencies = { | ||
<technology> = 1 | <technology> = 1 | ||
第260行: | 第259行: | ||
</pre> | </pre> | ||
== | == 科技文件夹 == | ||
{{SVersion|1.5}} | {{SVersion|1.5}} | ||
科技文件夹通常是科技制作中最令人困惑的地方,它在{{path|interface/countrytechtreeview.gui}} 和{{path|interface/countrytechtreeview.gfx}}. | |||
=== Adding the Folder Tab === | === Adding the Folder Tab === |
2023年11月5日 (日) 11:55的版本
科技
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.5。 |
有两个相关的科技文件夹, /Hearts of Iron IV/common/technologies, 其中包含实际的科技树和/Hearts of Iron IV/common/technology_tags, 其中包含分配给科技的类别。
科技的通用格式如下:
technologies = { <technology> = { # 这里可以使用任何国家级别的修饰符。 <modifier> doctrine = yes # 把这项技术看作是一项学说科技。 research_cost = <float> # 时间成本,其中1是默认的研究时间长度。 start_year = <year> # 这项科技在哪一年停止超前惩罚。 # 科技完成的效果 on_research_complete = { <effects> } show_effect_as_desc = yes #在描述中显示效果。 #改变单位属性和子属性 <unit> = { <attribute> = <value> #必需的! <terrain> = { <attribute> <value> } } #更改类别的单位属性 <category> = { <attribute> <value> } #启用子单元 enable_subunits = { <unit> } #启用装备。 enable_equipments = { <equipment name> } show_equipment_icon = yes # Show the equipment icon that is unlocked # 启用建筑 enable_building = { building = <name> level = 1 } # 链接角落里的科技。用于基础科技的变体科技 sub_technologies = { <technology> } # 采用该科技的科技依赖(而不是以前的科技) dependencies = { <technology> = 1 } # Limits technology visibility if trigger is false. Used for DLC checks. Used for focus-only technologies. Used for modding nation-specific technologies. allow = { <triggers> } # Limits technology (and linked technologies) visibility if trigger is false. Used for DLC checks. Used for modding nation-specific technologies. allow_branch = { <triggers> } # Multiple allowed. Controls the links between technologies. path = { leads_to_tech = <technology> research_cost_coeff = <float> } # Used to either-or with other technologies. XOR = { <technology> } # Controls which folder (tab) the technology appears under. folder = { name = <folder name> # Found in countrytechtreeview.gui # Position in the tech tree interface position = { x = 0 y = 0 } } # Which technology categories apply to this technology. categories = { <categories> } # Weighting for the AI to pick the technology ai_will_do = { factor = <float> # Conditional modifier to the factor. modifier = { factor = <float> <triggers> } } # Adjusts weighting depending on taken technology (uses technology tags) ai_research_weights = { <type> = <float> } } }
Effects
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.5。 |
on_research_complete is used to execute effects upon the completion of a taken technology. This is often used to add divisions of a new subunit or to display custom tooltips.
Here is an example of adding a new division:
on_research_complete = { limit = { NOT = { has_template_containing_unit = light_armor } NOT = { has_template_containing_unit = heavy_armor } NOT = { has_template_containing_unit = medium_armor } } hidden_effect = { if = { limit = { has_tech = motorised_infantry } load_oob = "unlock_tanks_mot" } if = { limit = { NOT = { has_tech = motorised_infantry } } load_oob = "unlock_tanks" } } custom_effect_tooltip = UNLOCK_DIVISION_TEMPLATE }
Equipment
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.5。 |
To enable new equipment, you need to use enable_equipments. Here is an example:
enable_equipments = { infantry_equipment_0 }
Units
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.5。 |
To enable new subunits, you need to use enable_subunits. Here is an example:
enable_subunits = { infantry }
To modify unit attributes, you need to either scope to a unit category like so:
category_all_infantry = { hard_attack = 0.25 ap_attack = 1 }
Or scope to the exact unit:
cavalry = { soft_attack = 0.05 }
Buildings
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
To enable new buildings, you need to use enable_building. Here is an example:
enable_building = { building = radar_station level = 1 }
Sub-technologies
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.5。 |
To add sub-technologies to a technology, you need to include sub_technologies in the technology you want them to appear on. Here is an example:
sub_technologies = { motorized_rocket_unit }
Can only be added to equipment technologies.
UI
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.5。 |
Technologies appear within technology folders (or tabs). The folder scope is used to place technology within a specified folder. A technology can be present in multiple folder by including multiple folder scopes, like so:
folder = { name = infantry_folder position = { x = 0 y = 4 } } folder = { name = support_folder position = { x = 7 y = 9 } }
The position of the technology is defined by the position scope within a folder scope. The x co-ordinate controls the vertical position, and the y co-ordinate controls the horizontal position.
Typically, you will want to increase the x co-ordinate by 2 to place technology a unit lower, likewise with the y co-ordinate.
Technology Icons
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.5。 |
The icon used for a technology must be defined in a .gfx file, such as /Hearts of Iron IV/interface/Technologies.gfx.
The format for a icon definition is:
spriteType = { name = "GFX_<technology>_medium" texturefile = "gfx/interface/technologies/<image>.dds" }
For tag-specific icons:
spriteType = { name = "GFX_<tag>_<technology>_medium" texturefile = "gfx/interface/technologies/<image>.dds" }
科技文件夹
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.5。 |
科技文件夹通常是科技制作中最令人困惑的地方,它在/Hearts of Iron IV/interface/countrytechtreeview.gui和/Hearts of Iron IV/interface/countrytechtreeview.gfx.
Adding the Folder Tab
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.5。 |
To add a new folder tab, you need to start by going to the folder_tabs windowtype in countrytechtreeview.gui and adding a new button and icon for your folder.
containerWindowType = { name = "folder_tabs" position = { x=0 y=7 } size = { width = 100%% height = 30 } # Required for the folder to appear. buttonType = { name = "<folder>_tab" position = { x = 22 y = 0 } # Used to place the tab button quadTextureSprite = "GFX_<folder>_tab" # Controls the tab active and inactive images frame = 1 clicksound = click_default } # ... other folders ... }
The GFX_<folder>_tab here would be added to a .gfx file:
spriteType = { name = "GFX_<folder>_tab" textureFile = "gfx//interface//techtree//techtree_infantry_tab.dds" noOfFrames = 2 }
This adds the folder tab button.
Adding the Folder
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.5。 |
To add a new folder, you need to start by going to the countrytechtreeview windowtype in countrytechtreeview.gui and adding a new containerWindowType for your folder.
containerWindowType = { name = "countrytechtreeview" position = { x=-3 y=78 } size = { width = 100%% height = 100%% } fade_time = 400 fade_type = linear # ... containerWindowType = { name = "<folder>" # Name you added to technology_folders position = { x=0 y=47 } size = { width = 100%% height = 100%% } margin = { top = 13 left = 13 bottom = 24 right = 25} drag_scroll = { left middle } verticalScrollbar = "right_vertical_slider" horizontalScrollbar = "bottom_horizontal_slider" background = { name = "Background" quadTextureSprite ="GFX_tiled_window_2b_border" } # Controls the graphical elements, such as the dates and the faded image background. containerWindowType = { name = "techtree_stripes" position = { x= 0 y= 0 } size = { width = 1400 height = 1275 min = { width = 100%% height = 100%% } } clipping = no # This is the background you see in the technology folders. # Make sure the actual image is less than 100% alpha, so it fades into the regular background. iconType = { name ="<folder>_techtree_bg" spriteType = "GFX_infantry_techtree_bg" position = { x=0 y=0 } alwaystransparent = yes } # All the other elements are optional, refer to the actual file for details. } # These display the technology trees. # Each tree must start the the initial technology that starts the tree. # i.e. support_weapons_tree will display ALL technologies that are linked to the initial support_weapons technology. # You only need to specific the INITIAL (i.e. TOP) technologies for each tree. gridboxtype = { name = "<technology>_tree" position = { x = 140 y = 210 } slotsize = { width = 70 height = 70 } format = "LEFT" } # Add as many gridboxtype's as you have initial technologies. } }
To further detail the gridboxtype, consider the Infantry Weapons technologies. The technology tree for them is as follows:
- infantry_weapons
- infantry_weapons1
- infantry_weapons2
- improved_infantry_weapons
- improved_infantry_weapons_2 and infantry_at
- advanced_infantry_weapons
- advanced_infantry_weapons2
- infantry_at
- infantry_at2
To display this tree, you just need to add a gridbox with the name infantry_weapons_tree.
Adding the Technology Items
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.5。 |
Each folder has it's own definition for each technology icon type. It is these that create the different type of technology "look and feel" between say the Infantry and Air Doctrine technologies.
There are two items:
- techtree_<folder>_small_item: used for the non-equipment technologies.
- techtree_<folder>_item: used for the equipment technologies.
Small Item
Used for non-equipment technologies.
containerWindowType = { name = "techtree_<folder>_small_item" position = { x=0 y=0 } size = { width = 72 height = 72 } clipping = no # This controls the unavailable icon for the non-equipment technology background = { name = "bg" quadTextureSprite ="GFX_technology_unavailable_item_bg" } # This grabs the GFX_<technology>_medium for the technology dynamically iconType = { name = "Icon" position = { x=3 y=3 } spriteType = "GFX_technology_medium" alwaystransparent = yes } iconType = { name = "bonus_icon" position = { x=3 y=-22 } spriteType = "GFX_tech_bonus" } instantTextBoxType = { name = "bonus" position = { x = 17 y = -22 } textureFile = "" font = "hoi_16mbs" borderSize = {x = 4 y = 4} text = "lol boat" maxWidth = 50 maxHeight = 20 format = right } }
Item
Used for equipment technologies, and sub-equipment technologies.
containerWindowType = { name = "techtree_<folder>_item" position = { x=-56 y=-7 } size = { width = 183 height = 84 } clipping = no # This controls the unavailable icon for the equipment technology background = { name = "Background" quadTextureSprite ="GFX_technology_unavailable_item_bg" } # This grabs the GFX_<technology>_medium for the technology dynamically iconType = { name = "Icon" position = { x=91 y=50 } spriteType = "GFX_technology_medium" centerposition = yes alwaystransparent = yes } instantTextBoxType = { name = "Name" position = { x = 3 y = -3 } textureFile = "" font = "hoi_20bs" borderSize = {x = 4 y = 4} text = "Happy-Go-Lucky-Tank" maxWidth = 160 maxHeight = 20 fixedsize = yes format = left } iconType = { name = "bonus_icon" position = { x=115 y=-22 } spriteType = "GFX_tech_bonus" } instantTextBoxType = { name = "bonus" position = { x = 129 y = -22 } textureFile = "" font = "hoi_16mbs" borderSize = {x = 4 y = 4} text = "lol boat" maxWidth = 50 maxHeight = 20 format = right } # Controls the sub-technology icon. containerWindowType = { name = "sub_technology_slot_0" position = { x=141 y=1 } size = { width = 35 height = 26 } clipping = no background = { name = "Background" spriteType ="GFX_subtechnology_unavailable_item_bg" } iconType = { name = "picture" position = { x=2 y=2 } spriteType = "GFX_subtech_rocket" alwaystransparent = yes } } }
Adding background for small items
If you see big (like equipment) icons even on non-equipment technologies you will also need to add item backround records to file countrytechtreeview.gfx. As you can see in next example most base game technologies (industry, infantry, etc.) actually use tech_doctrine background images, which may seem a little confusing.
spriteType = { name = "GFX_technology_<folder>_folder_small_unavailable_item_bg" textureFile = "gfx//interface//techtree//tech_doctrine_unavailable_item_bg.dds" } spriteType = { name = "GFX_technology_<folder>_folder_small_available_item_bg" textureFile = "gfx//interface//techtree//tech_doctrine_available_item_bg.dds" } spriteType = { name = "GFX_technology_<folder>_folder_small_researched_item_bg" textureFile = "gfx//interface//techtree//tech_landdoctrine_researched_item_bg.dds" } spriteType = { name = "GFX_technology_<folder>_folder_small_branch_item_bg" textureFile = "gfx/interface/techtree/tech_doctrine_branch_item_bg.dds" } frameAnimatedSpriteType = { name = "GFX_technology_<folder>_folder_small_currently_researching_item_bg" texturefile = "gfx//interface//techtree//tech_doctrine_researching_anim_strip.dds" noOfFrames = 9 loadType = "INGAME" transparencecheck = yes animation_rate_fps = 15 looping = yes play_on_show = yes pause_on_loop = 0.0 }
Localization
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.5。 |
Technologies and technology folders use the following localization keys:
<technology>: "Name of technology" <technology>_desc: "Description of technology." <folder>: "Name of folder" <folder>_desc: "Description of folder."
Technology Categories
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.5。 |
The /Hearts of Iron IV/common/technology_tags/00_technology.txt controls the technology categories (tags) a technology can belong to.
The categories here are used to refer to technologies in a broad sense, for example, in AI focuses, a technology category can be referred to, altering the AI weighting towards technologies that belong to the specified category.
Here is where technology categories are used:
- ai_focuses: used with the research scope to alter AI weighting.
- ideas: used with the research_bonus scope to apply research time bonuses.
- national_focus: used with the add_tech_bonus effect to apply research time bonuses.
- technologies: applied to technologies.
- technology_sharing: applied to technology sharing groups.
- technology_tags: defined here.
Technology Folders
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.5。 |
The /Hearts of Iron IV/common/technology_tags/00_technology.txt controls the available technology folders. Be sure to define new folders here if you want them to appear.
文件 | 效果 • 条件 • 定义 • 修正 • 修正列表 • 作用域 • 本地化 • on action • 数据结构 (标记, 临时标记, 国家别名, 变量, 数组) |
脚本 | 成就修改 • AI修改 • AI focuses • 自治领修改 • 权力平衡修改 • 剧本/标签 (游戏规则)• 建筑修改 • 人物修改 • 修饰性TAG修改 • 国家创建 • 军队修改 • 决议制作 • 装备修改 • 事件修改 • Idea修改 • 意识形态修改 • 军工商修改 • 国策制作 • 资源修改 • Scripted GUI • 科技制作 • 单位修改 |
地图 | 地图 • 省份 • 补给区域 • 战略区域 |
图形图像 | 界面 • 图形资产 • 实体模型 • 后期特效 • 离子效果 • 字体 |
装饰性 | 肖像 • 命名列表 • 音乐 • 音效 |
其他 | 控制台指令 • 故障排除 • 模组结构 • 成就代码分析 • Mod相关 • Nudger修改 |