Custom Materials (Dyes)

From Heroes of Hammerwatch wiki
Jump to: navigation, search

Materials (or dyes) alter the color of various parts of the players sprite. They can be added to the game fairly easily, requiring adding only a simple file. If you haven't yet, make sure you create the base for the mod first.

Making Materials

In this example, we'll add a pink skin dye.

In your mod folder, create a folder called tweak. In there, you have to create a new sval file. You can for example call this extra_dyes.sval, or something else. Keep in mind: the assets between base and mods are shared! This means you should use a unique filename here that no other mod is going to use. (You could also put it in a separate (or different) folder if you want to be extra cautious.)

Sval files is the main serializable data structure used throughout the engine, and sval files describe a single SValue object. Sval files however have a special property; you can specify a loader tag to tell the engine which script function to load the sval with. These are called SValue Loaders. Using this loader, we can make the file load material definitions. For example, we can make an sval file containing this to add a new pink skin dye.

   <array name="skin">
         <string name="id">pink</string>
         <string name="name">Pink</string>
         <array name="shades"><string>#350010</string><string>#e646c3</string><string>#ffa2fa</string></array>
         <string name="quality">rare</string>
         <bool name="default">true</bool>

Here's a breakdown of the information included here:

  • array name="skin": This is what the material applies to. Other options besides skin are hair, cloth, metal, leather, and wood
  • string name="id": This is the ID used to refer to the skin.
  • string name="name": The name displayed in-game.
  • array name="shades": The three values here correspond to the hex values for the three colors used in the material. Each can be anywhere from #000000 to #ffffff.
  • string name="quality": The quality of the material, can be common, uncommon, or rare.
  • bool name="default": Determines whether you start with the material or have to find it like the other materials. Can be either true or false.

If you've done it all right, you should be able to enable the mod in-game and see your new material available in the tailor (if you have it set to default)! Unfortunately due to limits of the game engine it currently (as of writing this page) is not possible to have custom materials show up in the character creation screen.

Pink picture.PNG