Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 4th Mar 2024 at 12:31 AM
Default Help with custom food stand
Hi, I've been looking for an alternative for a while to have customized foods in the game that are separate from 'common' foods (such as fast food, exotic foods, etc.) and I came across this customized food stand that does exactly what I wanted. :
https://modthesims.info/d/596122/la...food-stand.html
Unfortunately the author is no longer active in the community so there is no way to ask him how he added the foods, so I would like to ask someone's opinion on this. Any idea how he added the food to the stand? I believe it's maybe related to the CRES, Object function and OBJ data of the food files, but none of the tests I've done related to them have worked
Advertisement
Mad Poster
#2 Old 4th Mar 2024 at 12:53 AM Last edited by simmer22 : 4th Mar 2024 at 1:16 AM.
Usually if an object calls for another object to be created ingame, it's via GUIDs and text lists (and sometimes other resources) in the BHAVs. Seems like that's the case here, too. The spesific ones that look like they've got GUIDs are the "CT - Create Food" and "Interaction - Buy Food - TEST", and the text list "MakeActionString prim string set" seems to have the text for ordering food (although not sure if it's tied to a BHAVs or the pie menus, since the pie menu resources seemed a little bit scarce).

I'd think it would likely work with other foods too, if you cloned it, linked it up correctly, and changed the texts.

Looks like it has a lot of OBJDs (GUIDs), but likely because it's a multi-tile object. Normally, one is the "main" GUID. The GUIDs in the BHAVs are msot likely from the food items it's linking to.

The CRES data is mostly tied to the rig/skeleton, mesh, animations, etc.
The OBJD is the GUID plus a lot of info about catalog, pricing, etc.
The OBJFs seem to have ties to the OBJDs and BHAVs (I hardly ever do anything with this resource - except when reducing the footprint/grid, or fixing stuff for items that don't have BHAVs, like curtains)
Test Subject
Original Poster
#3 Old 4th Mar 2024 at 3:57 AM
Quote: Originally posted by simmer22
Usually if an object calls for another object to be created ingame, it's via GUIDs and text lists (and sometimes other resources) in the BHAVs. Seems like that's the case here, too. The spesific ones that look like they've got GUIDs are the "CT - Create Food" and "Interaction - Buy Food - TEST", and the text list "MakeActionString prim string set" seems to have the text for ordering food (although not sure if it's tied to a BHAVs or the pie menus, since the pie menu resources seemed a little bit scarce).

I'd think it would likely work with other foods too, if you cloned it, linked it up correctly, and changed the texts.

Looks like it has a lot of OBJDs (GUIDs), but likely because it's a multi-tile object. Normally, one is the "main" GUID. The GUIDs in the BHAVs are msot likely from the food items it's linking to.

