Non-Replacing Hair Resource Guide

From The Stardew Modding Wiki
Jump to navigation Jump to search

Non-Replacing Hair Resource Guide[edit | edit source | hide | hide all]

https://www.nexusmods.com/stardewvalley/mods/8821?tab=description made by malic18 using ContentPatcher made by (Our Overlord Modfather) Pathoschild.

Your farmer when you have too many hairstyles.png

Do you want to add more hair to your already filled hair folder, but is the character creation filling with Bald (maybe curvy/goblin/blue) farmers? Or you just can't simply add more? Malic18 has created a Mod for this! You do still have to put all your hairstyle-sheets in there and add a small bit of code. It's not hard, so don't let the "small bit of code" put you off! You don't need any coding or content patcher experience for this! You also don't need any Pixelart skills.

First, I'd suggest reading the Modpage. That would be very kind to Malic18 and this wikipage. When downloading the mod, you will see a hair spritesheet. This is an example from Malic18 to help you.

Now, if you ignored my kind message to read the modpage and you're really lazy (thats really bad, just click it): Non-Replacing Hair Resource, NRHR for short, inserts a hairstyle spritesheet into the Character/Farmer folder with ContentPatcher. No, this does not involve any XNB stuff.

What will you need to use this?[edit | edit source | hide]

  • Non-Replacing Hair Resource (I hope you already downloaded it)
  • ContentPatcher (duh)
  • Any (Paint) program that shows the coordinates of your cursor (I use Asesprite Trial)
  • Any Notepad program (Notepad++, Notepad. NOT WORD.)
  • Maybe a brain and eyes.

TL;DR[edit | edit source | hide]

1. Download NRHR and put it in your mods folder.
2. Add in all of your hairstylespritesheets.
3. Open content.json, put in an entry for each of your individual hairstyle spritesheets. Three hairstyle spritesheets = 3 entries.
{
"LogName": "Patch Coii long hair file into Characters/Farmer/",
"Action": "Load",
"Target": "Characters/Farmer/CoiiHairLong",
"FromFile": "CoiiHairLong.png"
},
{
"LogName": "An example on how to add a second one!! into Characters/Farmer/",
"Action": "Load",
"Target": "Characters/Farmer/CoiiHairShort",
"FromFile": "CoiiHairShort.png"
},
{
"LogName": "I can name this anything I want and it doesn't matter what I call it",
"Action": "Load",
"Target": "Characters/Farmer/TheHairIAdded",
"FromFile": "TheHairIAdded.png"
}

4. Get the Y coordinate of the first hairstyle. Do Y coordinate / 16 = Y Tile coordinate.
5. Get the number of different hairstyles in one row (should be 8). Start from 0 and end at 7.
6. Open your content.json again and add in the entries for each individual hairstyle from each hairrow. 0 up to 7.

From left to right:

  • Unique ID for each hairstyle.
  • The filename without filetype.
  • The hair number from 0 up to 7.
  • The YTile from the fourth step.
  • If the hairstyle has a unique left or right hairstyle. This is for hairstyles with 4 rows.
  • The hairstyle ID of when a player is wearing a hat. -1 if you don't want the hair to show when a hat is worn.
  • If it is bald style.


7. It should look like this:
"Entries": {

"928800049": "TheHairIAdded/0/42/false/928800049/false",
"928800050": "TheHairIAdded/1/42/false/928800050/false",
"928800051": "TheHairIAdded/2/42/false/928800051/false",
}

The actual guide[edit | edit source | hide]

Please read above too, if you say you don't understand when only reading this: >:(

# You've downloaded NRHR and opened the folder. Drag it to your Mods folder.[edit | edit source | hide]

Explanation 1

# Put the hairstylesheet(s) you want to add to your game in this folder.[edit | edit source | hide]

NRHRHairstylesExplanation.png

It may look like the image on the right. It doesn't matter what names you give to the hairstyles. You can't use XNB files. Go unpack them (this is not a guide for unpacking)!

