Replies: 0 (Who?), Viewed: 6697 times.
#1 19th May 2019 at 4:36 AM Last edited by Phantomknight : 12th Jun 2021 at 8:24 PM. Reason: Added anchor
Thanks: 160 in 2 Posts
How to Change the Mesh/Model of a Mod into a Different Custom ObjectHow to Change the Mesh/Model of a Mod into a Different Custom Object
Credits & Resources:
Inspired by: Tired of burying your batbox? Change the models of favorite mods easily in SimPE By Sunrader
Couldn’t Have Got Started Without: Shastakiss, who answered my question on Tumblr and pointed me in the right direction
Other Necessary Tutorials/Info That Are Consolidated In This One:
FFS Lot Debugger is mutated into the small glass vase - DIY package By Lord Darcy
Changing the Object Placement By Numenor
Using all of the above, I was able to piece together how to do this and I’m listing the instructions on how to do the object placement again because not only is it relevant for this particular project, but also, it’s helpful when more than one person explains things. I also think I provided a couple of more detailed pictures, which can be extremely helpful for simmers unused to editing and modding in SimPE.
I am by no means an expert, however, so if you see something that needs updating/clarifying/correcting, or if you have some tips to share, let me know! Finally, pictures are behind spoilers for slower computers and Word and PDF versions have also been uploaded below for posterity--these might be slightly different than what's below since I proofed and edited this post again after I made the file.
1. the mod you are working on in case anything goes wrong; save a copy of the original file somewhere.
2. Open the .package that contains the object mesh for the mod with SimPE. Check if the file has any TXMT, TXTR, CRES or SHPE resources. If so, delete them and save a copy of the mod with a new name. (Right click, then select Delete. Doing so shows a strike through the line of the resource you deleted. Once the mod is saved, the lines will be completely deleted.)
3. Open the .package file of object you want to change the mod into. Extract the GMDC, GMND, CRES & SHPE resources. (Make sure you are viewing All Resources. Sort resources by Type, then select the lines with GMDC, GMND, CRES & SHPE in the Type column. Ctrl + click to select more than one line at a time. Once all lines are selected, Right Click and select Extract. Choose where to save your extracted files.)
If you do not want the mod to be slaved to the original mesh, also extract the TXMT, TXTR, and MMAT resources. (Not sure if all [TXMT, TXTR, & MMAT] are required to make the new file standalone, but it should definitely standalone if you export all 3.)
4. Sort the resources of the custom object by Instance. Find Instance 85 (0x00000085), the model name (might be called 3D Object Names or something similar, but the Instance is always 85). Select the line and copy the model name from the String box using Ctrl + C (name appears in second line).
5. Open the mod you are editing. Find Instance 85 (0x00000085), the model name, and paste the model name from the custom object into the String box. Commit File.
6. Click AllRes (All Resources) and import the GMDC, GMND, CRES & SHPE resources. (Right click on any white space in the Resources List and choose Add. Select the files you extracted earlier. You can also drag and drop.)
7. Check the Object Data. Make sure a catalog category is selected. Now is also a good time to edit the price, if necessary. If you want to keep the original mod and have both versions, you can also change the GUID in this tab. Otherwise, the new file will overwrite the old file. Don’t forget to Commit File after any changes are made.
8. Save the mod with a new name.
9. Test the mod. Does it show up correctly? Is the mod placeable on all the surfaces you want to place it on–counter, mantles, tables, end tables, coffee tables, the ground, etc? If yes, YAY! You’re done! If not, read on.
DO NOT FIX OBJECT INTEGRITY — Doing so seemed like a good idea, especially since I’m not a pro and am still learning what I’m doing, but in my experience, doing this just led to crashing. So, yeah, don’t do it.
Changing the Object Placement of Your Updated Mod
A Bit of Background About Modding
I want to give a bit of background knowledge here, so that a simmer not only knows what they are doing, but can also figure out how to do something else. I feel this is important because I only realized how to do the steps in this tutorial after reading a bunch of beginner tutorials that didn’t even seem related at the time. I was reading up on a bunch of different things because I was trying to learn more about modding. And once I had read a few different tutorials, the pieces finally clicked together and I was able to go back to Lord Darcy’s & Numenor’s steps and figure out how to get the results I was looking for. So I want to pass on the knowledge that I know, especially since I see so many simmers on here that seem confused by SimPE. If you're familiar with SimPE, though, go ahead and skip this section, or use Numenor's tutorial.
So, when beginning object modding, you should take the time to learn terms and phrases, and one of the most important terms is Semi Global. According to the Sims Wiki, most objects in TS2 are categorized into groups. These groups are then governed by Semi Global resources, and these Semi Globals differ by group. For example, all paintings have a set of Semi Globals that tell the game paintings should behave in a certain way and have certain functions. Thus, think of Semi Globals as instructions for an object, and these instructions differ depending on the object type. This is why sculptures, for example, do not behave the same way paintings do, and have their own functions and placement, etc.
In short, the way an object behaves and the functions it has depends on its Semi Global & object type, and the reason why our modded object is not placeable on certain objects is because its Semi Global either outright says the object is not placeable where we want to put it, or simply lacks the proper instruction to begin with. Now, theoretically, one way we could get the functions we want is to import resources from a Semi Global that does have the proper instructions into our mod package file. In fact, modders can and do make mods this way, and this is what you’d do if a resource--like a Pie String--was missing. You would import the resource you need from either the original Semi Global, or another Semi Global that has the resource you need. (FYI, when changing a Semi Global, or importing resources from another Semi Global, you would also have to fix references in the file, so that they refer to the right place.)
This is NOT the way we will be fixing object placement, however, Instead we will be fixing it via a method akin to an override: by editing the Init BHAV.
According to Numenor:
|The ‘Init’ BHAV is a set of instructions that are executed every time an object is picked from the catalogue and placed on the lot. These instructions may define multiple aspects of the object behaviour, among which its placement.|
I interpret this to mean that, by adding functions to the Init BHAV, we can tell the game to override an object’s Semi Globals, and perform certain functions. Looking at a Init BHAV file can be quite daunting at first, but reading the text in the Instruction Setting box can tell us what’s going on. According to Numenor’s tutorial, we can add flags to tell the game where we can place our object and that’s what we’re going to do now.
1. Open the mod file. Click on the Init Bhav (The line that reads “Function — Init”; you can click on Behavior Function in the Resource Tree to help you find it.) and check the lines in the resource to see which flags are missing.
For more info, you can read the Changing the Object Placement Tutorial, but basically you are looking lines that say “[prim 0x0002] Expression”. These lines are formatted as: My 0x00NN Set Flag Literal Value 0x00MM. Or, in other words, we are telling the game, ‘set this object with X type of flag, with X value’. That value then translates to a specific action or function.
For example, consider the following line from an object mod:
[prim 0x0002] Expression (My 0x0004 (allowed height flags) Set Flag flag# Const 0x0101:0x08 ("end table" Value: 0x0008))Though this modder used “Const” and we are going to follow Numenor’s tutorial and use “Literal”, I can see that this line tells the game that this object is placeable on end tables.
Take some time to read some of the other lines and figure out what they mean–it could come in handy later! You might see lines like this:
[prim 0x0002] Expression (My 0x0028 (flag field 2) Set Flag flag# Literal 0x0008 (Cannot Be Stolen))Notice “0x0004” has changed to “0x0028”–it’s a different flag group called “flag field 2” and it’s value is telling the game “cannot be stolen”. You might see other lines that say similar things, like ‘cannot be billed’ or ‘cannot be burned’. If you want to make sure a mod object can’t be burned, stolen, or counted towards household bills, you would add these expressions. In this way, you can learn about how a mod works and how to create a mod yourself.
2. Let’s add the missing functions by adding lines to the Init BHAV. Click “Add”. Depending on the last line in the resource, or the line you are currently viewing, you may have to change the OpCode. Either type “0x0002” or click the triangle next to the OpCode box, Click the “Primitives” tab, sort by Values (Val) and select “0x0002”, Expression. Hit “Okay”.
Click the Pop up Wizard (little hammer & sickle). Everything is named with this wizard. In the first drop down choose “My”. The second field will then switch to a drop down. Lots of selections can be chosen, but we’re going to focus on flags. Choose “allowed height flags”*. This is where flags for object placement data are, and we can select flags for placeability on the floor, counters, end tables, coffee tables (low tables), dining tables (tables), mantles (decorative), in counters, or on OFB shelves, etc. The second line will now change to read “My: allowed height flags”.
On the third drop down, choose “Set Flag”**. On the fourth drop down (4th line, on the left side), choose “Literal”. On the final drop down (4th line, on the right side), choose the surface you want to place the object on. Click “Okay”.
*Other Notable Flags:
Flags — flags for if an object can be walked through, or stepped over, etc.
Wall placement flags — flags for what types of walls are required to place an item, like if a sink, toilet, or painting needs a wall behind it
Placement flags — if an object can be allowed on terrain or on a slope, etc.
Movement flags — if an object can be picked up with the hand tool (players can move it/hand tool cannot move it) or deleted in the catalog (players can delete it/hand tool cannot delete it)
Placement Flags 2 — if an object’s height can be adjusted (AL shifting), if an item is placeable in deep snow, or on the roof, etc.
Weight — also available as a line in object data; this determines how many items are placed per shelf on OFB shelves. (0 = large object, 1 per shelf; 1 = medium object, 2 per shelf; 2 = small object, 6 per shelf)
**If we wanted to remove a behavior, we would select “Clear Flag”.
3. Setting the True Target: When editing BHAVs, each line’s “True Target” must point to the next instruction. And the last line should “Return True”.
You can manually change the True Target to point to the next line by typing the line in the box. (You can use the number outside the parenthesis. So “0x13(19)” would be 13 and “0x1C (28)” would be 1C.)
Typing in each target may not be completely necessary, because you can use “Inge’s InitLinker” but I like to follow the way the mod is currently set up & continue adding expressions based on the way the modder started. So, since the modder set up each line’s “True Target” and “False Target” to point to the next line, I will continue that pattern.
Otherwise, if you don’t want to update the new lines manually, once you are done adding expressions to the Init BHAV, click “Inge’s InitLinker”. This will update the lines in the Init BHAV so that they point to the next instruction and so that the last line returns true. Please note that on more complicate mods, you may not want to do this, as the flow of instructions may not be in order.
Also, if your mod had a blank expression set up for the last line, or an expression that says “no op”, you may want to keep that line, and make sure you’re last line matches. Otherwise, using Inge’s InitLinker should make sure that the last line Returns True.
4. Commit File & save with a new file name. Test in game. Does the object show up? Is it placeable on all the surfaces you added? Does the object still retain its core functions? If yes, YAY–you’re done!
If the object does not place the way you want, check the Init BHAV. Be sure you did not forget to add an expression or forget to edit each line’s True Target, so that it points to the next line. If you do not do this, then any lines added after will not be read. You may also need to add an expression for an object’s weight for it to be placeable on certain surfaces.
Again, be sure that you do NOT fix object integrity. In my testing, lots of crashing occurred. You should only need to fix integrity if you are importing SemiGlobals and resources that point to different references, which we are not doing in this tutorial.
Otherwise, remember to after each step and keep copies of the originals until you are finished. Try to add things slowly so that you can troubleshoot easier and pinpoint at which points you are having trouble.
Your mod’s new mesh does not pick up recolors, and only has the default texture of the custom object you changed it to. The repository technique will have to be used in order to pull recolors of the custom object: Slave Object Tutorial - Repository Textures From Maxis Objects by IgnorantBliss.
I haven't actually been able to apply the repository technique successfully yet, but once I do, if I see any nuances needed in the tutorial in order to make a mod's object mesh pick up recolors, then I will add to this tutorial. For right now though, this is good enough. I've already changed pescado's Lot Sync Timer, DiLight's custom memory manager, and several tattoo crates, so I feel confident that these steps should work for someone else.
Thanks again to everyone mentioned above and anyone else I may have forgotten!