PDA

View Full Version : More customizing for your custom foods - my finds, want more :)


Jasana_BugBreeder
27th Feb 2007, 01:16 PM
I haven't seen this anywhere, or maybe I'm missed the thread somehow? If I did, please tell me where to search. If this is all new, I'd like to tell what I found now, because I'm likely to forget it to the time I end this project :(

First, simpler things - with menu.

Say, prototype for your new food appears only as Lunch, and you want to eat it for Breakfast as well.
Go to 'Function - Init - Menu' bhav and find a line like:
[prim 0x0002] Expression (My [semi] attribute 0x0007 ("Menu Time Availability") Set Flag flag# Const 0x2005:0x02 (Value: 0x0002))
Replace, or insert more similar lines, for times. 0x01 is breakfast, 0x02 is lunch, 0x03 is dinner.

If you want to change cooking skill required, go to BCON with instance 0x00001001. Here's the weird part - for interactions started from different menu items, different constants are used:
- for menu items 1,3,4,5,7 - cooking skill must be between Const 0x1001:0x4 and Const 0x1001:0x10, then your food will appear in menu
- for the rest, cooking skill must be between Const 0x1001:0x5 and Const 0x1001:0x11
That's from the code. I suppose those indices are for menu items from fridge, but either they should be numbered differently as in TTAB, or menu items 1,3,4,5,7 are Serve Snack, Serve Meal, Have Grilled Food, Serve Dessert, Have Dessert - I see no logic in this selection :| Anyway, looks like these pairs of constants are the same (0x4 = 0x5, 0x10 = 0x11) in different foods.

Now, the most interesting part - cooking. I'm about to give up to find the sequence of bhavs called :cry: but - preparation/cooking/eat types are set in 'Function - Init - Food', preparation code (animation and stuff) dwell in counters, cooking code dwell in stove/microwave/grill. The values and meanings for some of them are below.

Preparation
The line in init bhav is like:
[prim 0x0002] Expression (My [semi] attribute 0x0004 ("Prep Type") := Const 0x2002:0x04 (Value: 0x0004))
Constants:
0 - no preparation (i.e. TV dinner)
1 - pour (used by cereal)
2 - chop
3 - UNUSED - in base game, at least
4 - mix (in bowl)
5 - patty form (make cutlets for hamburger)
6 - UNUSED
7 - sandwich (put pieces)
8 - season (used by pork chops and salmon)
9 - stuff (used by turkey)
A - chop/mix (use food processor)
B - chop/season (no idea how it looks - found in code)
C - chop/stuff (used by lobster)
The fun part is that you can safely (seems so) change PrepType value. Useful when you want to make a food and there's no prototypes with suitable combination of prep/cook sequence.

Cooking
Cooking is most complex part - it is set as one or more flags (and not all I figured out :(), and the flags seem to be of OR kind. For example, hamburger has flags 4 (fry on stove) and 9 (grill) set - it can be cooked in one of these 2 ways.
So, semi attribute 0x05 is first set to 0, then you see one or more lines like this:
[prim 0x0002] Expression (My [semi] attribute 0x0005 ("Cook Types") Set Flag flag# Const 0x2003:0x04 (Value: 0x0004))
Constants:
0 - no cooking (i.e. chef salad)
1 - cook in toaster oven
2 - bake (in oven)
3 - cook in microwave
4 - fry on stove
5 - simmer (boil)
6 - unused? absent in code and not set in any foods
7 - fry on stove, then bake in oven
8 - bake, then flambe - used by Baked Alaska
9 - grill
A - slow grill
I hadn't tried to change cook flags, since I don't fully understand them, so any tests/hints are welcome :)
For example, I'm out of ideas why salmon has 1|2|4|5|7 cooking flags set. Usually it's fried then baked (flag 7); flags 1 and 2 should mean that it can be prepared in microwave/toaster oven when stove not available (if yes, why it doesn't appear in microwave menu, like TV dinner does?); don't know what to think about flags 4 and 5 - it can be just fried, or even boiled, if oven is busy?

Eat
The line in init bhav is like:
[prim 0x0002] Expression (My [semi] attribute 0x000C ("Eat Type") := Const 0x200C:0x00 (Value: 0x0000))
Constants:
0 - eat by fork
1 - eat by spoon
2 - eat by hands
Hadn't tried, but this looks like safe to change too. Unfortunately, creation of fork/spoon is buried deep in dish semiglobals, so using a custom spoon would be a pain :(

That's all for now. If someone knows more, or played with this, please share your experience :help:

callum91
8th Mar 2007, 02:12 PM
I have thanked for this as I find it extremely useful. Although I dont make foods,Ill keep this in mind if I can be creative enough to make a new food!
Thank you

Echo
9th Mar 2007, 11:57 AM
Just throw a few extras in here from my collected bits and pieces (mostly the old EdithWiki)...

Cooking 0x6 is apparently "Flambe", but I don't think it's used for anything in TS2.

Prep Type: Only one prep type is allowed per food.
Cook Types: Multiple cook types are allowed per food.
Fridge Reach Type: Determines what animation is used to remove the food from the fridge and what the food's initial container is.
Eat Type: Determines how a sim eats the food. Ex. Fork vs. sandwich
Time Availability: Determines when the food is available.

Each food can have one prep type and any number of cook types. For most purposes in the food chain's code, the prep type is treated as an enum and cook type as a bit-field. There are however instances where prep types are accumulated in a bit-field, specifically when determining availability of a particular prep type.

Most of the rest of the interesting stuff is in the BCONs. Hunger points, cost per serve, skill gain etc are all in 0x1001. Not being a food modder myself I can't say how accurate the list is, but I'll copy it here anyway:

Food Pts - Base: Base hunger satisfaction pts.
Food Unit Cost - Single: Cost of single meal in food units. Food unit to simolean conversion tuning can be found in "SG - Tuning"
Food Unit Cost - Group: Cost of group meal in food units.
Hunger Pts/Loop: Controls how fast a sim eats the food
Menu - Req. Skill - Single: Cooking skill required for availability
Menu - Req. Skill - Group: Cooking skill required for availability
Food Pts - Max Prep Pts: Maximum pts contributed to overall pts in the prep stage
Prep Time Max - Single: Maximum time in sim minutes of the prep stage
Prep Time Max - Group: Maximum time in sim minutes of the prep stage
Prep - Skill Gain Rate: Rate of skill gain (as a percentage of standard rate)
Prep - Skill Gain Rate - Group: Rate of skill gain (as a percentage of standard rate)
Group Meal Serving Count: Number of single meals that can be generated from a group meal of this type
Food Difficulty: Unused
Spoil Time - Hours: Time in sim hours for food to spoil. Single meals inherit their parent group meal's timer
Max Skill - Pts/Time - Single: Threshold above which sims receive maximum food pts and minimum time to complete the prep and cook stages
Max Skill - Pts/Time - Group: Threshold above which sims receive maximum food pts and minimum time to complete the prep and cook stages
Menu - Max Skill - Single: Upper bounds of required cooking skill range
Menu - Max Skill - Group: Upper bounds of required cooking skill range
Calories: Unused

Jasana_BugBreeder
14th Mar 2007, 08:07 AM
Menu - Req. Skill - Single: Cooking skill required for availability
Menu - Req. Skill - Group: Cooking skill required for availabilityAha - so it was for single and group counts, thanks :)
Group Meal Serving Count: Number of single meals that can be generated from a group meal of this typeTried to change it, and it worked! Good-bye to 6-portion-meals :) I always wondered why they chose number 6 - 4 or 8 looks more useful to me. Or... hm... it's not impossible to count sims on lot and set this count to the number of sims, right? I don't know about pets, though :( will they be included in SetToNext(person)?

Jasana_BugBreeder
16th Mar 2007, 05:55 PM
Reporting: changing EatType constant may produce weird/funny results - when you set to eat by hand and there's incorrect index in certain BCON :)

There's STR# list 0x85, which holds names of all CRESes for food states.
There's BCON list 0x1008 which contains indices of models from the STR# 0x85, which are used somewhere deep in the BHAVs to change food state (prepared/cooked/served/eaten/etc.).

So, some of those indices seem to be food states when:
0x1 - holding in hand while eating by hand
0x2 - preparing (just after taken from fridge)
0x3 - eating (state on plate/in bowl)
0x4 - serving
0x7 - frying
0x8 - boiling
0x9 - preparing - mixing in bowl

This list is not complete, just those I looked at while searching for fix. Problem was: for pancakes, 0x1 index pointed at frying state (with 'raw' material by default). So if you'd want to eat pancakes by hands, you could see then fully cooked pancake, while grabbed from plate to bite in, turns to raw dough :wtf:

fireflies
20th Apr 2007, 10:26 PM
I would like to thank Jasana for putting all of this in one place,
it's nice to see it here and not spread all over the forums, makes it difficult to look for.

I would also like to list a new fridge interaction based on the food
something i did not share as many new creators would have jumbled up the fridge with to many new interactions

If you change the line in "Text Lists"
usualy it is always the line called "Serve interaction.
(Example) "Serve Dessert" to "Serve Pies and Cakes"
it gives you a new fridge interaction called Well, "Serve Pies and Cakes" :P

Be careful not to make many as this will jumble up the fridge especialy with new foods,
try to keep new foods in your own new catigory.

Jasana_BugBreeder
21st Apr 2007, 06:34 PM
I would like to thank Jasana for putting all of this in one place,
it's nice to see it here and not spread all over the forums, makes it difficult to look for.Well, I just didn't found it anywhere else :( and I'm still hooked on making foods :)
If you change the line in "Text Lists"
usualy it is always the line called "Serve interaction.
(Example) "Serve Dessert" to "Serve Pies and Cakes"
it gives you a new fridge interaction called Well, "Serve Pies and Cakes" :PYes, you could write almost anything there, and there's one annoying mess as result of it, with translations. The thing is, if you simply leave just default translation, non-English gamers will get an additional menu (i.e. 'Serve Dessert'), food will not be combined into their localized menu. So you have to adjust all menus - or at least some, since it's quite a lot of work. Actually, Maxis didn't always update menus in their foods properly - you can see in some 'Omelettes' instead of menu name in rare languages :)


Actually, I wanted to report another mistake which I had - it's about chaning eat type to 'eat in hand' again, I just don't know where my eyes were before so I didn't noticed it :"(
The thing is, the 'in hand' state usually needs to be shifted a bit to fit in hand exactly. I chose to fix it that way: cloned (with Fix TGI) the 'eat' CRES, added its name to 'Model - Name' STR#, and put new line value to BCON 0x1008:0x01.
Result: half-eaten piece 'reverts' to full while in hands :( sure I forgot to fix 'CT - Model Update' BHAV - all the instructions for True branch of
Expression (Temp 0x0000 == Const 0x2007:0x03 (Value: 0x0003))
should also be done when Temp 0x0000 == 0x01.
Or, alternatively, I probably could add animation which shifts slice to needed offset, but it'll require to change 'CT - Model Update' as well.

Be attentive, don't repeat my mistakes :)

Morague
31st May 2007, 07:51 AM
Menu Type Flags (BCON 2001)

0x01 - Have Snack
0x02 - Serve Snack
0x03 - Have Meal
0x04 - Serve Meal
0x05 - Have Grill (not used)
0x06 - Serve Grill
0x07 - Have Dessert (not used)
0x08 - Serve Dessert

SG Model States BCON 2007

0x0 - Ingredients tray
0x1 - If Stack Object's 0x0009 (type) = Literal 2
0x2 - Counter
0x3 - Single plate
0x4 - Serving platter
0x5 - Oven Baking Pan if Local 1 = Literal 0
0x6 - Oven Baking Pan if Local 1 != Literal 0
0x7 - Frying pan
0x8 - Cooking Pot
0x9 - Mixing Bowl
0xA - Toaster Oven Tray if Local 1 = Literal 0
0xB - Toaster Oven Tray if Local 1 1 != Literal 0
0xC - Stove
0xD - BBQ Grill
0xE - Toaster Oven
0xF - Microwave
0x10 - Food Processor
0x11 - Fridge

Also, a good resource is http://simlogical.com/SMF/index.php Look for the Includes_FoodGlobals - when added to your SimPe folder it labels the constants in the BHAV for easy identification. Granted it only works for the food globals, but you can mport the labels into your custom food package & change the group/instance number to make it easier on yourself.

Jasana_BugBreeder
28th Jun 2007, 06:36 PM
By the way, my recent find - about food icon.
In the Food OBJD, Raw data, there's field '0x0048: object model guid 1 - Read-Only'. This field isn't really read-only, and it's value is the number of line in STR# 0x85 'Model - Name' - points to a CRES. Usually it's that <foodname>and plate CRES which seems to be unused. So you can safely change this field to, say, cooked state CRES index, and completely delete the food-and-plate stuff, if you want.

Morague
29th Jun 2007, 03:40 AM
I think that it points to the food & plate so it can create the proper thumbnail when the sim eats the food.

I recently had to track this down because one of my foods had a blank icon when the sim was eating - it turned out that I had reorganized the STR #85 list & the OBJ raw data was pointing to nothing. Once I pointed it to the right thing the icon got the food/plate thumbnail.

I have a feeling that if you remove the food & plate & just point it to the cooked state you will get the food in the thumbnail but not the food on the plate or in the bowl.

WesHowe
29th Jun 2007, 04:53 AM
Test list instance 0x85 line 1 is the usual place that points to the CRES in most objects. Not true for special things like fences and dog collars, but most of your regular catalog type items.

<* Wes *>

Jasana_BugBreeder
29th Jun 2007, 05:13 AM
I have a feeling that if you remove the food & plate & just point it to the cooked state you will get the food in the thumbnail but not the food on the plate or in the bowl.Yup, it'll be plateless. I don't think it's bad, though :)

Morague
29th Jun 2007, 06:15 AM
Hi Wes!

The foods are quite different - it just depends on where food & plate show up in the list. Frequently it's listed at #6 but..... it changes. I wish Jasana had posted this yesterday - I spent hours trying to figure out why the darn "eat" icon was blank. LOL, then I come here today to report & find Jasana has just done it. Foods are such a learning experience!

Jasana_BugBreeder
29th Jun 2007, 11:46 AM
I wish Jasana had posted this yesterdaySorry :( I actually figured it about a week ago, but was too lazy to post.

Morague
29th Jun 2007, 12:39 PM
LOL - well don't feel bad - I learned a lot by figuring it out too. I appreciate that you are so willing to share :)

mscalzi
6th Oct 2007, 10:26 AM
I haven't seen this anywhere, or maybe I'm missed the thread somehow? If I did, please tell me where to search. If this is all new, I'd like to tell what I found now, because I'm likely to forget it to the time I end this project :(

First, simpler things - with menu.

Say, prototype for your new food appears only as Lunch, and you want to eat it for Breakfast as well.
Go to 'Function - Init - Menu' bhav and find a line like:

Replace, or insert more similar lines, for times. 0x01 is breakfast, 0x02 is lunch, 0x03 is dinner.

maybe i'm stupid... i can't replace code because it doesn't let me write!! where do i write? thanks

joninmobile
11th Oct 2012, 07:30 PM
This isn't working for me. I have been successfully able to change the menu times many times. I just stumbled across this thread by accident while searching Google. I'm trying to change the prep states, and cooking states. From something cloned from gelatin. I want instead of no prep state to be season, and instead of no cook state to be bake in oven. At first I got a big thrill seeing this thread and wondering about all the different possibilities I could come up with, but it's just not working for me. The way I made it was just to bring up the PJSE toolbox and change the values using the decimal area to the desired result. Should I be changing something in the BCONs as well? Jasana didn't mention in the first post that you needed to change BCONs to make prep and cook states work, but I really may be missing something. I know I've seen the BCONs tossed around a good bit in this thread. Any ideas?