Difference between revisions of "Tutorial: Custom Paintings in Sims 3"

From SimsWiki
Jump to: navigation, search
Line 1: Line 1:
[DRAFT 7/7/09. To be updated with screen shots and instructions on editing name, description and price.]
 
 
 
Making custom paintings in Sims 3 is challenging at the moment, and very likely somebody will be along with a tool to make it easier, but it is perfectly doable with a little concentration. You're going to need a variety of tools and techniques here, so if the very idea of hex editing or package unpacking scares you, you might want to wait till somebody codes a tool that automates all this ;)
 
Making custom paintings in Sims 3 is challenging at the moment, and very likely somebody will be along with a tool to make it easier, but it is perfectly doable with a little concentration. You're going to need a variety of tools and techniques here, so if the very idea of hex editing or package unpacking scares you, you might want to wait till somebody codes a tool that automates all this ;)
  
Line 95: Line 93:
 
#* [[Image:StblImport.jpg]]
 
#* [[Image:StblImport.jpg]]
 
# Chose File|Save As, and name your mod whatever you want... for instance, Sri_Puppet_Painting.package.
 
# Chose File|Save As, and name your mod whatever you want... for instance, Sri_Puppet_Painting.package.
# Close S3PE, copy the .package file to your mods folder, and test in-game.
+
# Close S3PE, copy the .package file to your mods folder, and test in-game. It should be in the Paintings catalog sorted correctly by the price you set. Make sure the title and description are correct as well.
 
# Congratulations! You just made a Sims 3 object mod :D
 
# Congratulations! You just made a Sims 3 object mod :D

Revision as of 00:52, 16 July 2009

Making custom paintings in Sims 3 is challenging at the moment, and very likely somebody will be along with a tool to make it easier, but it is perfectly doable with a little concentration. You're going to need a variety of tools and techniques here, so if the very idea of hex editing or package unpacking scares you, you might want to wait till somebody codes a tool that automates all this ;)

Snaitf deserves all the credit for discovering the method documented here; I've just fleshed out the steps. Note: the three-part music painting can't be recolored using this method; there may also be other problematic paintings, please comment if you find any.


Contents

You will need:

What we are going to do is find the file for the painting object you are going to clone and its image file. You will edit the image file with your new painting, and make the object file point to the new image file. You'll set the object's price in the object file, and create a new string table file containing the painting's name and description. Then you'll make the object file point to the string table and save the new files together as a mod.


Find and extract the .dds file for the picture you want to clone, and modify it

  1. Open S3PE.
  2. Click File|Open, and navigate to GameData/Shared/Packages in the folder your game is installed in (e.g. Program Files/Electronic Arts/The Sims 3).
  3. Fullbuild2.package is the file that contains the images you want. Open it.
    • Openfullbuild2.jpg
  4. Check Sort and Display resource names, and click on Name to see the names of the resources. The paintings all start with the word "painting". Scroll down till you find the one you want. I went for PaintingAnimalGiraf.
    • PaintingResources.jpg
  5. Each painting has a few files resources with it; select them all, click File|Export, and choose or create a folder to put them in (anywhere you want). They'll be saved with the .dds extension.
  6. Open the .dds files in your image editor of choice. It should be readily apparent which one has the painting's image in it; close the others.
  7. Make a note of the part of the painting's filename between underscores right before the world "painting". For paintingAnimalGiraf, it's C1ECA4110BC90E09. This is the instance ID; you'll need it later. (You can use the Paste Bin in Snaitf's FNV generator to save it temporarily, or Notepad if you want a permanent record.)
  8. Modify the painting image with your art, flatten the file, and save it, choosing DXT5 compression in the DDS dialog.
    • PaintingOriginal.jpg PaintingResult.jpg
  9. Now you need a new instance ID for your modified painting. Generate one using the hash generator. Using Snaitf's generator, you can just click on Input Text, and then on Generate... that generates a hash based on your name and the date/time. Select the hash under FNV64/Normal.
    • SnaitfsFNV.jpg
  10. Rename the image file, replacing the part of the filename containing the old ID with the new ID you just generated.


Find and modify the corresponding object file to point to your image

  1. Back to S3PE. Open FullBuild0.package.
  2. Sort by name again. Scroll till you find a set of resources with a name similar to your image file; in our case, paintingAnimalGiraffe.
    • PaintingObject.jpg
  3. Of those, you want the Object Definition file, which is the one with the value 0x319E4F1D in the Type column. Select that one, click File|Export, and export it to the same folder your image file is in.
  4. Start your hex editor, and open the object file.
  1. You are now going to replace every mention of the original texture file with the new texture file. The trick is, the numbers are in the hex file BACKWARDS... and each digit in a hex string is written with two characters... so you have to reverse the order of each pair of characters, keeping the order the same within the pair. Luckily, Snaitf's FNV generator has a function that will reverse the numbers for you.
  2. So, in our case, we want to replace C1ECA4110BC90E09 (old instance ID) with 8AAFF83C1BB5A6E6 (new instance ID). In WinHex, click Search|Replace Hex Values. In Search For, I put 090EC90B11A4ECC1 (the reverse of the old ID). In Replace With, I put E6A6B51B3CF8AF8A (the reverse of the new ID). Select Replace All Occurrences, and click OK. It should make seven replacements. Click File|Save. You can leave your hex editor open; we'll be back.
    • HexIDReplace.jpg
  3. Now we need a second new instance ID for our modified object file. We pull out the hash generator again. This time I put in Sri_Giraffe_Painting_Object_070709_22:50, and I get out 3EF918961F858995. In Windows, I rename the .object file I just hex edited, replacing the old id part of the filename with the one I just generated.


