#4

23rd Sep 2019 at 6:47 AM
Posts: 63
Thanks: 1718 in 33 Posts
9 Achievements
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.