The CRES data is mostly tied to the rig/skeleton, mesh, animations, etc.
The OBJD is the GUID plus a lot of info about catalog, pricing, etc.
The OBJFs seem to have ties to the OBJDs and BHAVs (I hardly ever do anything with this resource - except when reducing the footprint/grid, or fixing stuff for items that don't have BHAVs, like curtains)



Ohh I see. Thanks for the tip, I'll take a closer look at the guids
I was thinking that OBJDs are somehow correlated with food, but it makes sense that they belong on the stand
I will look to the BHAVs, and if have luck, comeback and share what i learn
Scholar
#4 Old 4th Mar 2024 at 1:56 PM
I'm currently working on a mod that allows the food stand menu to be customized per lot basis with adjustable prices, because I got fed up with customers having to "browse" the object. What Simmer said is about right. The default food stand indeed has a fixed list of foods in CT - Create Food, which the Local Chef NPC calls to spawn the food. The food ID starts in the TEST as "Stack Object ID". The names are in sequence in the MakeAction. This value travels into my interaction data field #1, chef's interaction data field, and then the param to that CT. Those are the "food menus" that are always loaded out of world.

With some work we could instead pass around the food menu object ID of any installed foods. Then the names can be read from the food menu too.

The OBJfs, among other things, link to a script that sets permitted intersection for each row of tiles differently. This permits the chef to walk into the court, but not someone else. And not walk through the stove, the counters or the chairs.
Test Subject
Original Poster
#5 Old 6th Mar 2024 at 12:33 AM
Quote: Originally posted by jonasn
I'm currently working on a mod that allows the food stand menu to be customized per lot basis with adjustable prices, because I got fed up with customers having to "browse" the object. What Simmer said is about right. The default food stand indeed has a fixed list of foods in CT - Create Food, which the Local Chef NPC calls to spawn the food. The food ID starts in the TEST as "Stack Object ID". The names are in sequence in the MakeAction. This value travels into my interaction data field #1, chef's interaction data field, and then the param to that CT. Those are the "food menus" that are always loaded out of world.

With some work we could instead pass around the food menu object ID of any installed foods. Then the names can be read from the food menu too.

The OBJfs, among other things, link to a script that sets permitted intersection for each row of tiles differently. This permits the chef to walk into the court, but not someone else. And not walk through the stove, the counters or the chairs.



Wow. Your explanation made me realize that I might not have enough knowledge to do what I was thinking of doing haha, but that's ok, nothing that a little more research won't help with. But thanks anyway, I hope your mod works, the idea is really cool! I hope you have luck with this
Scholar
#6 Old 6th Mar 2024 at 12:50 AM
Changing the list over to another is not that difficult. Here are a few more examples with different foods each.

https://modthesims.info/d/493689/co...revolution.html

Look at "sim2me_cake_foodstand_MESH" and compare it to "sim2me_tep_foodstand_MESH", to see how two recolors of the same object have differnet foods in them. He has converted the "Interaction - Buy Food - TEST" to private, and there passes on the food number 0,1,2,3,4,... with a command built from MakeAction.

There is a small bug in the food stand. When a person starts to sit down, he registers as a customer, but posts the food number chosen after he has sat down. If the chef looks at him in that window, he will not see the right food.
Test Subject
Original Poster
#7 Old 7th Mar 2024 at 9:49 PM
Quote: Originally posted by jonasn
Changing the list over to another is not that difficult. Here are a few more examples with different foods each.

https://modthesims.info/d/493689/co...revolution.html

Look at "sim2me_cake_foodstand_MESH" and compare it to "sim2me_tep_foodstand_MESH", to see how two recolors of the same object have differnet foods in them. He has converted the "Interaction - Buy Food - TEST" to private, and there passes on the food number 0,1,2,3,4,... with a command built from MakeAction.

There is a small bug in the food stand. When a person starts to sit down, he registers as a customer, but posts the food number chosen after he has sat down. If the chef looks at him in that window, he will not see the right food.




I took a look at the files and understood what they do, but my knowledge of behavior function is very superficial. Could you point me a tutorial? the editor part is kinda... scary
Scholar
#8 Old 8th Mar 2024 at 1:08 AM
That is the easiest part of modding. Much easier than graphics. Every rectangular box is an instruction that can go one of two paths, true or false, indicated by those colored lines. They are mostly arithmetic operations or comparisons of two numbers. If you click the Sort button, that might rearrange the lines so that they are more or less consecutive if they generally follow the green True path.

Programmer's Guide to BHAV

If you start with a Food Stand mod that has already been edited, it will include the programs "Buy Food - TEST" and "CT - Create Food" converted to private, meaning their instance numbers will start with the digit 1 instead of 2, and they are not shared with other Food Stands.

You can touch this code minimally if you don't understand it. You are mainly concerned with the number of foods there is. If you have fewer items on the menu, you need to terminate the script earlier. You can see it ends with food 9, but you can make it return true above that. The lines that say Const 0x2000:0x01 are basically very complicately written numbers 0,1,2,3... Don't worry if they say "Ramen".

The "CT - Create Food" code does not get sorted to look as readable, but you can more or less follow the numbers counting up. Here you are only interested in editing the 0020 Test Object Type instructions to the GUID of your Foods. Each food has 2 GUIDs, and you want to use the "menu" one which are always spawned on every lot. Make sure that the number 0 gives the GUID of the first food, number 01 the second and so on. If you have fewer than 10 foods, let's say 8, make the line after 7 point to one of the earlier foods. (Programmers count from 0.) This is because the chef will sometimes try to give you an invalid food, if he sees you sitting down, so he will give a good one by default.

After you make your changes, or want to switch to another script, you need to click the Commit button to accept your edits. They are not yet saved to disk, but only in memory.

When editing the food names, you want click Default Lang Only, to make sure you don't have wrong names shown for non-English users. And translate them later if possible.

If you want to start with a fresh cloned Food Stand, you will need to import the semiglobal scripts, which is a bit involved. You will need to assign them the private group number 0xFFFFFFFF, private instance number, then do the same to the interaction table TTAB, and reference your new instance numbers in it. Understanding the code in Buy Food will also be harder because it also tests for the model of stand it is, to give it the foods right for the location.
Screenshots
Test Subject
Original Poster
#9 Old 13th Mar 2024 at 9:23 PM
Quote: Originally posted by jonasn
That is the easiest part of modding. Much easier than graphics. Every rectangular box is an instruction that can go one of two paths, true or false, indicated by those colored lines. They are mostly arithmetic operations or comparisons of two numbers. If you click the Sort button, that might rearrange the lines so that they are more or less consecutive if they generally follow the green True path.

Programmer's Guide to BHAV

If you start with a Food Stand mod that has already been edited, it will include the programs "Buy Food - TEST" and "CT - Create Food" converted to private, meaning their instance numbers will start with the digit 1 instead of 2, and they are not shared with other Food Stands.

You can touch this code minimally if you don't understand it. You are mainly concerned with the number of foods there is. If you have fewer items on the menu, you need to terminate the script earlier. You can see it ends with food 9, but you can make it return true above that. The lines that say Const 0x2000:0x01 are basically very complicately written numbers 0,1,2,3... Don't worry if they say "Ramen".

The "CT - Create Food" code does not get sorted to look as readable, but you can more or less follow the numbers counting up. Here you are only interested in editing the 0020 Test Object Type instructions to the GUID of your Foods. Each food has 2 GUIDs, and you want to use the "menu" one which are always spawned on every lot. Make sure that the number 0 gives the GUID of the first food, number 01 the second and so on. If you have fewer than 10 foods, let's say 8, make the line after 7 point to one of the earlier foods. (Programmers count from 0.) This is because the chef will sometimes try to give you an invalid food, if he sees you sitting down, so he will give a good one by default.

After you make your changes, or want to switch to another script, you need to click the Commit button to accept your edits. They are not yet saved to disk, but only in memory.

When editing the food names, you want click Default Lang Only, to make sure you don't have wrong names shown for non-English users. And translate them later if possible.

If you want to start with a fresh cloned Food Stand, you will need to import the semiglobal scripts, which is a bit involved. You will need to assign them the private group number 0xFFFFFFFF, private instance number, then do the same to the interaction table TTAB, and reference your new instance numbers in it. Understanding the code in Buy Food will also be harder because it also tests for the model of stand it is, to give it the foods right for the location.



I tried for a few days but unfortunately I couldn't do it. At that point it stopped being fun, so I just gave up.
I just came back to thank you for helping me this far. If it weren't for that I probably would have given up much earlier Lol
Back to top