Post by orangemittens on Apr 10, 2015 14:02:19 GMT -5
This tutorial will show you how to add a small decorative slot container to an object that has no slot. It will go over how to find the correct number to enter for positioning the slot using Blender and it will show the basics of what that number means so that you can apply this knowledge to moving slots on other objects. It will not go over other types of slots and questions regarding other types of slots are beyond the scope of this tutorial.
What you will need
Sims 4 Studio 188.8.131.52 or above
1. Click Create 3D Mesh under the Object button.
2. Click the Object button.
3. Select the item you wish to clone and click the Next button. Name and save your .package.
4. This tutorial will use the EA item so I will export the high LOD mesh. If you're doing the same thing name and save the .blend and then open it in Blender. If you're working with a different mesh just open the mesh in Blender.
Determining your slot position
5. In Blender select your object's main mesh group and go to Edit mode.
6. Right mouse click one of the vertices that is part of the face you want to place the container slot on.
7. Click the n key on your keyboard to bring up the side menu.
8. Scroll up to the top of the menu so that the Transform section is visible. The X,Y,and Z numbers there define the postion of the selected vertex. Write them down. I used Notepad to write them down but you could use pencil and paper if you prefer.
9. Repeat with a second vertex that is on the opposite side of the face in the X direction (side to side).
10. Write down the second set of numbers.
11. You will note that the previous steps resulted in two sets of numbers that differ only by what the X number is. We will use those to obtain the X number for the slot. For the Y number you can click a vertex that is on the same face but opposite your first one in the Y direction (back to front). In the case of my object it is lying across the origin so I am simply going to use 0 as one of my Y numbers. This will allow me to obtain the number halfway between my first Y value and the origin. This is the point marked by the star below and it's where I want my slot to sit. If this isn't clear at the moment it will become so as you read on.
12. After doing all of the above I get the notes shown below.
- To calculate my X value I take the two X values I obtained and add them together. Then I divide by two to get the value for a point that lies directly in the middle of them.
- To get my Y value I add the value I obtained from the first vertex I checked to 0 (because I'm using the origin as one of my points) and divide by two to get the value that lies in the middle of the origin and the front of the sofa arm. I then remove the negative sign because Blender and the game read the Y direction opposite from one another.
- I don't need to calculate the Z value because the entire face has the same Z value so I just use the number Blender gives me for Z.
The matrix defines the layout of these numbers in the game. Later when we look at an existing EA slot's transformation (the number which determines the slot's postion on the object in the game) you will see the matrix all spread out in a line. Here I've put the numbers in the matrix form to more easily show what it is. 1, 0, 0, 0, is X. 0,1,0,0 is Z. 0,0,1,0 is Y. The transformation number will also contain a 1 at the end to terminate the matrix. To generate your number put all of the matrix numbers in sequence with commas between each digit. The order should be X,Z,Y. When you get to the last line plug in the values calculated from the object in Blender. Then put a 1 at the end to end the matrix.
1,0,0,0,0,1,0,0,0,0,1,0,Your X,Your Z,Your Y,1
Adding the slot to your object
13. The best way to make a new slot is to copy the way EA makes a slot for their items. The first thing to note is that each slot has a matching bone in the Rig resource. I have cloned an EA coffeetable to use as the model for my rig and slot. For this tutorial you don't have to clone a coffee table yourself because it will look the same as, or quite similar to, this one. You will need to note down the fields that are present here and enter the same value into the fields of the Bone you add to your .package. After clicking on the Warehouse tab and the Rig line the Bones section shows up on the right. The Edit Items button will open the Bones section.
14. Once in the Bones section I click on the Bones in the Bone list until I find one that is a small decorative slot. The name _deco_sml is what EA uses for many, if not all, such slots. They number them in sequence for each slot in the .package. This is the Bone that needs to be added into your .package in order to create a functioning slot. Note down the Flags number and the slot name. Copy the NameHash also.
15. Now that you know what needs to be present to create a working Bone for your slot open your .package and go to the Warehouse. Click the Rig line and then the Bones Edit Items button as I showed above. Click the Add button to add a new bone. It will create a new bone that has 0's or blanks present for everything. The bone will be added to the bottom of the list if you need to find it again later after closing the .package.
16. Add the Flags number you noted down from the picture of the coffeetable Bone above.
17. Put in the Name and the NameHash number.
18. Copy your X, Y, and Z values (only those three numbers not the entire matrix line) into the Position line.
19. Put 1,1,1 into the Scale line so it matches the Scale line of the coffeetable Bone Scale line.
For illustrative purposes only: this is the Slot in the coffeetable.package. Note that it has the same BoneNameHash number as the bone we just added to the .package. The transform line has the matrix I discussed above all set out in one single line. This is the same layout you need for your slot to have.
20. After clicking the Save button in the Editing Bones box you will return to the Resource list page. Click on the Slot line and then the Edit Items button on the ContainerSlots line.
21. If your item has no slots the Container slots list will be empty. Click the Add button to add an empty container. It will show up on the list on the left and on the right you will see lines all filled with 0's.
22. Copy the NameHash that you got from the Bone that corresponds to the _deco_sml_1. This number is the hash of the name so it must be exactly right. Paste that number into each line that has a check mark in the illustration below. This will be three fields: BoneNameHash, NameHash, and U2.
23. Enter the number 1 into the ContainerSize line. This number corresponds to a small slot.
24. Copy the entire matrix you created into the Transform line.
25. Click the save button. This will return you to the resource list page. Don't forget to click the Save button there too or else all your work will be lost.
Put the .package into your Mods folder and check it in the game.
Adding an additional slot
26. Adding a slot to an item that has one already is somewhat easier. Click through the Bone list until you get to the last _deco_sml_ slot bone it has. Click the Copy button. It will appear that nothing happened because the information on the right side will not change. It is an exact duplicate of the bone you copied so you now have two identical bones in the .package.
27. Change the last number in the Name line so it is one greater than the bone you copied.
28. Click on the bone directly above.
29. Click back on the bone you just added. Doing this allows Studio to update the name hash for your new bone's new Name. This is the name hash number you should copy so that you can paste it into the new slot you will add.
30. Enter the X, Y, Z of the new slot into the Position line. You will need to calculate that the same way you calculated the slot position above.
31. Return to step 21 and follow the remainder of the steps involving the Slot resource. Save and test in the game.
Moving an existing slot
32. Calculate the position for your new slot. If all you're doing is moving it up or down you just need to click on a vertex that is on your object's surface and get the Z value. The X and Y values will not change so you don't need them.
33. Open the .package, click on the Warehouse tab, and go to the bone section. Change the value in the Position line for each bone you're moving. The matrix will already be there so you will only need to change the three numbers which correspond to the X, Y, and Z. If all you're doing is raising or lowering the surface of the item you will only need to change the Z value. Once you have edited all the bones you're moving save the rig. Back on the main Warehouse page click the Ctrl key, the Shift key, and the c key all at once to bring up the Cheat Console. Type the word rigsync in and save the .package. This will cause all the slots which correspond to the bones you just edited to be updated to match your edits.