Bookmark模组制作
原页面:Bookmark modding
A bookmark is a scenario chosen by the player at the start of the game, allowing changing the interesting countries recommended to the player and the starting date.
The /Hearts of Iron IV/common/bookmarks/*.txt files are used for defining the selctable bookmarks.
Each file consists of a bookmarks = { ... } block that contains each bookmark, each as a separate bookmark = { ... } definition. In particular, a file with two bookmarks will be structured as such:
bookmarks = {
bookmark = {
<...>
}
bookmark = {
<...>
}
}
Attributes
These attributes go into a bookmark = { ... } block. Each of the arguments of a bookmark is theoretically optional.
name = loc_keydecides on the 本地化 key used for the name of the bookmark used during the start date selection. Defaults to showing nothing.desc = loc_keydecides on the 本地化 key used for the description of the bookmark used during the start date selection. Defaults to showing nothing.date = 1936.1.1.12decides on the date which notes when the game should start, written in the YYYY.MM.DD.HH format. Defaults to 2.1.1.1, and no earlier date can be used.picture = GFX_select_date_1936decides on the spriteType definition used for the start date, defined in any /Hearts of Iron IV/interface/*.gfx file. Defaults to being pure black.default = yesis used to mark the bookmark as default, resulting in the game pre-loading its conditions during the main menu and making the player choose it by default. Defaults to false, only one bookmark should have this.default_country = GERdecides on the country tag that should be chosen by the player by default. The country must be among the interesting countries.effect = { ... }is an effect block that will be executed when the bookmark is selected. This is done after the history folder but before the player can select a country. In particular, randomize_weather should be used to ensure that the weather works properly, but this can also be used to ensure that the bookmark has different conditions from another one on the same date.TAG = { ... }用于在「有趣的国家」中为一个国家创建条目。使用---的 tag 将被视为「其他国家」菜单,允许玩家在未选中任何国家的情况下进入国家选择界面。同一个国家可以有多个定义。具体来说,以下内容被用作其中的参数:history = loc_keydecides on the 本地化 key used for the description shown to the player when this country is chosen.ideology = neutralityis the 意识形态 group that the country starts with. This is used to determine the country leader, the ideology icon, the name of the country, and the flag.minor = yesis used to mark the country as minor, making it appear in the lower menu with small flags instead of the top one where the leader is shown. This will also requires the country to start with a national focus tree that doesn't havedefault = yesto show up in the selection, used in the base game to make the interesting country selection depend on the DLCs.available = { has_dlc = "Poland: United and Ready" }is a trigger block that must be fulfilled for the country to show up in the selection. This is typically only used for DLC checks, as nothing else may reasonably change before country selection.ideas = { TAG_idea_1 TAG_idea_2 TAG_idea_3 }is the list of 国家精神 that should be shown to the player when the country is selected. This doesn't modify or depend on the actual spirits that the country will have on startup, which is typically handled in country history or state history. By default, limited to 3 entries.[1]focuses = { TAG_focus_1 TAG_focus_2 TAG_focus_3 }is the list of 国策 that should be shown to the player when the country is selected. By default, limited to 3 entries.[2]
File example
bookmarks = {
bookmark = { # Relatively empty bookmark
name = example_bookmark_1
desc = example_bookmark_1_desc
date = 1936.1.1.12
picture = GFX_select_date_1936
"---" = {
history = OTHER_SCENARIO1_DESC
}
effect = {
randomize_weather = 1228
}
}
bookmark = { # A bookmark with a few countries.
name = example_bookmark_2
desc = example_bookmark_2_desc
date = 1936.1.1.12
picture = GFX_select_date_1936
default = yes
default_country = BHR
BHR = {
history = BHR_SCENARIO2_DESC
ideology = neutrality
focuses = { BHR_focus_1 }
ideas = {
BHR_idea_1
BHR_idea_2
}
}
QAT = {
history = QAT_SCENARIO2_DESC
ideology = democratic
minor = yes
available = { NOT = { has_dlc = "Arms Against Tyranny" } }
}
QAT = {
history = QAT_SCENARIO2_DESC
ideology = democratic
minor = yes
focuses = {
QAT_focus_1
QAT_focus_2
}
available = { has_dlc = "Arms Against Tyranny" }
}
"---" = {
history = OTHER_SCENARIO2_DESC
}
effect = {
randomize_weather = 45768
321 = { transfer_state_to = QAT } # Despite being on the same date as the previous bookmark, it will have different starting history
}
}
}
用户界面
| Sprite 通用概览 |
|---|
| 为了加载 GFX,游戏使用 sprite 系统。sprite 是一种代码定义,它把一个名称附加到一个图像文件上,并且可以选择性地添加额外信息,例如动画、帧数、图像的加载方式等等。这意味着 把图像放进 gfx 文件夹并不足以让它生效,一个 sprite 也必须使用该图像文件。 Sprites are defined in any /Hearts of Iron IV/interface/*.gfx file (this is separate from gfx/interface/), opened with a text editor. To create a new .gfx file, a text file can be created and renamed to change the extension (on Windows, the Windows Explorer needs to show the extensions, which it doesn't by default). In particular, sprites are defined within a spriteTypes = {
spriteType = {
name = GFX_first_sprite # In some cases, beginning with GFX_ is mandatory for it to work.
texturefile = gfx/interface/folder/filename.dds # The folder and filename don't matter, as long as they are correct
} # Only the forward slash '/' (can be doubled as '//') can be used to separate folders.
spriteType = { # The image doesn't have to be .dds, as .tga and .png are acceptable.
name = GFX_second_sprite
texturefile = gfx/interface/folder2/filename2.dds
noOfFrames = 2 # Splits the image into 2 halves, which may be switched between dynamically in GUI
}
} In this case, this creates a sprite with the name of 要修改某个 sprite,从来都不是必须复制基础游戏文件。如果在不同文件中对同名 sprite 存在重复定义,游戏将优先使用稍后根据文件名求值的那个,较旧的 sprite 会被完全忽略。可以通过把替换文件名的首字符设为 ASCII 字符表中较靠后的符号来确保这一点。通常为此使用小写字母 'z'。例如,要把 |
In the base game, the images used to represent a bookmark (e.g. GFX_select_date_1936) have the size of 180x104 pixels, with there being a gap in the bottom to prevent overlap with the frame. This gap can be created by selecting and deleting a circle with a radius of ~35 pixels and the centre approximately 90 pixels to the right from the left edge and 130 pixels below the top edge.
By default, the selection of bookmarks and interesting countries within bookmarks is defined in the /Hearts of Iron IV/interface/frontendgamesetupview.gui file. In particular, these changes are common to make:
bookmarks_gridgridbox 用于定位供玩家选择的书签,而bookmark_entry容器窗口是该 gridbox 的各个独立元素。如果书签数量与基础游戏中的不一致,则需要编辑以下内容:- By default, having one bookmark in the loaded files skips the bookmark selection entirely. This can be circumvented by having two bookmarks, but hiding the second one from view. Adding
max_slots_horizontal = 1to the gridbox will prevent more than 1 from showing. The gridbox may be edited in the opposite case of more than 2 bookmarks as well, by increasing the amount of possible rows. - If the amount of bookmark differs from the default, the size of each bookmark may be changed. This would require changing the coordinate positions of elements inside of each bookmark, as well as changing the image used for the frame and/or the font size.
- By default, having one bookmark in the loaded files skips the bookmark selection entirely. This can be circumvented by having two bookmarks, but hiding the second one from view. Adding
- 文件中有 3 个
countries_gridgridbox 用于定位「有趣的国家」。国家容器窗口内的那个用于主要国家,而countries_medium和countries_mini内的那些用于次要国家,在加入第 9 个次要国家后从一个切换到另一个。- There is no way to make either gridbox not follow a grid pattern. However, it is instead possible to create dummy country entries and hide them from the final product by placing iconTypes inside of the
gamesetup_interesting_countries_windowcontainer window after the gridbox, set to use an image that covers up the minor interesting country with the background.
- There is no way to make either gridbox not follow a grid pattern. However, it is instead possible to create dummy country entries and hide them from the final product by placing iconTypes inside of the
备注
- If there is only one bookmark defined within the loaded files, the game will skip the bookmark selection for the player and go straight into the bookmark selection. From that menu, going back to the main menu, either with the interface button or by using hte hotkey, is impossible. This can be avoided by still having a second bookmark but hiding it from the player, as in § User interface.
- The start date cannot be placed before the year 2. If the earliest start date is changed from default, it is necessary to edit the 定义文件 in an override file. In particular,NGame.START_DATE, NGame.END_DATE, and NDiplomacy.TENSION_TIME_SCALE_START_DATE are the ones may need changing.
- In order for the in-game state to change between the start dates, it is possible to place date blocks in country history or state history, which will be executed if and only if the start date is strictly later than the specified date. For example, this state history block will make it be owned by ABC on the game's start, but by DEF if the start date is later than 1937.1.1:
history = {
owner = ABC
1937.1.1 = {
owner = DEF
}
}
- If there should be a difference between bookmarks with the same date, then the
effectattribute can be used. - The bookmarks are positioned in the order of their start dates. If two bookmarks have the same date, then they are positioned in the order in which they are evaluated. The interesting countries are positioned in the order in which they are written in the bookmark.
游戏规则
The game rules allow the player to change the gameplay conditions that will apply after the country selection has been finished. There are two types of database elements that are grouped under "Game rules" for the player:
- Difficulty settings, in /Hearts of Iron IV/common/difficulty_settings/*.txt files. These are used to apply a modifier to a country or a group of countries and present themselves as a slider.
- Game rules, in /Hearts of Iron IV/common/game_rules/*.txt files. These are used to present a dropdown menu to the player out of a few options.
Either one having no valid entries will result in the player being unable to open the menu for editing the game rules.
难度设置
Difficulty settings will apply a 静态修正 to a country or a group of countries based on the slider that the player chooses, defined within /Hearts of Iron IV/common/difficulty_settings/*.txt files. This is unrelated to the difficulty itself that the player chooses.[a]
The files are structured with a unified difficulty_settings = { ... } entry, with each difficulty setting being a separate difficulty_setting = { ... } inside of it. In particular, these attributes exist:
key = custom_diff_strong_tagis the 本地化 key used as the name of the setting in the game rules menu.modifier = diff_strong_ai_genericis the 静态修正 that gets used for the setting.countries = { ABC DEF GHI }is a list of country tags that should have the modifier applied.multiplier = 2.0is how much the modifier should be multiplied to on the maximum scale. This scales linearly depending on which value the player chose out of 5 total positions the slider can take, from 0 to the number in the attribute. For example, if the static modifier containsstability_factor = 0.4and the multiplier is set to 2.0, each position of the slider from left to right will respectively give the country 0%, 20%, 40%, 60%, and 80%
稳定度.
The sliders are positioned in the order in which they are evaluated. In particular, the files in the folder are sorted using the ASCII character order, then the sliders are added in the order that they are defined in the files.
Example file structure:
difficulty_settings = {
difficulty_setting = {
key = "custom_diff_strong_bhr"
modifier = diff_strong_ai_generic
countries = { BHR }
multiplier = 2.0
}
difficulty_setting = {
key = "custom_diff_weak_arab"
modifier = diff_weak_ai_generic # Doesn't exist in the base game
countries = { BHR QAT OMA YEM SAU }
multiplier = 4.0
}
}
游戏规则
Game rules apply allow the player to choose an option among the selection of a few choices before the game's start, defined in /Hearts of Iron IV/common/game_rules/*.txt files. For any new game rules, this will only change how the has_game_rule trigger evaluates, which can be used in conditional statements to give a different result based on the game rule.
There are these three general categories of game rules that exist in the base game:
- One-time change in-game: This usually changes some aspect of the world immediately after the game starts, using the on_startup on action. For example, the "nation fragmentation" game rules fall into this category.
- Mechanical change: This changes how some mechanic works by continuously checking for the game rule being set in-game. For example, the game rule to hide obsolete 国策 branches does so by including a check for the game rule being set in the allow_branch of the national focuses to hide. These two subsets are particularly notable:
- Diplomatic actions: these game rules modify the prerequisites necessary to execute a diplomatic action. These are usually handled with 外交脚本触发器, though occassionally there is distinction that's purely hard-coded (Usually this is the difference between the "Limited" and "Free" options).
- AI behaviour: these game rules are checked for within AI strategy plans and enable one to choose a random focus path. The "random" option is typically handled by setting a country flag using random_list within the the on_startup on action.
- Entirely hard-coded game rules: Some game rules' values are checked directly in the game's binary and thus are unmoddable for the most part with the exception of deleting them or some options of them. For example, the game rule that changes the maximum level of land forts falls under this category.
Each game rule is defined as a separate root-level block within the common/game_rules/ file, where the ID of the game rule is the name of this block. These attributes can be used:
name = loc_keyis the 本地化 key used as the name of the game rule shown to the player. In particular, the localisation values for this usually include flags of countries or text icons.group = group_idis the group where this game rule is positioned. A group needs no other definition and will be automatically created if any game rule uses this group. The group ID also serves as the 本地化 key used for the name in the currently-enabled language.icon = GFX_example_spriteis the spriteType used as the icon of the game rule. In the base game, these link to images approximately 32x32 pixels large.required_dlc = "Wojtek Expansion Pack"is the DLC required for the game rule to be created. If the DLC isn't enabled, then the game rule will not be created entirely, which may also manifest in additional entries in error.log when evaluating trigger blocks that reference the game rule. Optional, defaults to the game rule requiring no DLC.exclude_dlcopposite torequired_dlc.option = { ... }和default = { ... }用于定义游戏规则的选项,其中后者默认会被自动选中。这些可以被重复多次。具体来说,它们具有以下属性:name = option_nameis the ID of the option used for the has_game_rule trigger and occassionally hard-coded checks.text = loc_keythe 本地化 key deciding the name of the game rule shown to the player.desc = loc_keythe 本地化 key deciding the text shown to the player when they hover over the option.allow_achievements = yesmakes a game rule not disable achievements upon being selected. Since modifying game rules inherently changes the checksum from the base game, which disables achievements, this will not result in any change in a mod. Only works inside ofoption = { ... }, as the default option already allows achievements.
Example file structure:
allow_new_diplo_option = {
name = "RULE_ALLOW_SCRIPTED_DIPLO_OPTION"
group = "RULE_GROUP_GENERAL_FOREIGN_POLICY"
icon = "GFX_new_icon"
default = {
name = "ALLOWED"
text = "RULE_OPTION_ALLOWED"
desc = "RULE_ALLOW_SCRIPTED_DIPLO_OPTION_ALLOWED_DESC"
}
option = {
name = "BLOCKED"
text = "RULE_OPTION_BLOCKED"
desc = "RULE_ALLOW_SCRIPTED_DIPLO_OPTION_BLOCKED_DESC"
}
}
BHR_ai_behavior = {
name = "BHR_AI_BEHAVIOR"
group = "RULE_GROUP_AI_BEHAVIOR"
default = {
name = DEFAULT
text = "RULE_OPTION_DEFAULT"
desc = "RULE_OPTION_DEFAULT_AI_DESC"
}
option = {
name = COMMUNIST
text = "RULE_OPTION_COMMUNIST"
desc = "RULE_OPTION_COMMUNIST_BHR_AI_DESC"
}
option = {
name = DEMOCRATIC
text = "RULE_OPTION_DEMOCRATIC"
desc = "RULE_OPTION_DEMOCRATIC_BHR_AI_DESC"
}
option = {
name = FASCIST
text = "RULE_OPTION_FASCIST"
desc = "RULE_FASCIST_BHR_AI_DESC"
}
option = {
name = RANDOM
text = "RULE_OPTION_RANDOM"
desc = "RULE_OPTION_RANDOM_AI_DESC"
}
}
参考文献与注释
^ a: The difficulty itself applies a 静态修正 to every country. There can only be 5 (though others can be hidden from the UI, it will still be possible to select them as the last selected difficulty carries over across savefiles), and different modifiers are granted to the players and AI. In particular, diff_very_easy_player to diff_very_hard_player are given to the player-led countries, and diff_very_easy_ai to diff_very_hard_ai are given to the AI-led countries.
- ↑ Decided by the max slots in the
ideas_gridgridbox ingamesetup_interesting_countries_window, by default defined in /Hearts of Iron IV/interface/frontendgamesetupview.gui - ↑ Decided by the max slots in the
focus_gridgridbox ingamesetup_interesting_countries_window, by default defined in /Hearts of Iron IV/interface/frontendgamesetupview.gui
| 文档 | 效果 • 触发器 • 定义文件 • 修正项 • 修正项列表 • 作用域 • 本地化文件 • 事件钩子 • 数据结构(标记、事件目标、国家标签别名、变量、数组) |
| 脚本 | 成就 • AI • AI 焦点 • 自治领 • 力量均势 • 书签/剧本 (游戏规则) • 建筑 • 角色与特质 • 外观标签 • 国家 • 师 • 决议 • 学说 • 装备 • 事件 • 阵营 • 理念 • 意识形态 • 军事工业组织 • 国策 • 资源 • 脚本化 GUI • 科技与学说 • 单位 |
| 地图 | 地图 • 州 • 补给区域 • 战略区域 |
| 图形 | 界面 • 图形资源 • 实体 • 后期特效 • 粒子 • 字体 |
| 外观 | 肖像 • 名称列表 • 音乐 • 音效 |
| 其他 | 控制台指令 • 疑难排查 • 模组结构 • 模组 • 地图编辑器 |