Modding: Difference between revisions

From Hammerwatch 2 Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(12 intermediate revisions by 2 users not shown)
Line 17: Line 17:
#Create a new folder in mods with the name of your mod (cannot have spaces).
#Create a new folder in mods with the name of your mod (cannot have spaces).
#Create a file info.xml with the following information
#Create a file info.xml with the following information
<blockquote>
##<dict>
<dict>
##<string name="name">Mod Name Here</string>
##<string name="author">Your Name Here</string>
## <string name="description">Explanation of what the mod is/does.</string>
##</dict>  
#Start making changes!
##Files with the same name as an existing file will take precedence and completely overwrite anything in the base file. You can copy folders or files directly from the unpacked_assets folder and make changes
##All .sval files are all read in when the game loads. You can use <loader> tags to merge additional data into existing and set load order
##.inc files are referenced with a %include in .sval files, but not automatically loaded


    <string name="name">Mod Name Here</string>
=Troubleshooting=
The game logs all events in "HW2.exe.log", in the root of the game folder. If something isn't working, check there first for errors about expected characters or missing files.


    <string name="author">Your Name Here</string>
=Documentation=
*[[Modding/Skills|Skills]]
*[[Modding/Effects|Effects]]
*[[Modding/Actions|Actions]]
*[[Modding/Modifiers|Modifiers]]


    <string name="description">Explanation of what the mod is/does.</string>
=Uploading to Steam Workshop=
#Launch PACKAGER.exe from the Hammerwatch2 folder
#Right Click your mod folder under Resources/Unpacked/yourmodname and select "Make Package"
#Click the Steam icon in the top left corner of the packager window to open the Steam Workshop UI
#Upload new mod
##Select the "Upload new" tab
##Click browse package, navigate to your Hammerwatch2 mods folder, and select the newly created .bin file you created above
##Click browse image and select an image thumbnail to be uploaded to the steam workshop for your mod
##Enter the name, description, visibility, and tags to use for the mod in the steam workshop
##Press the Upload button. ''It may take up to an hour for the mod to appear in the workshop after being successfully uploaded''


