In Vanilla, Balance of powers are used to represent a conflict between two sides through a progress bar divided into distinct sections. The main functionality of Balance of power, also referred to as Bop or powerbalance in code, is located in /Hearts of Iron IV/common/bop/*.txt.
Basics
A Balance of power consists of two sides, which sit on opposite sides of a progress bar. By changing a variables in the Bop, a cursor is moved towards one of the two sides. The value 1 describes the maximum value in the Bop to the right side. The left side includes all values up to -1, 0 being the equilibrium. A modder can include a decision category in the Bop that supports the same functions as a regular decision category. The progressbar, which can be seen at the top of the Bop menu, can be divided into different sections, so-called ranges. Ranges can trigger different continuous or one-time effects when they are activated.
Structure
Balance of power
A Balance of power is defined using TAG_example_balance = { ... } syntax. The name of the Bop is used to identify it in code.
The following arguments are mandatory:
intial_value = ... Is for the starting value of the Bop. The value has to be between -1 and 1.
The sides of the Bop are defined as right_side = ... and left_side = .... The names need to be unique as they are used to identify the sides in code.
decision_category = TAG_example_category makes the decision_category appear in the Bop menu.
Side
Each Bop needs two sides, which are defined with side = { ... }. Each side requires a unique id = ... and icon = GFX_TAG_example_bop_icon. A side can then be divided into any number of ranges. However, the ranges must not overlap.
Range
Any range requires a unique id = ... as well as a min and max value. The values are used to determine which range is active at any given moment.
The effects of a range are scripted in the modifier = { ... } block. (Modifiers) Furthermore, effects can also be specified that are executed when the specific range is activated or deactivated. This can be achieved through the usage of on_activate = { ... } and on_deactivate = { ... }.
Example
TAG_example_balance = {
initial_value = 0.25
left_side = default_left_side
right_side = default_right_side
decision_category = TAG_example_category
range = {
id = mid_range
min = -0.1
max = 0.1
modifier = {
war_support_weekly = 0.5
}
}
side = {
id = default_left_side
icon = GFX_idea_generic_agrarian_society
range = {
id = left_side_range
min = -1
max = -0.1
modifier = {
war_support_weekly = 0.1
}
}
}
side = {
id = default_right_side
icon = GFX_idea_generic_degauss_ship_hulls
range = {
id = right_side_range
min = 0.1
max = 1
modifier = {
war_support_weekly = 0.9
}
}
}
}
Modifying a Balance of Power
There are two main ways of adding to or subtracting from a Balance of power. One can either add a flat value through an effect or apply a modifier for continuous Bop change.
Effect
The effect add_power_balance_value = { ... } requires the name of the power balance, for example TAG_example_balance and a value between -1 and 1.
add_power_balance_value = {
id = TAG_example_balance
value = -0.25
}
Bop Modifier
A Bop modifier is defined within common/modifiers/*.txt with the following syntax:
TAG_example_balance_modifier = {
power_balance_daily = 0.05
}
Another valid argument would be power_balance_weekly = -0.005.
Bop modifiers can be applied or removed with the effect add_power_balance_modifier = { ... } and remove_power_balance_modifier = { ... }.
| 文件 | 效果 • 条件 • 定义 • 修正 • 修正列表 • 作用域 • 本地化 • on action • 数据结构 (标记, 临时标记, 国家别名, 变量, 数组) |
| 脚本 | 成就修改 • AI修改 • AI focuses • 自治领修改 • 权力平衡修改 • 剧本/标签 (游戏规则)• 建筑修改 • 人物修改 • 修饰性TAG修改 • 国家创建 • 军队修改 • 决议制作 • 装备修改 • 事件修改 • Idea修改 • 意识形态修改 • 军工商修改 • 国策制作 • 资源修改 • Scripted GUI • 科技制作 • 单位修改 |
| 地图 | 地图 • 省份 • 补给区域 • 战略区域 |
| 图形图像 | 界面 • 图形资产 • 实体模型 • 后期特效 • 粒子效果 • 字体 |
| 装饰性 | 肖像 • 命名列表 • 音乐包制作 • 音效 |
| 其他 | 控制台指令 • 故障排除 • 模组结构 • 成就代码分析 • Mod相关 • Nudger修改 |