Hearts of Iron IV

Hearts of Iron IV

Community Portrait Pack
MouToN  [developer] 30 Sep, 2022 @ 5:02am
Tutorial: How to revert a portrait to its Vanilla version?
Let say we want to revert Boris III of Bulgaria's portrait.

It is assumed that you know how to create an HOI4 mod (use the Lanucher->All installed mods->upload mod->create a mod).

The first step is to identify the name of the spriteType object that assignes a picture file (spriteType::texturefile) to an identifier (spriteType::name).
A way to do that would be to look for its definition in a character file The file is "./common/characters/[TAG].txt", so in our case it is be BUL.txt.
Search the document for "boris" (lowercase or case insencitive search) and you find the block
BUL_boris_iii = { instance = { allowed = { has_dlc = "Battle for the Bosporus" } name = BUL_boris_iii portraits = { civilian = { large = GFX_portrait_BUL_boris_iii } } country_leader = { ideology = despotism traits = { tsar_unifier } expire = "1965.1.1" id = -1 } } instance = { allowed = { NOT = { has_dlc = "Battle for the Bosporus" } } name = BUL_boris_iii portraits = { civilian = { large = GFX_portrait_BUL_boris_iii } } country_leader = { ideology = despotism expire = "1965.1.1.1" id = -1 } } }
In this block look for the "portrait" field. The one we're interested here is portrait::civilian::large, but for a field marshal or general, it would be portrait::army::large. So the identifier we were looking for is "GFX_portrait_BUL_boris_iii". Copy it.

The second step is to look for the spriteType definition. It can be found in ./interface/_leaders_portraits.gfx, but it is sometimes overridden by a further definition in a dlc file (./dlc/[dlc id]_[dlc name]/interface/[dlc short name]_portraits.gfx). It is not the case for Boris III thought.
In this file search for the spriteType name, here "GFX_portrait_BUL_boris_iii" (without the quotes!) and you'll find a block
spriteType = { name = GFX_portrait_BUL_boris_iii texturefile = "gfx/leaders/BUL/Portrait_Bulgaria_Boris_III.dds" }
Copy it.

The third and final step is to create a file that alphabetically comes after "zzz_CPP_30_unique_portraits_alternatives.gfx" (for example "zzz_CPP_99_revert_to_vanilla_portraits.gfx") in the interface folder of your mod. You then have to paste the previous srpiteType definition in a spriteTypes bloc ie:
spriteTypes = { ### copy of the Vanilla portrait of Boris III ### spriteType = { name = GFX_portrait_BUL_boris_iii texturefile = "gfx/leaders/BUL/Portrait_Bulgaria_Boris_III.dds" } }

That should do it!
Last edited by MouToN; 13 May, 2024 @ 12:31pm