How to load alternative resources in fheroes2

This informations are from fheroes2 official website, but the page was removed from the site.

Here you can learn how to use your own images into Free Heroes 2.

Note: the term icon (icn) is used for all groups of image sprites, but it can be a background, a monster attacking, or really an icon.

Explanation

You can use your own sprites (images groups) to customize the appearance of the game. For this you need do some steps:

  1. You need to know the name of the sprite to replace. You can see a list in the icn reference page.
  2. Next you need to extract it, to know how many images have it or use that images as templates.
  3. The next step is make the folder that contain the change images. It's name should be the same as the icn (ending with the .icn) and with the letters in lowercase. And one more thing, it should be in the files/images/ folder of fheroes 2.
  4. Add the images to that folder. If you extracted it, it name may be something as 000.png, 001.png, ... .
  5. Now make a text file named spec.xml on the icon folder.
  6. Add template code to it (see bellow), adding one sprite line for each image that have the icon (as you can see when extracted it).
  7. Complete the template using the name of the images that you have, their location, the name of the icon, and the number of sprites (images) that it have. And save it, of course.
  8. Edit the fheroes2.cfg file and change/add the option "alt resource = on".
  9. Now you can play with your changes images (support png and jpg format).

spec.xml template

<?xml version="1.0" ?>
<icn name="test.icn" count="3">
    <sprite name="0.png" ox="ORIX" oy="ORIY"/>
    <sprite name="1.png" ox="ORIX" oy="ORIY"/>
    <sprite name="2.png" ox="ORIX" oy="ORIY"/>
</icn>

Where:

Example with the main menu background

<?xml version="1.0" ?>
<icn name="heroes.icn" count="1">
    <sprite name="000.png" ox="0" oy="0"/>
</icn>

Battle animations

<?xml version="1.0" ?>
<battle>
  <!--
 <icn name="unknown.icn">
  <animation state="idle" start="0" count="0"/>  // idle frame
  <animation state="move" start="0" count="0"/>  // move frame
  <animation state="fly1" start="0" count="0"/>  // jump up frame
  <animation state="fly2" start="0" count="0"/>  // fly frame
  <animation state="fly3" start="0" count="0"/>  // jump down frame
  <animation state="shot0" start="0" count="0"/> // prepare shot frame
  <animation state="shot1" start="0" count="0"/> // shot up frame
  <animation state="shot2" start="0" count="0"/> // shot frame
  <animation state="shot3" start="0" count="0"/> // shot down frame
  <animation state="attk0" start="0" count="0"/> // prepare attack frame
  <animation state="attk1" start="0" count="0"/> // attack up frame
  <animation state="attk2" start="0" count="0"/> // attack frame
  <animation state="attk3" start="0" count="0"/> // attack down frame
  <animation state="wcne" start="0" count="0"/>  // wcne frame
  <animation state="kill" start="0" count="0"/>  // kill frame
 </icn> -->

 <!-- example: original frame for peasant.icn -->
 <icn name="peasant.icn">
  <animation state="idle" start="1" count="4"/>
  <animation state="move" start="5" count="8"/>
  <animation state="attk1" start="16" count="6"/>
  <animation state="attk2" start="22" count="6"/>
  <animation state="attk3" start="28" count="6"/>
  <animation state="wcne" start="13" count="3"/>
  <animation state="kill" start="34" count="4"/>
 </icn>

 <!-- example: original frame for archer.icn -->
 <icn name="archer.icn">
  <animation state="idle" start="1" count="4"/>
  <animation state="move" start="5" count="8"/>
  <animation state="shot0" start="16" count="4"/>
  <animation state="shot1" start="20" count="4"/>
  <animation state="shot2" start="24" count="4"/>
  <animation state="shot3" start="28" count="4"/>
  <animation state="attk0" start="32" count="4"/>
  <animation state="attk1" start="36" count="3"/>
  <animation state="attk2" start="39" count="3"/>
  <animation state="attk3" start="42" count="3"/>
  <animation state="wcne" start="13" count="3"/>
  <animation state="kill" start="45" count="6"/>
 </icn>

 <!-- more other -->

</battle>

Sounds

Music