Author Topic: Tutorial: Changing hairstyle with outfits  (Read 2143 times)

0 Members and 1 Guest are viewing this topic.

Offline miros1

  • Face Collector
  • Administrator
  • Whippy Whippersnapper
  • *****
  • Posts: 3697
  • Gender: Female
  • Face Collector
    • The Wooden Simolean
Tutorial: Changing hairstyle with outfits
« on: October 16, 2012, 01:59:27 PM »
Note: This is unnecessary if you own later EPs, which provide outfit specific hairstyles via the in-game mirror.

Suppose that your sim normally has a messy hair, but you wish it could have a decent haircut for formal situations.

Using Gwill's tutorial, you can easily accomplish this, but of course you'd need to create a new hair package for that purpose.

Yet, there is a way to make a character use existing and unrelated hairstyles, each one chosen for different outfits.

These are the requirements:

    A Sims package editor (SimPe)
    A hexadecimal number converter (also included in SimPe)

1. Choosing the hair styles

In this example, we will pick a custom hairstyle, because it's easier to open the package and find the required resources.

You can also use any base hairstyle, if you know how to locate the Skins.package file and find the correct PropertySet.

Our sim is using a determined hair at all times, but we have decided that it should use a different hair when changing to formal clothes.

We shall begin by opening the chosen hair's package in SimPe, and view the list of PropertySets:

Now we must find the PropertySet that applies to our sim's age and gender (for instance, Adult Male). Inspect the PropertySets, until you find one with the properties:

age = 0x00000008 (adult)
gender = 0x00000002 (male)

Once you find it, open the resource tab below, and take note of its TGI numbers:

Type = 0xEBCF3E27 (GZPS)
Group = 0x5F04E844
SubType = 0x00000000
Instance = 0x00000004

2. Fiddling with the character's package

Now that we have identified the correct hair PropertySet, it's time to open the target sim's character package, and begin the operation itself...
2.1 - The theory

The only resources you have to change are the AgeData (AGED) and the 3D ID Reference File (3IDR) resources, but first we need to know which properties can be changed safely.

Recalling the notes on the AgeData resource, we see that it defines a table containing the pointers to the PropertySets.

What we are going to do is change the pointer to the Formal/Hair selection:
The content of this table was copied from the example linked above, and does not reflect the actual values that shall be used in this tutorial.    Everyday    Swimwear    PJ    Formal    Undies    Skin    Pregnant    Activewear    Unknown
Hair    11    11    11    <new index here>    11    22    11    11    11
Face    12    12    12    12    12    23    12    12    12
Top    13                        24              
Body         18    19    20    21              26    5
Bottom    14                        25              

However, when we open the AgeData resource, we only see a list of properties instead of this pretty table, so I will save you the trouble of actually reading those notes, and tell you what properties must be changed.

First, find an lkn property that has the value "2097153".

The 2097153 number in hexadecimal is 0x00200001. The first half (0020) tells us the it's the "Formal" clothing category, while the second half (0001) determines the "Hair" outfit type. For quick reference, you can see a display of the category values, and the outfit types.

After that value is found, remember (write down) the n number, in this case 10.

Now we should change the value of the le10_0 property, and assign the new index number to it.
2.2 - Editing the resources
Remember that you should only edit the 3IDR resource that has the same instance number as the AGED resource.

The new index number must be a valid index of the 3IDR resource list, so we begin by adding the selected hairstyle resource (identified by the TGI numbers we took note earlier) to the resource list:

After you click the "add" link button, the resource pointer is added to the bottom of the list, making its zero-based index easy to determine (the number of resources in the list minus one).
In this case, the index is 22.

Don't forget to commit the changes to the 3IDR resource.

After that, open the AgeData resource once more, locate the le10_0 property, and change its value to the new index number, without forgetting the conversion to hexadecimal (0x000000016)

Commit the changes to the AgeData, and save the package.
3. Discussion

You might have noticed that the tutorial was omissive about the haircolor of the selected PropertySet, simply because the only properties that are required to match are the age and gender.

You should be aware that due to limitations of the game itself, these changes will be lost if the sim changes appearance in a mirror, so if you wish a more permanent solution, you may have to follow Gwill's tutorial that applies the outfit (category) selection in the hair package.
4. Commonly used codes for the lkn properties

Here is a cheat-sheet if you want to change the hairstyle for other categories:
Category    lk value
Everyday    65537
Swimwear    524289
PJ    1048577
Formal    2097153
Undies    4194305
Maternity    16777217
Sportswear    33554433