Make a string table with your painting's name and description

We're going to use Postal to set up your string table.

  1. Download this file and save it in your Postal folder: http://chii.modthesims.info/getfile.php?file=950518
  2. Start Postal.
  3. Go to Plugins | Open Console.
  4. In the GroovyConsole, click File|Open, and select new_stbl.groovy.
  5. Find this line in the script: "stbl.strings.put(new Long(Checksum.fnv64("[STRING KEY]")), "[STRING VALUE]")"
  6. Copy that line and paste the copy right below the original, so you now have two identical lines. You're going to use them to make two entries in your string table, one for the painting name and one for the description.
  7. In the first copy of the line, replace [STRING KEY] with some text. (Leave the quotes, but replace the brackets.) To make it unique, use your name and the date/time, e.g. "Srikandi 7/14/2009 10:39pm". This will be used to generate an ID for the string table entry.
  8. Replace [STRING VALUE] with the catalog title of your painting.
  9. In the second copy of the line, replace [STRING KEY] with slightly different text; e.g. "Srikandi 7/14/2009 10:42pm", to get the ID for the second entry.
  10. Replace [STRING VALUE] with the catalog description of your painting. The result should look something like this:
    • PostalSTBLScript.jpg
  11. Go to Script|Run, and close the console (you don't need to save the script).
  12. You should now be able to see your new string table in Postal. Double-click the line in the top pane, and the two lines of your string table should show in the bottom pane.
    • PostalResult.jpg
  13. Make a note of the two IDs on the two lines. You'll need these values later.
  14. Click the Hex View tab, and then click the Export button. Save the string table in the same place where your other project files are.


Make your object file point to the new STBL, and set a price

  1. Go back to your Object file in your hex editor. Scroll almost to the bottom, where the catalog entry is. In the text pane, you'll see something like "CatalogObjects/Name", with dots in between the letters.
  2. Put the cursor on the C in Catalog, and hit left arrow 18 times, to move the cursor back 18 bytes in the file. As you move the cursor in the text pane, you should see it moving in the hex pane as well, a pair of characters (one byte) for every text character you move it back. When you're on the right character in the text pane, click the first character of the highlighted hex byte to start typing. (The start of the highlighted area in the picture below shows the position; the characters in your file may differ).
  3. You are going to type the reverse of the ID of your object's title from the STBL you made (omitting the 0x you saw at the beginning of that line), and immediately after it, the reverse of the catalog description ID (again omitting the 0x). You can use Snaitf's FNV tool to reverse the IDs.
  4. So, since my title ID is 7c57de5cf2359443 and my description ID is 6163575ce2aad111, I am going to type (without the spaces) 43 94 35 f2 5c de 57 7c 11 d1 aa e2 5c 57 63 61 . You'll see the spaces separating each byte in the hex editor. Your typing will overwrite the data that's already there.
  5. When you're done, there should be two bytes you haven't changed before the C in "Catalog"; the data you've changed will show blue in the hex editor.
    • HexSTBL.jpg
  6. While we're in this file, we can set a price for our new painting. I want mine to cost $600. The game expects the price to be a floating point number, and to input that value in the hex editor, I need to convert it to hexadecimal format, so I go to this web page: http://babbage.cs.qc.edu/IEEE-754/Decimal.html . I type 600 in the top text box, and then click the "not rounded" button. The result I want is "single precision hexadecimal", i.e. 44160000.
    • FloatToHex.jpg
  7. The price goes right after the end of the "Catalog" section of the object file. In the case of my painting, the text in this section is "CatalogObjects/Name:PaintingAnimalGiraffe CatalogObjectsDiscription:PaintingAnimalGiraffe". I put the cursor on the "e" in the second "Giraffe" in the text pane, and move over one byte; then I click on the first character of the corresponding byte in the hex pane, and type in my value, reversed. So I'm typing in 00 00 16 44.
    • HexPrice.jpg


Put the new files together in a package, with multiple language versions of the STBL

  1. Almost there! First, we're going to rename the string table (.stbl) file with an ID which includes a language identifier. Change the first two characters of the ID part of the filename (the part right before the file extension and after the third underscore) to 00 (the language identifier for English). So my STBL file is now named S3_220557da_00000000_007706233A6CAEAF.stbl .
  2. Now, back to S3PE. Click File|New.
  3. Choose File|Import, and select the .dds file, the .object file and the .stbl file you worked on.
  4. Now you're going to import the .stbl file 16 more times, replacing the first two characters of the ID every time. Each new copy of the string table corresponds to a different language. The string tables all going to be in English (or whatever language you wrote your text in), but at least the text will display properly in other language editions of the game. The two-digit language identifiers are 00, 03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0E, 0F, 10, 11, 12, 13, 15 (you can see what languages those correspond to here: Sims 3:STBL Languages).
  5. So: Click File|Import, choose the .stbl file you already imported again, click OK, and then you'll see a dialog called "Resource Details". Here you can change the language identifier of your string table. In the "instance" field, replace the third and fourth characters of the ID (after the 0x) with O3. Click OK. Then repeat, importing the same file 15 more times, and putting a different language identifier from the list above at the beginning of the instance ID each time.
    • StblImport.jpg
  6. Chose File|Save As, and name your mod whatever you want... for instance, Sri_Puppet_Painting.package.
  7. Close S3PE, copy the .package file to your mods folder, and test in-game. It should be in the Paintings catalog sorted correctly by the price you set. Make sure the title and description are correct as well.
  8. Congratulations! You just made a Sims 3 object mod :D
Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox