Hands-On Usage
set_power_balance_gfx is primarily used to customize the visual icons for each faction in the Power Balance system within your mod. For example, you can set exclusive graphics for opposing ideologies or factional struggles on either side of the power balance scale. When your mod introduces a new power balance bar, use this effect to specify the corresponding GFX for each side separately, ensuring the UI displays the correct faction icons instead of blank spaces or default graphics.
# After an event or focus completes, set icons for both sides of a custom power balance
set_power_balance_gfx = {
id = my_mod_power_balance
side = my_mod_side_progressive
gfx = GFX_my_mod_progressive_icon
}
set_power_balance_gfx = {
id = my_mod_power_balance
side = my_mod_side_conservative
gfx = GFX_my_mod_conservative_icon
}
Synergy
[add_power_balance_value](/wiki/effect/add_power_balance_value): After setting the GFX, you typically need to assign an initial value to the power balance immediately. These two effects usually appear together in the same initialization block.
[add_power_balance_modifier](/wiki/effect/add_power_balance_modifier): Apply persistent modifier effects to a particular side of the power balance. Combined with GFX setup, this forms a complete power balance initialization workflow.
[is_power_balance_side_active](/wiki/trigger/is_power_balance_side_active): Before executing GFX setup, use this trigger to verify that the corresponding side is already activated, preventing operations on invalid sides.
[remove_all_power_balance_modifiers](/wiki/effect/remove_all_power_balance_modifiers): When resetting a power balance scenario, clear all modifiers first, then reapply the GFX. This "reset then reinitialize" pattern is common practice.
Common Pitfalls
- The
id and side must match the definition file exactly: id corresponds to the power balance ID defined in common/power_balance/, while side refers to the specific faction ID beneath it. Any spelling error will cause silent failure—the game won't report an error, but the graphics won't apply. Beginners often overlook case sensitivity or underscore differences.
- Referencing a GFX name without registering it in a
.gfx file first: The graphics name specified in the gfx field must be declared beforehand in .gfx files within the interface/ directory using a spriteType definition. Otherwise, the game will display a blank space or report an error. You cannot directly input image file paths.