# Open the content.json in a text editor. I use Notepad++.[edit | edit source | hide]

Image 2021-06-22 004120.png

It will look like the image on the right.

# For each different hairstyle spritesheet you have, you will need to add another log (see example from Malic too!).[edit | edit source | hide]

Image 2021-06-22 004837.png

Did you see the hairstyle spritesheets I added in the former image? This is how you should put it in the content.json. Don't forget to put a comma after each object and the { }! You can remove the example hair that was in NRHR, but you don't have to. I renamed Yoseiri's file to one without periods and spaces, because it fits nicer.

# HairData. READ.[edit | edit source | hide]

Explanation:
"928800049": "CoiiHairLong/0/42/false/928800049/false"


"928800049" = the ID of one hairstyle. This includes the side(or left, right), front, back. You don't have to make an ID for each side.
Normal practice is the last four letters of your NexusID and then adding the IDs after (you don't have to). You can give any number you want, as long as it isn't the same with the others that you're going to add in this list and isn't more than 2,147,483,647. So this means it has to be unique (in this list)!
CoiiHairLong = The filename without the filetype. So if your hairstyle sheet is called wowIreadthemodpageimsosmart_2a1.png, you should only put wowIreadthemodpageimsosmart_2a1.
0 = The tile position of the hairstyle, this will be the (converted) X coordinate.
42 = The tile position of the hairstyle, this will be the (converted) Y coordinate.
false = Can also be true! If your hairstyle has 4 'rows', as in, a unique left and/or right sprite (apart from front and back), you will have to put this as true.
928800049 = A unique ID of a separate hairstyle for when a player is wearing a hat or -1 to hide the hair. I put in the same ID as the ID itself has, because I want the hair to keep showing when a hat is worn! If you don't, or have a different hairstyle you want to use that for, use -1 or the ID of the hairstyle (that is going to be in this list).
false = If the hairstyle "is bald style". Probably not, so set it to false.


# Now that you know how HairData works, let's talk about these so called "converted" X,Y coordinates and how to get them. LONG and IMPORTANT.[edit | edit source | hide]

Hair stylesheet example on how the X,Y and XTile and YTile works..png

Open up your hairstyle spritesheet with a Paint tool (I will use Asesprite, because it's really easy to get the coordinates of each individual hairstyle). Move your cursor to the most top-left corner of the spritesheet. It will show 0,0 somewhere on your Paint tool (bottom left corner in Asesprite). The first zero is the X coordinate, the second is the Y.

If each hairstyle has "3" rows on this current spritesheet[edit | edit source | hide]

If each hairstyle is the usual (front, side, back) size, the first row of hairs will start on 0,0. The second row of hairstyles begins on 0,96. Third row of hairstyles 0,192, etc. So: Current Y + 96 = Next starting position.

The second row begins at X0,Y96. One "Tile" of hairstyle (this includes front, back and side) means from X0,XY up to and including X0, Y96. According to the Gamefiles, this means that for the first hairstyles row (including all sides), you have to put 0 as the Y in the HairData entry.
Each hairstyles row has 8 different hairstyles. The game counts from 0, so 0 is already one hairstyle. This means that from 0 up to and including 7 is EIGHT hairstyles. Not 1 to 8.


To convert coordinates to "Tiles":
One hairstylerow is from X0,Y96. This means that one hairstyle "Tile" is 6 (according to the Gamefiles, I don't know why). Y32 = Y Tile 2 = 1 hair'side', which means = Y 96 = Y Tile 6 = 3 hair'sides' which is 1 hairstylerow.
So if your hairstyle spritesheet has 6 rows of different hairstyles, this means it has 48 individual hairstyles (6*8). So the 2nd row will be number YTile 12, the third row will be YTile 24, etc (starting point + 6(Tile) = starting point of new hairstylerow).

But wait! What if my hairstyle spritesheet starts halfway or from the bottom? No problem.
Just find the starting X,Y coordinate with Paint and do a small calculation
Each hairstyle has 3 rows, so:
Take the Y coordinate of the starting position of the first (actual) hairstyle row from your Paint tool. Then use this formula: Starting position Y / 16(=1 hair'side') = The YTile you can put in your content.json.

So: On Coii's Long Hair spritesheet, the hair begins at Y672 in my Paint tool.
672 / 16 = 42 Y in content.json.
This is how it will look like:
"928800049": "CoiiHairLong/0/42/false/928800049/false", (number 0 of the hairs in the hairstylerow)
"928800050": "CoiiHairLong/1/42/false/928800050/false", (number 1)
"928800051": "CoiiHairLong/2/42/false/928800051/false", (number 2)
"928800052": "CoiiHairLong/3/42/false/928800052/false", (number 3)
"928800053": "CoiiHairLong/4/42/false/928800053/false", (number 4)
"928800054": "CoiiHairLong/5/42/false/928800054/false", (number 5)
"928800055": "CoiiHairLong/6/42/false/928800055/false", (number 6)
"928800056": "CoiiHairLong/7/42/false/928800056/false", (number 7)


End result of how your content.json should look
If each hairstyle has "4" rows on this current spritesheet[edit | edit source | hide]

If you are using a hairstyle spritesheet where hairstyles have "4" rows (left, right, front, back), the second row of hairstyles will start on 0,128. This means that the third row of hairstyles will then be 0,256. Get it? current + 128 = next row. The horizontal (x) will always stay the same pattern (from 0 up to and including 7)

So, the second hairstylesrow begins at X0,Y128. One "Tile" of hairstyle (this includes front, back, left right) means from X0,Y0 up to and including X0,Y128. According to the Gamefiles (I don't make the rules, sadly) this means that for the first hairstyles row (again, including all the sides), you have to put 0 as the Y in the HairData. Now, wait a bit before doing that: each hairstyles row has 8 different hairstyles. The game counts from 0. So, 0 is already one hairstyle. This means that from 0 up to and including 7 is EIGHT hairstyles. NOT 1 to 8.

To convert: One hairstyle is from X0,Y128. This means that one hairstyle "Tile" is 8 (according to the Gamefiles). Y 128 = Y8 = 4 hairrows (left, right, back, front). So if your hairstyle spritesheet has 6 rows of different hairstyles, this means it has 48 individual hairstyles. So the 2nd row will be number Y16, the third row will be Y22, etc (starting point + 8(Tile) = starting point of new hairstylerow).

This will mean that you will have to put this in the HairData entries (example):

"928800001": "kkunma09-hairstyles/0/0/true/928800001/false",
"928800002": "kkunma09-hairstyles/1/0/true/928800002/false",
"928800003": "kkunma09-hairstyles/2/0/true/928800003/false",
"928800004": "kkunma09-hairstyles/3/0/true/928800004/false",
"928800005": "kkunma09-hairstyles/4/0/true/928800005/false",
"928800006": "kkunma09-hairstyles/5/0/true/928800006/false",
"928800007": "kkunma09-hairstyles/6/0/true/928800007/false",
"928800008": "kkunma09-hairstyles/7/0/true/928800008/false",

This is one row of 8 different hairstyles. The first row to be exact.
The second row will look like this:

"928800009": "kkunma09-hairstyles/0/8/false/928800009/false",
"928800010": "kkunma09-hairstyles/1/8/false/928800010/false",
"928800011": "kkunma09-hairstyles/2/8/false/928800011/false",
"928800012": "kkunma09-hairstyles/3/8/false/928800012/false",
"928800013": "kkunma09-hairstyles/4/8/false/928800013/false",
"928800014": "kkunma09-hairstyles/5/8/false/928800014/false",
"928800015": "kkunma09-hairstyles/6/8/false/928800015/false",
"928800016": "kkunma09-hairstyles/7/8/false/928800016/false",


You can use multiple different hairstyle spritesheets (6 and 8) with each other in the content.json.



Guide made by Kamalei (kikartje152), thanks to malic18 and (Our Overlord Modfather) Pathoschild.