How do I make a piggy bank for Vacation Tokens?
by cloning C&C's Forgotten Piggy Bank

Jake K. writes:

     ... What I want is some way to consolidate a family's game tokens (from the Vacation expansion pack) so they can pool everyone's together to buy a prize. Something like the magic coins piggy bank from C&C Enterprises except for prize tokens instead of magic coins. I'd modify that piggy bank myself if I knew how,...

Well, Jake, here's one way go about it using IffPencil (PC):

Step 1 : Decide whether you want to add the vacation token option to the existing piggy bank or make the vacation token version a separate object.

That seems a fairly obvious step one, I know, but I wanted to take a moment to examine a hacking factor you'd take in while making it. Adding a new-but-similar function to an object generally means duplicating coding that already exists and then picking through it to make changes so the two sets of code don't conflict. Cloning the object and replacing on token (or motive or skill or food) for another *might* be as simple as swapping GUIDs. The coding in objects can vary so much from object to object that either of these choices might be simple or wildly messy.

It sounds like you have a second object in mind so we'll go with cloning it.

Step 2 : Gather what you need.

Along with your cloned pig you will need the GUID (Global Unique ID or "object id number") of the Vacation Tokens. You can find this by either a) using a FAR editing program to extract a copy of the vacation token's iff file and looking inside of it, or b) using the cloning program to take a look at the iff file (you may need to hold the CTRL button while loading T-mog up to get this file to appear on your list) or c) - my favorite - using Wilf's GUID List which can be downloaded from Wilf's Sims Stuff's Hacking Info section. This is a simple text )txt) file that lists all GUIDs in the game up to Makin' Magic. You just pop it open and use your text editor's "Find" feature to find anything you want such as ...

Inventory_PrizeToken.iff      ExpansionPack4.far      Inventory - Prize Token      5F 5F AD 7F

You'll also need the GUID of the Magic Coins. Wilf's GUID List cannot help with that one as it stops short of Makn' Magic but I've used another program to generate a list of ExpansionPack7.far's contents ...

TokensMagic.iff      Magic Token - Currency      EC 1B E8 99

Step 3 : Replace all Magic Coin GUIDS with Vacation Ticket GUIDS.


(Fig. 1) Replace magic coin GUIDs ...


(Fig. 2) ... with prize ticket GUIDs ...


(Fig. 3) ... and edit Parameter 1.


(Fig. 4) Edit "True line:".

Open each BHAV in turn and look for the words "Manage Inventory" (Function 51). Highlight each of the lines that you find and glance over to the lower right at the "Data" box to see if this line has the magic coin GUID (EC 1B E8 99) listed.

Normally an object's GUIDs is listed in the first four HEX Parameter boxes of a BHAV but tokens, on the other hand, are listed in the last four HEX Parameter boxes. (see fig. 1)

In this particular object you'll find magic coin GUIDs in the seven places. Replace each with the vacation token GUID. (see fig. 2)

In addition to swapping the GUIDs you'll need to declare what type of token we are working with (apparently this is not needed for magic coins. Interesting.) On each of the following 6 BHAV lines you'll change "Parameter 1" (see fig.3) accordingly:

  • BHAV 4100 - Line 66 - GUID swap and in "Parameter 1" change "1795" into "1027" *
  • BHAV 4101 - Line 67 - GUID swap and in "Parameter 1" change "1792" into "1024"
  • BHAV 4117 - Line 0 - GUID swap and in "Parameter 1" change "1795" into "1027"
  • BHAV 4160 - Line 4 - (which doesn't appear to be an active BHAV but let's make the changes just in case, eh?)
  • BHAV 4164 - Line 4 - GUID swap and in "Parameter 1" change "1792" into "1024"
  • BHAV 4166 - Line 4 - GUID swap and in "Parameter 1" change "1792" into "1024"

* You may have noticed that BHAV#4100 has another magic coin line (line 67) that is not listed above. Due to a quirk in the prize tickets we wont be able to simply swap out a couple of numbers. Instead we need to replace that line a new one AND we'll need to change the order of the lines a little bit to keep everything running smoothly.

Step 4 : Edit BHAV 4100 "Store Goods" further.

First we'll change line 67 to accommodate the Vacation Token quirkiness.
Highlight line 67 and, n the Data box to the lower right, change the Function from "51" to "436" and fill all 8 of the HEX Parameter boxes with "FF" so the line now reads

(glob:) Prize Token - Remove - 1.5

Next we'll rearrange a couple of lines.

  1. Reopen BHAV 4100 and highlight line 66 once more. In the Data box to the lower right, change the "True line:" field from "67" to "68". (see fig. 4)
  2. Next highlight line 67. In the Data box to the lower right, change the "True line:" field from "68" to "254".
  3. Finally highlight line 68 and in the Data box to the lower right, change the "True line:" field from "254" to "67".
To see the changes you've made in action right click and choose the "Re-write" option. You'll find the last two lines (67 and 68) have now switched placed.

Click OK to close the BHAV Editor window.

Step 5 : Replace the interaction menu text.

  1. Open the TTAB resource. You'll see a list of the object's interactions. Replace all "Magic Coins" references with "Prize Tokens". This has changed the text for US English games only. To accommodate games in other languages you must also open the TTAs resource. The US English page has been updated for you. If you are able to actually translate your text into other languages you may use the drop down menu to enter text for languages individually. If you do not have the translations you may simply un-check "Use different languages" and everyone will see the text as you've entered it.

  2. This object also uses a dynamic menu. Open STR#302 ("MakeActionString prim string set"). As with the TTAB, replace all mentions of "Magic Coins" with "Prize Tokens". Similarly to the TTAs you may use the drop down menu to modify each of the other languages manually or un-check "Use different languages" to allow everyone to see the text you have entered.

  3. There is also a small quirk in the piggy bank that effects the interaction menu In the TTAB a couple of the menu optons have not got any text in them. One of the two options is using a dynamic menu so is not causing a problem. The other, however, is displaying the name of BHAV #4132 on the interaction menu. Go back to the BHAVS, right click on BHAV 4132, and "Rename" it to "Get All Prize Tokens" (or whatever text you want displayed)

Modify the look and buymode info as you would normally and ... congrats on your new object!!

Here's mine with one extra modification. *
Download
* This one has 2 graphic states so you can see when the jar is empty and when it's not.

Author: Raeven