So... I could just tell you what values to replace and where, but I decided to write a detailed guide on how to find all the necessary values in the settings code and replace them in order to link two objects. Since this applies not only to upgrading cribs, but also other objects (for example, those that have props in animations) this information may help other creators. I learned this while trying to make a tea set and I couldn't find a single guide that would help me figure it out from start to finish (maybe I didn't search well enough), so I'm writing it here.
I don't know how much you know from what I'm going to show, so I'm writing this in such detail that anyone who encounters this for the first time can understand what I'm talking about.
{
Open guide}Before we begin I should mention that the game files reference each other using the instance of each swatch of your object.
However, in the studio files we are used to seeing Instance as a hexadecimal value, while in the xml code that we will edit these values are decimal. Therefore, the first thing we will do is open the Hash Generator in the top panel of the studio in the tools section.
We will need the Hash Generator to link the Instance of each swatch of one bed with the corresponding swatch of the second bed. With its help we will also be able to find the values that we will change.
A simple example: if the developer's code specifies the decimal value of the first swatch of the original crib, we must replace it with the value of the first swatch of our new crib. To do this, we convert the hexadecimal value of instance to decimal.Now let's get down to business.
1) The first thing I'll do is clone two beds, one for infants and one for toddlers. To make things simpler, I'll just call them CRIB - crib for infants and BED - crib for toddlers, since I'm using a translator and don't want it to translate the same thing differently.
I'll save their packages as CRIB1 and BED1.
2) To tune the object I don't need to add a new mesh or make textures. I test the tuning before I start creating the object. So for now I will just extract the textures of both beds and change them a little. I will add a blue circle to the textures so that they are slightly different from the ones the developers had. So my goal is for the BED with a blue circle to upgrade to a CRIB with a blue circle and vice versa. I will also change the color of the swatch for convenience.
3) Let's go to the warehouse tab and find our blue swatch. Next to it we will see an object definition with the same Instance value as our swatch.
4)Now let's move on to tuning.
Each object has its own tuning, it is not included in the basic set of object files when cloning, so we need to extract it ourselves. In the date tab of the object definition BED1, find TuningID and copy it.
4.1) For ease of use, I create an empty package named “tuning” for all tuning files. But you can add them to your package with the bed, no matter where they are, the main thing is that you do not get confused in them.
5) Let's go to Tool - Extract Tuning… and paste the TuningId from step 4. Select the suggested file and add it to your package.
5.1) You can delete the SimData file that was added with Object Tuning, we won't need it.
6) Before we start editing Object Tuning, let's attach it to our object.
Go to the Data tab and change the name. Add your nickname with the ":" sign at the beginning of the name, once you do this, the Instance and TuningId values will change. I will also add BED1 at the end, so I know which object this tuning belongs to.
6.1) Copy the new name
6.2) Now let's go back to the Object definition of our BED1, and in the Tuning line insert a new name. The TuningId line will change and will match the Id of our object tuning.
Now our bed has custom tuning. You should know that Object Tuning is usually common for the entire object (although there are exceptions), and therefore step 6.2 should be done for all your swatches.
7) Next we will need another tuning file. It is called Interaction Tuning - these are the settings for interaction with an object. In simple terms - each action that can be accessed by clicking on an object in the game is a separate Interaction tuning.
All possible actions on an object are listed at the bottom of Object Tuning in "_super_affordances":
Now we need to find the action that initiates the change from one bed to another. The developer's comments for each action are written in green, they can be used to understand what exactly we are looking for. Copy the number from the desired line and add a new tuning file to our package (step 5 and 5.1).
8) Let's rename Interaction tuning the same way as we did in step 6.
9) Now let's copy the new TuningId and replace the previous value in "_super_affordances" with the new one:
So, we have created custom tuning for our BED1. We need to do the same for CRIB1 - repeat steps 3-9 for the second bed.
10) Now we have 4 tuning files that are linked to their beds, all that remains is to link them together.
11) In this step I will suggest doing something weird, but I just don't know a better way. I suggest creating two overrides for our beds. I will click object-override in the main studio menu and make new packages with the same beds. To avoid confusing them with our BED1 and CRIB1 files, I will name them BED_override and CRIB_override. These will be temporary files that we will delete when we learn the necessary information from them. You can even store them outside the mods folder, because we only need the values from there to make things easier.
11.1) Let's open the BED_override package. This is a full copy of the game bed and contains the same values as the developer beds. We need to find the first swatch in this file and copy its Instance. Paste this value into the Hexadecimal line in the Hash generator and copy the decimal value.
The resulting number is what we will LOOK FOR in the code.11.2) Now go to your package BED1 and copy the Instance of the first swatch. Convert it from Hexadecimal to Decimal the same way as in step 11.1.
The resulting number is what we will PASTE in the code.12) Back to our tuning files. I'm going to open the XML for each of them in turn and find the value I got in 11.1 (295572) and replace it with the value I got in 11.2. Use Ctrl+F to open the search bar.
What we are looking for is here:
Interaction tuning BED1 (line 491)
Object Tuning CRIB1 ( line 342)
13) Let's go to the CRIB_override package and repeat everything we did in 11.1, 11.2 and 12.
We need to find the number 293880 (this is the value of the first swatch of the original crib for infants) and replace it with our decimal value of the first swatch CRIB1.
What we are looking for is here:
Object Tuning BED1 - line 308
Interaction Tuning CRIB1 - line 489
14) If you pay attention to where we replace the values, you will see that there are also eight more rows below with similar values. So if we just replaced the value for swatch 1 of each crib, we can fill in the rest of the rows if we already have recolors.
Unfortunately I don't know how to add more than nine swatches to your object, except to create a new object tuning and link it to the other swatches. I tried adding new lines of code in my tea set file, but it didn't work, additional swatches just don't work.
15) Let's go back to the Object Tuning files. In the list of object interactions (_super_affordances) there is also the action Upgrade_ConvertToBed_Resume - you will use this action if the character for some reason interrupts the upgrade of your bed (for example, he becomes uncomfortable and does not want to continue).
We need to add these two tuning files for BED1 and CRIB1 (example - step 7), then change their name (example - step 6), replace the value in the object setting (example - step 9) and finally replace the old sample values with the new ones (example - steps 11.1 - 14)
Here are the values you will replace in the new interaction tuning files if you work with the same objects as me:
BED1 - line 469
CRIB1 - line 467
Let's check in the game:
In general, this is all we need to do to connect two beds together. Do not hesitate to ask if something is not clear in this guide. I will also be glad if someone can supplement it or simplify some steps, maybe some of my actions are done in a very primitive way.
In addition, I'm attaching
my package files that I created while writing this guide so you can refer to them as an example.