#2

27th Nov 2024 at 3:26 AM
Posts: 1,659
Thanks: 3235 in 73 Posts
8 Achievements
While an object is inside the inventory, it is completely disabled and sleeping, so it cannot be used directly. Think of it like being in a sealed storage crate. The autonomous action should be placed on something that exists in the world. When they use, say, a music player, the action is on self (the person). This separate action should have the autonomous motives.
This action should be a short initiator, to take the item out of the pocket, place it on the floor or in the person's hand. Then you can push interaction onto this object, which you have already written. The test function should look for the particular object being present in the neighbor's memory. If not, then it should return false to hide itself. Also test immediately before taking it out. I would probably not actually remove the memory token until it is consumed successfully, not like they do with a cellphone, which could get lost.
You cannot easily add aditional options directly on the sim person, but there are ways around it. Something that always exists in the world can be a controller object. Off the top of my head, I don't recall if they can be used autonomously, but I think they probably can. Controllers (object type = 7) are spawned on all lots. They have no visible body. If you want the action to be visible and clickable, you can make this controller into a Social Plugin (category = 0x56). These will be searched when clicking on a person and additional menus inserted into them.
Creating a Social Plugin is a bit complicated. You need to wrap your head around what is stack object and param 0 from multiple perspectives. There is a guide somewhere. The whole effort is to get the textual command on the menus without modifying person. If you only want autonomous usage, then maybe you only need the actions on the controller. As an example I can offer my hack of the Controller - Maintenance (in my cleaning duties mod), which holds actions to do the cleaning. The command stuff is in "CT - Object Menu" and "CT - Object Menu Command".