Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 4 - Lands of Axeoth > Thread: Guide for mass-replacing h4 icons
Thread: Guide for mass-replacing h4 icons
NimoStar
NimoStar


Responsible
Supreme Hero
Modding the Unmoddable
posted October 28, 2019 05:21 PM bonus applied by Galaad on 29 Oct 2019.
Edited by NimoStar at 11:27, 29 Oct 2019.

Guide for mass-replacing h4 icons

Replacing layers one by one is a hassle.
In the case of icons, you would have to do this hundreds of times.

So, here I document a way of not having to do this manually.

It has a lot of steps, but still less than replacing an image 100 times... in fact, I have to do it 193 times for spells (which included naming the layers), which "Inspired" me to develop another way.



1- Extract icons files.
These are "layer" files. You can use H4ResEx or Resedit2 to extract them from the game's (or a mod's) .h4r files, that should be in your "data" folder within your H4 folder)

1- Use namerutan's tool (H4ResHelper) to "open layers", click the appropiate icons file (which shuld begin with "icons."

2- Export this. It should appear as a .ora image
.ora images are layers of PNG files.

3- Install GIMP 2.10 - This is a free image editing tool.

4- Install GIMP plugins "Ungroup layer" and "Add Alpha to all layers". These are scripts a few Kb each.

5- Open the icons image you exported.
Open this .ora image with GIMP.

6- Delete existing layers and group. You can skip this step but it is convenient if you will replace ALL icons.

7- Make sure you have your new icons ready. They must be the same size as the ones you are going to replace. I use "irfanview" and the Bulk Resize command in order to resize my icons. My icons are originally made in Photoshop.

8- Name the icons as the layers you are going to replace. Then, suppress their filetype for importing. This ensures they will have the correct names. I supress filetypes with the option "remove extension" from the free tool "bulk renamer"

9- With the .ora image you exported open, use "open as layers" command from GIMP File menu. Select as many images as you want, from the "typeless" pngs that will be your new layers.

10- They will be opened and named like their files are. If you set the size correctly they will have the exact size to fit the image.

11- If you didn't delete the group that comes by default, now you should be prepared for a little trick. Select the group (probably "misc") and set the command in Layer->Stack->Ungroup layer. That should make the layer group disappear. The next command won't work without this.

12- If they didn't originally have transparency, these images have their names in bold - meaning they don't have an alpha channel. Fix this going to Layer->All layers->Add alpha to all layers. Import won't work if you don't do this.

13- Export this image. Export it as a .ora, differently named from the first for clarity.

14- Now, back to namerutan's tool. You should open again the icons resource that you wanted to modify (if you closed it), the original layers resource (not the .ora)

15- Set file -> Import and choose your exported .ora with the new icons. This will overwrite the file you imported.

Take into account import of many icons can take a LONG time, slower depending on your computer. 193 icons of 180 x 180 take like an hour for me, and I have like a fifth generation I5 with 8 gb RAM. The program will look "stuck" meanwhile, but just let it work. If there appears a warning, only then you botched it.

16- When the image is done importing, save it as an .h4d file in your Data folder. Some of these will work right away, some others it is best to put in he highest priority .h4r file to make sure (new.h4r for the base game, new_mod.h4r for Equilibris, and Nim.h4r for greatest mod)

17- Oh, I almost forgot. You need to open the resulting saved h4d file in an hex editor and change [09] frame 001 into the appropiate name. In the all spells name, this would be [04] acid. The "[]" is hex, the rest is text. You need to look for the "frame 001" with a search function. The missing frame name is always the first alphabetically.

This happens because of a bug in the tool I predicted and later found but was never fixed.
I use Hex Editor Neo which has a nice free test.

Enjoy your new icons!



*This also works for creature and even hero portraits, in case you can't get the old portraits tool to work, or want an alternative.




____________
Discover H4 Greatest Mod!
https://www.moddb.com/mods/greatest-mod/downloads
(Also biggest of only two 2 mods for HOMM IV)

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread »
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0314 seconds