Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Test Subject
Original Poster
#1 Old 10th Sep 2019 at 8:39 AM Last edited by hmiller61615 : 23rd Sep 2019 at 10:15 PM.
Default [Solved] Adding food to a sim's inventory in a specific state?
I'm playing around with making a hunting mod, where a sim does the "Go for hike" interaction and comes back with a dialog box saying what they caught, and some raw meat in their inventory that's ready to be prepared. Maybe a little gruesome, but I'd like to make my tribal family a little more realistic.

I'm currently trying to have it add the maxis ribs in its 'raw' state, but I'm having no luck. I can get them to come back with a plate of cooked ribs that gives the option to "resume cooking" but when selected the sim has a thought bubble of a '!' next to a counter, as if indicating there is no counter space. I tried with regular meals and they cook just fine, so it's not a counter issue.

How do I force the Ribs to be added to the sim's inventory in a specific state? And why can't they prepare the food in its current state? Image attached to show the sub BHAV that adds the ribs to their inventory (I'm sure I have a long way to go).

https://imgur.com/a/lQdNx3g
Advertisement
Lab Assistant
#2 Old 10th Sep 2019 at 7:01 PM Last edited by KatKaleen : 10th Sep 2019 at 9:17 PM.
I don't fiddle with BHAVS, but I recently stumbled across a medival themed Sims 2 site, and they had lots of cool things like chickens, cows, goats, animal traps and much more.
Sims have to interact with an object and instead of an unfinished meal, they get an animal carcass in their inventory which they can sell or use to stock the fridge, but maybe that angle could work, making a custom object they find on a hike to stock or sell.
Thanks to PenelopeT, who posted some links in another thread, I found out the site was http://www.medievalsims.com/forums/...37d2b3a6f5e845a
Test Subject
Original Poster
#3 Old 11th Sep 2019 at 8:26 AM
Ooh, thanks for the link - there might be something in there that already does basically what I want to here.

But darn, I was hoping to avoid making custom objects for this, haha. I figured since the meshes and states of raw food already existed as a Maxis object, it would be easy to just call that object. But you may be right, I might have to create a custom object. For now I've found the Sims Wardrobe Food Replicator, which is able to set any food ready for eating on a counter, so maybe I can try extracting something from that to get it to work with a sim's inventory.
Test Subject
Original Poster
#4 Old 23rd Sep 2019 at 6:47 AM
It is possible! I was able to add the raw ribs to the sim's inventory, I'll go ahead and post what I did in case anyone wants to do the same thing or if I need to find it in the future, haha.

Whenever food changes from one state to the next, it runs the tree 'CT - Model - Update'. But that BHAV needs to know 3 semi attributes before it can run correctly:
1. 0x000 - what state the food is in (preparing, prepared but uncooked, cooked, etc.)
2. 0x0003 - what type of meal it is (single or group)
3. 0x0009 - the stage progress (seems to match up with state)

It also needs to know what container the food is sitting in, so before 'CT - Model - Update' can run, the food needs to snap into the container. Here's how it looks up until then:

Node 0: [prim 0x0002] Expression (Local 0x0000 := Stack object ID) Loads the object that's clicked to make the interaction as Local 0
Node 1: [prim 0x002A] Create new object instance (0x2C06F94A) Creates the ingredients tray into the stack object, floating in the sim ether
Node 2: [prim 0x0002] Expression (Local 0x0002 := Stack object ID) Loads the ingredients tray as Local 2
Node 3: [prim 0x0002] Expression (Stack object's [semi] attribute 0x0000 := Literal 0x0000) sets the trays state as 0
Node 4: [prim 0x002A] Create new object instance (0x8C85C05E) creates the ribs into the stack object, also floating in the sim ether
Node 5: [prim 0x0002] Expression (Local 0x0001:= Stack object ID) loads the ribs as Local 1
Node 6: [prim 0x0002] Expression (Stack objects [semi] attribute 0x0000 := Literal 0x0003) sets the ribs' state as 3, which is 'prepared but uncooked'
Node 7: [prim 0x0002] Expression (Stack objects [semi] attribute 0x0003 := Literal 0x0001) Sets the meal as a group meal
Node 8: [prim 0x0002] Expression (Stack objects [semi] attribute 0x0009 := Literal 0x0003) sets the stage progress as (I think) 'prepared but uncooked'
Node 9: [prim 0x0071] Snap Into (Stack object ID, Local 0x0002, 0x00) Since the ribs are still the stack object, this snaps the ribs into Local 2, which is the ingredients tray
Node A: [private 0x1011] Sub - Update Food Model (Local 0x0001) Calls a sub BHAV that runs the tree 'CT - Model - Update'. That sub BHAV only has 3 nodes:
---->Node 0: [prim 0x0002] Expression (Stack object ID := Param 0x0000) Calls the stack object Param 0
---->Node 1: [prim 0x0002] Expression (Stack Object's category == Const 0x0106:0x24) I'll be honest, I'm not sure what the category is that it's setting it to, but it worked after copying it from another food-related mod
---->Node 2: [prim 0x001C] Run Tree by Name ("CT - Model - Update") Works as long as 'CT - Model - Update' has been added to the Text Lists (STR#) 0x0000012F 'named trees'

Since the ribs are in the prepared state as a group meal inside the ingredients tray, it will update to the correct state!

Now to add the whole thing into a sim's inventory, the stack object has to change back to the ingredients tray:
Node B: [prim 0x0002] Expression (Stack Object ID := Local 0x0002) Calls back the ingredients tray as the stack object we're talking about
Node C: [prim 0x0002] Expression (Stack object's render alpha := Literal 0x0000) OPTIONAL - if you want to make the ingredient tray invisible, so that only the meat appears in the inventory (note: it will still be labeled as 'ingredients tray' once placed in the inventory)
Node D: [global 0x044A] Inventory - Visible - Add Item (Stack object ID, My neighbor id, Literal 0x0000) Adds the ingredient tray, along with the ribs that are snapped into it.

Then, if there's a desire to have a dialog box pop up with an image of the ribs:
Node E: [prim 0x0002] Expression (Stack Object ID := Local 0x0001) Calls back the ribs as the stack object
Node F: [prim 0x0024] Dialog (Text notification, Message: "message goes here", TNS Style: System) Makes a dialog pop up to the top right, with an image of the rib.

Hope this ends up being helpful to someone else! I was wishing for something like this when experimenting, so hopefully this simplifies the process for others.
Back to top