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 = { ... }
.
文档 | 效果 • 条件 • 定义 • 修正 • 修正列表 • 作用域 • 本地化 • 行动 • Data structures (Flags, Event targets, Country tag aliases, Variables, Arrays) |
编写脚本 | AI • AI focuses • Autonomous states • Balances of power • 剧本 • 建筑 • Characters and traits • Cosmetic tags • 国家 • 师 • 决议 • 装备 • 事件 • 内阁/民族精神 • 意识形态 • 国策 • 资源 • Scripted GUI • 科技 • 单位 |
地图 | 地图 • 地区 • 补给区域 • 战略区域 |
图形图像 | 界面 • 图形资产 • 实体 • 后特效 • 离子效果 • 字体 |
装饰性 | 肖像 • 命名列表 • 音乐 • 音效 |
其他 | 控制台指令 • 故障排除 • 模组结构 • 成就代码分析 |