Nona's Sims

Modding and Troubleshooting The Sims 3

Tutorial: How to Change the Script Class of an Object

Note: If yu’re reading this because of my Custom Food Script, you can get already edited OBJK overrides here, and you can find out how to do batch processing of OBJK resources here.

The purpose of this tutorial is to teach a mod user how to change the script class of object. This tutorial is intended for use with my Custom Food Script object mod (MTS). However, once you know how to change an object’s script class, you can apply this knowledge to mod other objects (for example, a candle which behaves like an incense burner from WA).

To complete this tutorial, you will need:

  1. Custom Food from ATS3, One Billion Pixels, or Parisian Sims.
  2. If your custom food is not in package form, you will need to convert it with Delphy’s Multi-Extractor (you can use Delphy’s Multi-Extractor with Mono) or Echo’s Lepid Llama Unpacker,.
  3. S3PE, or some other Package Editor. I use S3PE, and this tutorial will show how to use S3PE. It should not be difficult in other package editors.

What is a Script Class?

In short, an object is defined by its script class. Some of the most popular examples of changing an object’s script class to make it work like something else are Jynx’s Rabbit Hole Rugs. Creating a rabbit hole rug is a bit more complicated than simply changing the script class of a rug to that of a rabbit hole, because the slots and footprint of the rug must be changed (Jynx has a tutorial at Custom Sims 3). However, the basic reason that Jynx’s rugs behave as a rabbit hole is because they use a rabbit hole class instead of a rug class. Basically, an object’s model is just that: a  model. It does not determine how the object functions, or what interactions are associated with it.

Similar to Jynx’s Rabbit Hole Rugs, Custom Edible food is merely a custom mesh which uses the WA DriedFood script class. This is why snob sims dislike those custom foods, unless you use my Custom Food Script object mod. Of course, the problem with that is, if creator’s don’t use my script in their creations, users will have to edit the object themselves. This is an extremely easy process, but I thought I’d make a tutorial, with pictures, to make it even easier, for anybody who is nervous or unsure about editing objects.

Script classes available with my Custom Food Script

You can use any of the three following script classes with my Custom Food Script. See the post to find the default hunger gain/buffs.

  • Sims3.Gameplay.Objects.FoodObjects.NonaDriedFoodLow
  • Sims3.Gameplay.Objects.FoodObjects.NonaDriedFoodMid
  • Sims3.Gameplay.Objects.FoodObjects.NonaDriedFoodHigh

Changing an Object’s Script Class

Finally fixed the pictures!

Before you begin: Make a back up of your package, just in case! Also, back up your save game, just in case. This is a really easy process, but you never know what might happen. Best to be safe by having some back ups.


Click on an image to see a larger version.

1. If your object is not already in package format, convert it now using one of the tools I’ve listed above (or any other tool if you have another you prefer).
2. Open the package in s3pe.
3. Click the “Tag” column to sort by Tag.
4. Find the OBJK resource.

We found the OBJK resource.

5. Right-click the OBJK resource and choose “Edit OBJK”

Time to edit the OBJK resource.

6. In the component column, find the cell labeled “Script.” In the same row, you will notice a field labeled “String:” which will likely look like this: Sims3.Gameplay.Objects.FoodObjects.DriedFoodHigh

This is what the OBJK Editor in S3PE look likes.

7.  You can change that string (outlined in pink in the picture above)  to use another script class. For example, you could change it to: Sims3.Gameplay.Objects.FoodObjects.NonaDriedFoodHigh

IMPORTANT: Do not put a space or any other character at the beginning of the string (in front of Sims3 ) or the object will crash your game when you try to buy it in Buy Mode. If this happens, just go back and remove the space/extra character.

8. Once you’ve finished editing the String field, click Save in the bottom left corner (see above).
9. S3PE will ask if you want to commit the changes. Click Yes.

Heck yes, I want to commit changes (SAVE!).

10. Finally, save the edited package: Hit Ctrl+S or go to File | Save. If you did not back up the original file, you may want to use File | Save As.

11. ONE MORE THING: Before you start your game with your edited objects, go to Documents\Electronic Arts\The Sims 3 and delete the scriptcache.package to make sure your objects will use the new script. Any previously purchased objects may need to be sold and re-purchased.

Congratulations! You’ve just edited an object to use a different script class. I recommend that you load your game up and try to buy all the objects you edited, to make sure that you didn’t manage to sneak in a space or extra character at the beginning of the script class name. All objects in the game must have a script class that starts with “Sims3.” or the game will crash when you try to buy the object. If you have a typo in the middle, or at the end, it’s not such a big deal. The game will not recognize the object and you won’t be able to use it. However, if you only discover that you accidentally put a space at the beginning of the script class after you’ve been playing for a few hours and haven’t saved, you might hate me! I don’t want you to hate me, so please go test out your objects 🙂

Easy, wasn’t it? Feel free to ask any questions or post comments. You may also send a PM at MTS.

May 7, 2012 - Posted by | Tutorial | , , , , , , , , , ,

