Posts: 136
Thanks: 365 in 7 Posts
6 Achievements
To check if an object is present in Sim's inventory I use [prim 0x0033] Manage Inventory. It should be set to "Set To Next Token Of GUID", token is the GUID of the object you want to check if it's present. Set target inventory to Singular Neighbour. Neighbour should be My person data 0x001F (neighbor id). Since you want to check for an object, category should be set to visible non-memory.
Here's an example:
Index doesn't have to be Local 3, it can be any other local as long as Local Var Count is correct. I think it's the best not to use previously used local.
Repeat this procedure for every object you want to check. If you want your Sim to have more than one object of some kind to be able to use crafting station, you have to loop it. E.g. you want your Sim to have at least 3 objects of some kind in their inventory. Before you use prim 33, use prim 2 (Expression) and set it to read "Local 0 := Literal 0". Then use prim 33 like I explained you to do (but set index as Local 1). Set true target to the next node, which should be prim 2, make prim 2 read "Local0 += Literal 1", true target should point back to prim 33. False target of prim 33 should point to prim 2 reading "Local0 >= Literal 3". True target of that node should be true and false traget of that node should be false.
Another example:
You can also make node 3 point to node 4 and set false target of node for to point at node 2 and then set false target of node 2 to false.
This will be the function that checks is the crafting station can be used, so you'll want to name it something like "Interaction - Use Station - TEST". Give your function instance different from the others. When you're finished with this BHAV, you should move to Pie Menu Functions. In "Use Station" or whatever you're going to call it menu, set Guardian BHAV to point to your "Interaction - Use Station - TEST" BHAV.
Removing an object from inventory is similar to checking for its presence. What is different is that after you have found the object, you make the true target of Manage Inventory (Set To Next Token Of GUID) point to another prim 33, which is set to "Remove Token At Index". In this prim 33 (Remove Token At Index) you set inventory to Singular Neighbour My person data 0x001F (neighbor id) like you did in prim 33 (Set To Next Token Of GUID). Index has to be the same you used in prim 33 (Set To Next Token Of GUID).
It's something like this:
I hope I didn't make it look too confusing.