Jump to content

[Tutorial] Creating custom HUD


Cunning fox
 Share

Recommended Posts

Most of the HUD mods replace the HUD's textures themselves. That means that every time Klei updates the HUD's textures, those mods'll have to be updated too. This guide will help you make a mod that changes HUD without replacing textures!

  1. Download my HUD skins library from here
  2. Copy hud_skins.lua file to your mod's folder.
  3. In your modmain.lua file paste this line:
    modimport("hud_skins.lua")
  4. Create a scripts folder with img_override_data.lua file in it.
  5. Place this code in it:
    return
    {
    }

And that's it! The setup is done. But we still need to tell the lib what textures are we using. Let's say that we want to replace a texture named clock_hand.tex from images/hud.xml atlas with our image named somename.tex with atlas images/somename.xml. To do this, you need to modify img_override_data file like this:
 

return
{
	["images/hud.xml"] = -- Atlas to replace textures in
	{
		["clock_hand.tex"] = -- Texture that we're replacing
		{
			"images/somename.xml", -- Atlas with image that we're replacing clock_hand with
			"somename.tex" -- Texture that we're replacing clock_hand with
		},
	},
}

And that's it, your mod should work just fine now!
P.S. This lib automatically adds all of your textures referenced in img_override_data file to assets, so you don't need to manually add them.
Mods that use this lib:

Edited by Cunning fox
  • Like 10
  • Thanks 1
Link to comment
Share on other sites

On 11/18/2020 at 2:09 AM, Baguettes said:

@Cunning fox How do I know the names of the textures? I'm not a programmer, but I'm somehow into changing textures of my favorite games.
And are there ways to locate original textures in the game files? I need them as a base.
Thanks in advance!

I have a script on python that splits all textures for me, but you can use this:

 

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...