12 Comments »

  1. […] finally, you can read this tutorial with pictures to learn to change the ScriptClass […]

    Pingback by Script mod: Script for Custom Foods (removes Foul Food, Tunable) « Nona's Sims | May 11, 2012 | Reply

  2. […] may also edit the OBJK resources in this package to use a different script […]

    Pingback by Already Edited OBJK Resources for Custom Food « Nona's Sims | May 13, 2012 | Reply

  3. […] If you want to use a CC hamper with this mod you can either provide me a link to the CC hamper, so I can make an override for you, or you can make one yourself. […]

    Pingback by Super Hampers — Automatic Laundry Pick Up (Plus Bigger Hampers) « Nona's Sims | October 25, 2013 | Reply

  4. I love what you guys are up too. Such clever work and exposure!
    Keep up the awesome works guys I’ve added you guys to my own blogroll.

    Comment by Sb game hacker | June 30, 2014 | Reply

  5. Hello Nona,

    is it possible with this Tutorial to build own Rabbitholes?
    I want to use Sunsetvalley school and other Schoolrabbithole.
    That means two Schools in one town.
    Long time ago i used two Schools in one town,but it doesn’t was
    possible to put child for example: from Rabbithole School
    to Sunset valley school. I think its because Town
    only can use one Schoolrabbithole,otherwise i think
    i just duplicate the Rabbithole and use this tutorial.
    What do you think?

    Thanks for reading 🙂

    Comment by Rina | July 27, 2014 | Reply

    • Seems no….hm…ok.

      Comment by luise | September 21, 2014 | Reply

  6. Hello Nona!

    I’m not sure if you are still keeping this blog, but I thought this would be the place to ask my question, just in case. 😉
    First of all, I hope you are fine and your projects are going well.
    Now, to my question. I’m sorry, I think it’s more than one.
    In order to make a regular CC hamper behave like a Super hamper, first do I need to clone the original hamper?
    If I do Not clone the original, if I make any changes, this means I would only have one modded cc hamper, right?
    If I make a mess of the original this way, to fix it, can I just clear my caches, and place the un modified original back in the packages folder?
    Finally, the most important thing. I read this tutorial and as far as I understood, the ONLY change needed to make a cc hamper behave like a Super hamper, is to add the word “Nona”, to the String data? Is this word, your name, the exact word that corresponds with the Super hamper Mod?

    I’m truly sorry to bug you, but your mod, and the fact that you encourage its users to try and make our own super hampers following it, and my addiction to the sims, nag at me to try. 😀

    Thank you very much for sharing your mods and wisdom!

    Comment by RedMallie | April 2, 2016 | Reply

    • Hi Redmallie, I could be wrong but I think the answer is above but I will try to help as I am just learning how to do this myself.
      1. Clone the CC Hamper you want to use
      2. When you clone it give it a name so you can tell your clone from the original
      3. I have already downloaded the super hampers. Go to one of the hampers itself (not the other file Nona has supplied that you download with the hampers)
      4. Open that hamper(Nonas) in S3PE
      5. Go to the OBJK
      6. Click in the bottom of S3PE and click Grid
      7. Click on the componentdata > to the right click the 3 dots
      8. A new pop up> click on CDTString > Copy the Script Class > Close out of the whole thing
      9. Now open your cloned hamper in S3PE.
      10. Follow the same steps to bring you to the Scrip Class
      11. Paste the Script Class from the Nona Hamper
      12. Commit the changes and click Save
      13. Close S3PE.
      14. Add the new package to your Mods folder where you have Nona’s hampers.
      Now you should have a working hamper. You will need to clear your script cache before the game will recognize it.

      I hope this helps. Like I said I am just starting out with this so it’s been trial and error with me. I come back to Nona’s guides just in case something doesn’t work right.

      Comment by madone | April 23, 2016 | Reply

      • Madone, thank you very much for helping. 😉
        Yes, Nona has the information in her tutorial, but being a total newbie at doing anything like this, I just want to be sure and extra sure that I get it, hehehe.

        My main question is about the original hamper. By cloning the object and modifying this clone, I can keep the original as it was, right?

        This means that I could put the original AND have the “magnetized” clone in my game together.
        Or I could choose to have ONLY the “magnetized” hamper, right? I would prefer to have only one hamper instead of two for each one in order not to clutter the game so much.

        I appreciate your time and help, Madone.

        Comment by RedMallie | April 23, 2016 | Reply

  7. You’re Welcome. If you clone one from the game I believe it does keep the original one in the game. I have only used this to update a custom content hamper because the ones in the game look huge to me lol. I think the original one I had in the game before the clone might have disappeared or I might have taken it out because I didn’t want the original one anymore.

    With S30C you can create the clone by clicking cloning normal objects and it will import all the objects you have (including EPs) right into the tool. Then you can get your clone to change the script class and name it your super hamper name as a package and I believe that is how it will leave the original one in the game if you are looking to modify a game hamper.

    Comment by madone | April 24, 2016 | Reply

  8. Hi if this page is still active can you do the same with just animations in the game or is there a different process and do you go about it the same it an xml file btw

    Comment by Kay | November 30, 2019 | Reply

  9. That was so helpful! Thank you for the instructions

    Comment by André | January 29, 2024 | Reply


Leave a comment