</dict>
=Tutorials=
</blockquote>
Video Tutorial - [https://www.youtube.com/watch?v=0LfyTo-BBbI Hammerwatch 2 Modding: NPCs, Quests, and Custom Crafting]
#Copy files you want to modify with their existing folder structure to your mod folder
#Use the <loader> tag to add new files.
 
=Creating a new class=
#In your mod folder, create a new folder "players"
#Copy an existing class from the unpacked players folder into your mod players folder
##Rename the baseclass folder and the baseclass.unit file within to your new class name
#Create a new file in players named <yourclass>.inc
##Copy the baseclass section %defblock to %endblock from unpacked/players/classes.inc into <yourclass>.inc
##Replace the baseclass with yourclass on the first line %defblock
##Edit the id, name and description at the top of the file to your own text (remove the .item.info.tooltip.class. and .menu.class. text).
##Edit the unit field to be players/yourclass/yourclass.unit
##Replace the baseclass with yourclass for every line in the <array name="skills"> section
#Create a new file in player named "modded_classes.sval"
##Paste the following contents into the file, using yourclass name:
###<loader order="1">PlayerClass::LoadMultiple</loader>%include "players/yourclass.in<array>%block yourclass</array>
#Fix .tif files
#Test - you should now be able to start a new save with the mod enabled and select your class


Text Tutorial - [[Modding/Creating_A_Custom_Class|How to create a custom class]]


=Fixing .tif files=
=Fixing .tif files=
The unpackager tool does not create tif files in the correct format to use for the game. Any .tif files copied from the unpacked_assets folder to your mod folders will show as an empty or glitched texture in game, popup an error on loading, and record an ERR event in HW2.exe.log. This can be corrected with any of the following methods
The unpackager tool does not create tif files in the correct format to use for the game. Any .tif files copied from the unpacked_assets folder to your mod folders will show as an empty or glitched texture in game, popup an error on loading, and record an ERR event in HW2.exe.log. This can be corrected with any of the following methods
#Adobe Photoshop (Best - maintains masking to allow recoloring sprites)
#Replacement
##Download the [https://wiki.hammerwatch2.com/hw2_tgas.zip HW2 TIFS ZIP]
##Copy the tifs you need from the zip into your mods folder
#Convert with Adobe Photoshop (Maintains masking to allow recoloring sprites)
##Photoshop has an option to convert tif files from standard (RGBRGB) to planar (RRGGBB) that the game expects. (Need more details on steps to perform)
##Photoshop has an option to convert tif files from standard (RGBRGB) to planar (RRGGBB) that the game expects. (Need more details on steps to perform)
#Image Magick Conversion (masking is lost and sprites can no longer be recolored)
#Convert with Image Magick (masking is lost and sprites can no longer be recolored)
##Open powershell and navigate to your class folder: "cd \Steam\steamapps\common\Hammerwatch 2\mods\yourmod\players\yourclass"
##Open powershell and navigate to your class folder: "cd \Steam\steamapps\common\Hammerwatch 2\mods\yourmod\players\yourclass"
##Convert all of the png files into tif with planar interlacing using the command "magick mogrify -format tif -interlace plane *.png"
##Convert all of the png files into tif with planar interlacing using the command "magick mogrify -format tif -interlace plane *.png"

Latest revision as of 14:24, 8 September 2023

Hammerwatch 2 has a robust system for modding, with a few different types of mods possible.

Resource mods

Scenarios

Languages

Getting Started

  1. Open the game's folder (e.g. C:\Program Files (x86)\Steam\steamapps\common\Hammerwatch 2)
  2. Run "PACKAGER.exe"
  3. Select "Resources" from the list
  4. Click the "Extract Base Resources" button at the top (icon is a cardboard box)
  5. Wait for the unpacking to finish (This will take a while). It may give an error, this can be ignored.
  6. When finished, it will create a new folder named "unpacked_assets_[number]" containing all of the base game files
  7. Create a new folder named "mods"
  8. Create a new folder in mods with the name of your mod (cannot have spaces).
  9. Create a file info.xml with the following information
    1. <dict>
    2. <string name="name">Mod Name Here</string>
    3. <string name="author">Your Name Here</string>
    4. <string name="description">Explanation of what the mod is/does.</string>
    5. </dict>
  10. Start making changes!
    1. Files with the same name as an existing file will take precedence and completely overwrite anything in the base file. You can copy folders or files directly from the unpacked_assets folder and make changes
    2. All .sval files are all read in when the game loads. You can use <loader> tags to merge additional data into existing and set load order
    3. .inc files are referenced with a %include in .sval files, but not automatically loaded

Troubleshooting

The game logs all events in "HW2.exe.log", in the root of the game folder. If something isn't working, check there first for errors about expected characters or missing files.

Documentation

Uploading to Steam Workshop

  1. Launch PACKAGER.exe from the Hammerwatch2 folder
  2. Right Click your mod folder under Resources/Unpacked/yourmodname and select "Make Package"
  3. Click the Steam icon in the top left corner of the packager window to open the Steam Workshop UI
  4. Upload new mod
    1. Select the "Upload new" tab
    2. Click browse package, navigate to your Hammerwatch2 mods folder, and select the newly created .bin file you created above
    3. Click browse image and select an image thumbnail to be uploaded to the steam workshop for your mod
    4. Enter the name, description, visibility, and tags to use for the mod in the steam workshop
    5. Press the Upload button. It may take up to an hour for the mod to appear in the workshop after being successfully uploaded

Tutorials

Video Tutorial - Hammerwatch 2 Modding: NPCs, Quests, and Custom Crafting

Text Tutorial - How to create a custom class

Fixing .tif files

The unpackager tool does not create tif files in the correct format to use for the game. Any .tif files copied from the unpacked_assets folder to your mod folders will show as an empty or glitched texture in game, popup an error on loading, and record an ERR event in HW2.exe.log. This can be corrected with any of the following methods

  1. Replacement
    1. Download the HW2 TIFS ZIP
    2. Copy the tifs you need from the zip into your mods folder
  2. Convert with Adobe Photoshop (Maintains masking to allow recoloring sprites)
    1. Photoshop has an option to convert tif files from standard (RGBRGB) to planar (RRGGBB) that the game expects. (Need more details on steps to perform)
  3. Convert with Image Magick (masking is lost and sprites can no longer be recolored)
    1. Open powershell and navigate to your class folder: "cd \Steam\steamapps\common\Hammerwatch 2\mods\yourmod\players\yourclass"
    2. Convert all of the png files into tif with planar interlacing using the command "magick mogrify -format tif -interlace plane *.png"