Post by Admin on Sept 12, 2013 3:29:58 GMT
The first thing to realize when you start hacking Sims objects is that they aren't just picture files. Objects are computer programs that tell the game things like where the object is, how it looks, how it sounds, what Sims can do to it, and other useful information. (Actually, each individual Sim is a similar sort of computer program.) Programs like Script Station and IFF Pencil decode the hexadecimal code of The Sims into English -- sort of -- allowing you to more easily modify it.
(There is a program called Edith that Internet legend tells us the Maxis programmers use create and modify objects. Edith was supposed to be released to the public at one point. Covetous hackers all over the globe are still waiting to see if this eventually happens.)
I chose a painting for this tutorial for two reasons. First a painting is the easiest new object to create. You just stretch your picture over the original. You don't have to do the back if you don't want to. You don't have to worry about creating a new alpha channel. No new z buffer. Kind people like Ophelia have even provided some beautiful frames for you to use.
The second reason is because paintings are also one of the easiest objects to hack. They only offer one type of interaction -- View. This means that there's a little code there to tweak, but not so much that you can't tell which command is calling which function.
So let's get started...
1. Create an Object to Clone
Clone a painting
Well, not just any old painting. Some of paintings don't have the coding we want to fiddle with included in their program. Several get their interaction coding from a global file shared by several art objects that creates a generic interaction. For your convenience, I'm including an object here called "ktblankpainting." You may download it by clicking on the picture below.
Download it into your game. (Sims Zip is a nice little program for taking care of just that.) Open T-Mog. Choose "ktblankpainting" and then clone it. T-Mog lets you change the title and description of the object. Change the title right now. You can come back and add an inventive description later. A unique title will help you find your object in the "Buy "catalogue in the game. It's also a good idea to use a program like Sim Categorizer to set where your object will appear in the catalogue. I have gotten into the game at times and have been completely unable to find my object. I almost went into tantrum mode, but luckily there was some fruitcake nearby....
2. Examine Extant Coding
Open your painting in Script Station
Actually, we're not going to do anything exciting yet. We're just touring.
The first box called "Semi-Globals" should be blank. Having Semi-Global and Global coding must be a very nice shortcut for the Maxis programmers to have at their disposal. Unfortunately, Globals are not good news for hackers.
Below that is a box titled "SimAntics Scripts." This coding that tells the game what to do with this object. It should read:
#4096: main
#4097: init common
#4098: adjust value
#4099: kill disease
#4100: View
#4101: View test
#4104: load tree
#4105: init left
#4106: init flower
#4107: react
As you might be able to tell from #4099, this object was cloned from the flower painting that gets rid of the guinea pig disease. We will be working on #4107: react.
On the other side of the page is a box titled "SimAntics strings." Under it is:
#129: a2o
#130: c2o
#301: Dialog prim string set
If you click on #129, you will see a list of the animations that are called when an adult Sim views this painting. #130 lists the animations for child Sims. #301 lists the contents of any dialog boxes that appear in the game when this object is used. For paintings, this set is always blank... because normal paintings don't talk back to people.... even in the Sims.
Below "SimAntics strings" is "Interation sections." It reads:
#129: Menu Options
#130:Painting - Flowers tree table
Click on #130... and voila! A whole new page of promising looking stuff. Your eye is caught, I know, by the box on the far side headed "Advertisement." Under this title is a list of all the motives we so long to tinker with. You're thinking, "I just change the number here and I'm golden!" Oh, would that it were so. Alas, no. This section only controls how appealing this object is to a Sim in the game when s/he is left to his own devices. See the box that says Autonomy threshold? This determines how likely a Sim is to interact with an object without orders from you. Our Autonomy threshold is at 50. You'll note that our only advertisement is for Fun and it's only an advertisement of 4 max. So few if any fun-starved Sims are going to be looking longingly at our painting as of now. Change our advertisement to a max of say, 100, and Sims would be flocking to it like flies.... which would be pretty mean since this object currently does not give out many Fun points at all. We'll change this one later when we've made the object more rewarding.
One helpful thing this page does is that in the box titled "Interaction Items" it lists the names of the program lines that control how Sims can interact with this object. The list is fairly bare for a painting object. Our only option is "View." You probably figured that out from the previous page. This is more essential when you're looking at an object with multiple interactions or one that has been cloned and modified. The original interactions may have names different than from the ones the modified object presently does. Both hackers and programmers at Maxis revamp old items.
Okay, tour's over. Close Script Station. (By the way, you usually have to close one of these programs in order to be able to access the files for the next program. T-Mog is a real pig and will not share files with any other program.)
3. Change the Animation
Open Animation Alchemist.
We're actually going to do something this time. Open the object you cloned from "ktblankpainting." Mine is called "ktgwen2." In the STR# box you should see two options listed: a2o and c2o. As you remember, "a2o" controls what happens when an adult Sim views the painting. We're just going to leave "c2o" on its own. You can modify "c2o" using the same method we're about to use, but I don't have any children in my game... or life. So I usually leave it unmodified for a reference.
Next to this, we have "Contents of STR# resource." It reads
#0 A2O-refuse-subtle
#1 A2O-approve
#2 A2O-consider
#3 A2O-disapprove
#4 A2O-shrug
When we get back to Script Station, I'll explain how I know this, but when a Sim views a painting, first the program calls the #2 "consider" animation. It tests whether or not the Sim likes the painting and then calls the "approve," "shrug," "refuse-subtle" or "disapprove" animations.
On the far side is a list of animations. The A2As are now showing. These are Adult to Adult animations. You can call these when you're working with an object, but they may look funny because the other person or persons are missing. To see what these animations look like, you need to go to another program. The Sims Character Makeover Studio displays many (but not all) of the animations at your disposal.
I've decided that my painting is going to dispense comfort to the lovelorn. Therefore, I'm going to look for some animations that involve pleading, touching the heart, and hanging the head. It's a good idea to look at the animations before you choose them because several of them are very, very short. Right off the bat, a2a-compliment-appreciate, a2a-kissee1, a2o-lonely2, and a2a talk-intense-loop look good to me.
The a2a-compliment-appreicate animation is going to become my animation for "consider." I select #2 A2O-consider in the second column then hunt for a2a-compliment-appreciate in the third column. (I wish this thing had a scroll bar. Hitting "page down" 75 times to get to the bottom of the list is giving me carpal tunnel.) Find the animation you want. Hit "set." Now #2 should read A2A-compliment-appreciate. Do the same to change as many of the animations as you want to. I changed both the "approve" and "disapprove" animations to the "talk-intense" animation, set animation #0 to "lonely2" and set "kissee1" as my #4 animation.
For this example, you will note, I was a responsible adult and picked animations that I felt would blend together seamlessly, rather than just picking freaky-cool things you rarely see in the game like I did for some of my other paintings. Follow either path as your heart instructs you.
Save your file and exit Animation Alchemist.
4. Test
Start up The Sims and test your object.
Get into the habit of doing this each time you modify. If you change too many things at once and foul something up, you may not be able to remember what you did wrong. Checking helps you catch little errors before they become big problems.
Okay, you probably noticed that the object's sound doesn't go with the animations very well any more. Let's change that. There are different ways of changing the sound. I wish that there was a Sound Alchemist program. Here is my hunt-and-peck style of changing sounds. First we go fishing...
5. Locating Appropriate Sound Files
Open up IFF Pencil
What I'm looking for is a sound effect that plays a short burst of human speech. I've decided that I'm most likely to find an appropriate sound file included in the programming for a telephone object. Open a telephone object in IFF Pencil. In the first column you see a list of resources that this .iff file contains. Select FWAV. In this case FWAV (31) means that this particular file carries 31 sound files. These FWAVs are listed for you in the second column. Click on #0. A pop-up tells you that this is the sound file for "phone-chance-vox." "Vox" is a good sign for me because "vox" files always contain human voice sounds. However since it starts with "phone" there's a good chance it will have that "canned" sound of someone heard through a phone's receiver. Usually the Maxis programmers try to give you hints about this sort of thing by giving sound files names like "talk" and "talkee" to indicate which side of the conversation or action is being presented.
After much deliberation, I've decided that #23 phone-talk is going to suit my needs. Pay attention to the size numbers next to each FWAV because... well, because sometimes size does matter. You don't want your sound to keep on playing after your Sim has walked away from your object.... at least, not usually. Also, some files only have male or female versions of their sound. For instance, in the genie.iff file there are several genie-vox files. If you choose them and attach them to objects, you won't have any sound when female characters access the object and your male characters will speak in the genie voice when the sound file is called.
Open your painting in IFF Pencil. Find the "Edit" button. Press it. Go to "Import". In the pop-up box that appears choose "Import One or more IFF files with resources." Don't check the overwrite box... unless you really want to. Open your telephone file. Select FWAV #23 and hit OK. Save your painting file and close IFF Pencil.
6. Insert New Sounds
Open up Script Station and load your object
In the SimAntics Scripts box, select #4107: react. These are the lines of the program that control the sounds and animation of the "View" action. (If you go to #4100:View, you can see that line 7, which reads "Private: react (Stack -1,-1,-1,-1), calls this subroutine... Well, you might not have realized that, but that's what's happening.)
When you click on #4107, a new page pops-up with 22 lines of programming. If you'll look at the end of each line, you'll see that after the command in line 1 is executed it sends you to line 2 which sends you to line 4 which sends you to line 3 which sends you to line 5, on to line 6, down to line 18, and here we have our first "Play Sound" command.
Click on line 18. In a daring and bold move, click on "Expert Edit" in the pop-up that appears. This is the hexadecimal code that calls this function. It should look like this:
Function: 23
Parameter 0: 2
Parameter 1: 0
Parameter 2: 0
Parameter 3: 0
Play Sound Event (Stack 2, 0,0,0)
Changing any of these numbers will change the instructions sent by this line of programming. Let's change one. Change the number of the function. Let's change it to a lucky number. How about 9? Now look at the instruction line. It reads:
Burn (stack 2,0,0,0)
That doesn't sound lucky at all. Change it back to 23. The Parameter we want to change is Parameter 0. This line tells the program which FWAV to play. Change this to 23. Now the program will play our phone-talk sounds at this point in the program. Hit Ok and Ok. Follow the number trail to line 20. Change using the same method. The program tests to see whether the Sim likes or dislikes the painting. Depending on the outcome, it sends us back to lines 9-15 where you see pairs of "Play Sound" and "Animate Sim" commands. The "Animate Sims" command works much like the "Play Sound" command. In Expert Exit, line 11 looks like this:
Function: 44
Parameter 0: 1
Parameter 1: 0
Parameter 2: 0
Parameter 3: 0
Function 44 calls the "Animate Sim" command. Parameter 0 calls the particular animation. This line is calling for Animation #1. Remember the list of a2o animations we changed in Animation Alchemist? That's the list the program is referring to here. Changing Parameter 0 will change which animation is called here. But don't do that. Find all the "Play Sound" commands. Change Parameter 0's to your heart's content. Save. Exit Script Station and test in The Sims.
Now let's move on to our special bonus package...
7. Increasing Motive Points
Open your object in Script Station.
Click on #4107:react. Go down to line 16. It reads:
my motives: Fun +=Constant Value 4096:0
Now we're getting somewhere. Click on 16. Click on Expert Edit. It reads:
Function: 2
Parameter 0:15
Parameter 1:0
Parameter 2:768
Parameter 3:6670
Exit and go to line 17.
my motives: Fun-=Constant Value 4096:0
Function: 2
Parameter 0:15
Parameter 1:0
Parameter 2:1024
Parameter 3:6670
The program is rewarding the Sim who likes the painting with some Fun points. It punishes the Sim who doesn't like the painting by decreasing his/her Fun level. How much? This is determined by a Constant Value held in line #4096. Let's click back to the main menu and see what that is.
At the bottom of the second column in the "Constants" box is line #4096: Tuning. Click on it.
The value for line 0 is 6. That's not a lot of fun, is it? I mean, think about it. In this game, looking at a painting you like gives you a barely noticeable raise in Fun. Playing with an IMac sends your Fun levels through the roof and keeps them there. Tells you something about the cultural sophistication of those guys at Maxis, doesn't it? But bless their geekish little hearts. If they didn't love computers so much, I'd probably be looking at paintings right now.
(We will decorously let it pass without comment that Sims also get as much fun from high-end computers as they do from sex. And that, in fact, computers are more dependable source of pleasure for them.)
Anyway, let's hack with this baby. You can increase the amount of Fun points by replacing the 6 with a higher number. The downside here is that sometimes the computer uses the numbers stored in the constant file for other functions. Changing it sometimes makes the object go wonky -- to use the technical term. At least that's what I think happens sometimes... It could be bugs.. or demons... or rabbits.
Since this is just a one-time boost in points, let's change the way the value is added. Go back to line 16 where Fun is added. Get in expert edit and change it to read as follows:
Function: 2
Parameter 0: 15
Parameter 1: 100
Parameter 2: 768
Parameter 3: 1806
Your command should now read: my motives Fun+=100
Now, if you Sim likes the painting, s/he will get 100 Fun points. Changing the number in Parameter 1 changes the number of points. In the original Sims game, you could only give them up to 100 points. After Hot Date, I think it went to 1000 if I'm interpreting what I've read in tutorials correctly. To change which Motive gets the boost change the number in Parameter 0 as follows:
3 = Mood
5= Energy
6= Comfort
7= Hunger
8= Hygiene
9 = Bladder
13 = Room
14 = Social
15 = Fun
I'm going to change my Parameter 0 to Social since this painting is comforting the lovelorn. I'm also going to change line 17 to the same thing since we're all about comforting here, not punishing.
And speaking of comforting, what could be more comforting than a gift of a little cold, hard cash? Save and test first and then...
8. Increase Simoleans
Open your file in Script Station.
Resist the urge to go to the "React" section again and go to #4100 View. We're going to add some programming. Press Add twice. You now have two new lines at the bottom of the page. They've been named lines 12 and 13 and filled with inoffensive idle commands.
Click on your new line12. Go to Expert Edit. Change the numbers to read as follows:
Function: 25
Parameter 0:1795
Parameter 1:25
Parameter 2:2
Parameter 3:2
Hit OK. Don't immediately go back to the main menu as we have been doing. Instead select from the drop-down menus in the "Next Instructions" boxes in the middle of the page so that it reads "Goto 13" for "success" and "return: ERROR" on "error." Line 12 should now read Budget of 0x03[0]: (25, Budget_Add, Misc_Income);
Now change your new line 13 as follows:
Function: 2
Parameter 0: 1
Parameter 1: 25
Parameter 2: 1280
Parameter 3: 1810
Change the "Next Instructions" to read "Goto 11" for "success" and "Return:ERROR" for "error."
Line 12 adds 25 simoleans to your Sims money total. Line 13 displays a little box over his/her head that says $25 when the program gives it to him/her. The amount of money is controlled by the number you put in Parameter 1.
Now go to line 4. Click on it and change the "Next Instructions" box to read "Goto Line 12" instead of "Goto Line 11" so the computer will be re-routed towards our new simolean-makin' subroutine.
Isn't that a helpful little trick to know? Sure would come in handy in my own life... Okay. Save and Test. We're now to the "making it pretty" part of the process.
9. Modify Menu Display
Open your file in Sims Menu Editor.
This program is provided to us by the good people at Maxis, bless their clever little hearts. You know, I would have bought the first Sims game out of curiosity, but I've bought four versions of this game just because they did little things like this that enable gamers to customize and bring dazzling variety to the game. Well, on to bring some dazzling variety...
This is a little thing, but always change the menu display to reflect what your modified object does. We see the menus over and over in the game. Inaccurate ones begin to get on your nerves... or at least on mine. Click where you see the word "View" and change the command to read whatever you want it to. I'm changing mine to read, "Tell Guinivere of your failed romance." Click save and you're outta there!
10. Modify Advertisement Rating
Open your file in Script Station
One more thing. Let's change the advertisement this object gives out. Click on #130 Paintings-Flower Tree. Now go over to the third column. I'm going to go to "Social" and change the numbers to 0 to 75. That's high enough so that Sims will seek it out on their own when they're low on Social ratings and not doing anything else. You might not want to go as high if you don't want your characters hitting a painting up for $25 every few minutes... Or developing a deep relationship with it rather than another Sim... After all, you can't take a painting with you to the lovebed, no matter how much you like it...
You can also vary how attractive the object is based on certain personality ratings. I'm going to vary mine by how nice the character is. I'm also changing the Fun rating to 0 so not to give out any false hope.
11. Correct Catalogue Display
Open your file in Sims Categorizer
In this program you can change the price, add a clever description, and set the categories where your object appears in the "Buy" catalogue.
And now, you've done it. You've got a new, tricked-out painting, all dressed up and ready for the Big Show. Enjoy and think up more exciting things do to with the tips I've given you.