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!
Lab Assistant
Original Poster
#1 Old 12th Jan 2024 at 5:01 PM Last edited by VivificusZombiae : 12th Jan 2024 at 5:18 PM.
Default prevent sims from purchasing same object by checking for GUID in inventory
hi all! been an incredibly long time since ive last posted in here.

i play with traits/color traits with the immersive rain mod and umbrellas mod and love them so much! HOWEVER, its a complete PITA to add umrellas to all my sims' inventories. my particular gameplay is quite rainy so they should have umbrellas!
i have a sim that owns a home business but ONLY! sells umbrellas, thats it. my thinking was: this will be great, sims can come in, buy their umbrella and itll be their fave color and leave.

WRONG! sorta. sims come in and buy up umbrellas, playables and townies but i did not previously consider the following:

they will either buy 1, check out and leave - sometimes come back to buy another (i make them leave but its annoying) OR
they will just buy up multiple umbrellas for no reason and theyll have a bunch in their inventories so i still then have to do inventory management - sorta defeats the entire reason why i made this lot in the first place.

simler90 doesnt even have a mod for this and they have mods for EVERYTHING! BO and squinge's mods (nosaveitem and simulated sales) do nothing to help this either.

is this possible? if so, can someone guide me in the right direction? i just want a mod that does a check to see if a sim already has an item with a GUID in their inventory already and would either cause the sim to either:
- not show up at all since this lot ONLY! sells umbrellas, thats it, nothing else
- just browse
- simulate the purchase but not deduct funds or add the item to inventory (so smashing BO and squinges' mods together somehow but also has the check for the GUID)

ideally, id like this to work as such: click on the umbrella > business settings > prevent sims from purchasing this item if already owned (game would then do a check for the GUID within the inventory) and then decides the sim either JUST browses or simulates the sale.

itd sorta be like the proscription mod from long long ago where you can block sims from specific objects BY its GUID; its incredibly helpful!

i do not know how to mod or even go about this; so i am in zee dark entirely. any help is appreciated!!!

edit: idk how to spell today

Now playing Waverly Chronicles, rotational gameplay
Advertisement
Theorist
#2 Old 24th Jan 2024 at 5:22 PM
I haven't played businesses enough to know this, but I thought that when playable Sims buy something, it appears in a special inventory tab where, once you stop playing the business lot and switch to the household of the buyer, you get to choose whether you wish to keep what they bought, or undo the sale. Does undoing the sale not credit the vendor?
Inventor
#3 Old 25th Jan 2024 at 7:54 AM
The easiest approach would be to disable the shopping action on this particular object if some conditions are met. Shopping is a bit complicated and I'm only starting to understand it.

If this object is buyable from the world like any other generic object, it probably uses interactions from the 0x7F4A60B2 group. You don't want to modify this group directly because it affects all objects. In the guardian function, you can see that it can be disabled using a called tree "CT - For Sale - Not Browseable?" inside the object, where you would try to put the logic in. Now you make this CT return true to make browsing/buying not available. If the "umbrella object" can be bought like a cellphone rack that dispenses infinite new umbrellas, it could have a custom buy function, which might still redirect to the shopping scripts holder.

To see if the person has this object in the inventory already, you would use the 33 Manage Inventory instruction. Use the operation "Set to Next token of GUID" and input the GUID of your object, and a variable that starts at 0 for your index. If this instruction returns true, it has found at least 1 object, and has advanced the index variable to it, or false if it has not. If you only care if the neighbor has 1 item, you don't need to count them further. To count them, you would loop back to the Set to Next, from the index value that was found earlier, not 0.

You would have to look at how a person owning an umbrella is marked in the mod. If he has a visible object that can be removed or gifted, use basic node version 0 and search for visible non-memory (checkboxes in the category) in neighbor's singular inventory. A data token would be non-visible non-memory. I don't know how shopping inventory is marked. It might be found with node version 2, category any, or maybe not. They would reside in the shopping category only temporarily anyway, and be transferred to normal for use.
Inventor
#4 Old 27th Jan 2024 at 9:30 PM
Quote: Originally posted by topp
when playable Sims buy something, it appears in a special inventory tab where, once you stop playing the business lot and switch to the household of the buyer, you get to choose whether you wish to keep what they bought, or undo the sale

In my game shopping inventory is technically in the House inventory of the business lot (while it is in the special tab). When the person pays for it at the cash register, the items are transferred to the regular neighbor's inventory. To remove them, you sell them at a slight loss.

The items have flags = 9, which apears to be a combination of shopping and visible, and have the purchaser's neighbor ID in property 1 ("first" property).

It does not seem to be possible to step through this inventory on Open for Business or FreeTime with Set to Next. But I think it works in Mansion (it finds fridge leftovers and apartment furniture, when it "shouldn't"). One way to read this inventory is to sequentially read every token index into Temp from Lot (Global: current house), and check via My Temporary Token for what you need: Guid and Flags, and use 33 Manage Inventory to read properties off Token in Temp. If reading fails, the end of the inventory has been reached.

Screenshots
Back to top