Wiki

effect · set_country_leader_portrait

Definition

  • Supported scope:COUNTRY
  • Supported target:any

Description

changes the portrait of country leader. no tooltip is generated
set_country_leader_name = {
  ideology = neutrality # can be ommitted. if so it will change the portrait of current ruler
  portrait = "GFX_portrait_italy_emperor_mussolini"
}

Hands-On Notes

Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.

Hands-On Usage

When you dynamically change a country leader's portrait through events or decisions (such as ruling party transitions, appearance refreshes after historical events, or adding character art for non-standard leaders in cosmetic mods), you can use this effect to precisely replace the leader's portrait under a specific ideology without affecting other attributes. The following example replaces a neutrality ideology leader's portrait with a custom GFX in an event:

country_event = {
    id = my_mod.1
    hidden = yes
    immediate = {
        set_country_leader_portrait = {
            ideology = neutrality
            portrait = "GFX_portrait_my_custom_leader"
        }
    }
}

Synergy

  • [create_country_leader](/wiki/effect/create_country_leader): Typically use this command first to create a new leader, then use set_country_leader_portrait to correct or override the portrait afterward, avoiding the need to rebuild the entire leader object.
  • [add_country_leader_trait](/wiki/effect/add_country_leader_trait): Add traits to a leader while refreshing their portrait in the same execution block to maintain overall consistency of leader data.
  • [has_country_leader](/wiki/trigger/has_country_leader): First confirm in trigger conditions that a leader of the corresponding ideology actually exists to prevent invalid calls that cause scripts to fail silently.
  • [add_country_leader_role](/wiki/effect/add_country_leader_role): After binding a country leader position to a role, you often need to synchronously update the portrait to match the new role's visual presentation.

Common Pitfalls

  1. Omitting the ideology field causes unintended changes to the current ruling leader: When ideology is omitted, the effect applies to the currently sitting leader. If your target is actually a backup leader of a non-ruling ideology (such as a Communist leader not yet in power), you must explicitly specify the corresponding ideology subtype (such as leninism), otherwise the portrait will be incorrectly applied to the ruling leader.
  2. Referencing a GFX key name that is not defined in the .gfx file: This effect generates no tooltip and the script won't error, but the game will display a default placeholder or even a blank image, making it extremely difficult to troubleshoot. Always confirm that the corresponding spriteType has been correctly declared in the .gfx files in the interface/ directory before referencing it.