|
Post by scipiogarling on Aug 6, 2023 9:10:59 GMT -5
I want to create a "magazine" mod that allows Sims to purchase a "subscription" the same way they would buy a skill book. But I want the magazine's effectiveness to wear off after a year, or ideally, or the object simply to disappear.
How can you create an object that disappears after a year...? I can't fathom how to code that.
|
|
|
Post by MizoreYukii on Aug 20, 2023 21:18:40 GMT -5
Well we don't really have a year in the sims, the most you can do is add up how long each season is minimum/for your game and go by that. But to add an expiration, once you've made your object tuning you'll want to add a custom state to the States section of the file, the file types are called CommodityBasedObjectState (the parent) and CommodityBasedObjectStateValue (connected to the parent). The parent, or object state list as I normally call it, has to be created and lists the CommodityBasedObjectStateValue files you make, otherwise the game throws a fit. It basically tells the game they exist, but you never reference the "parent", only the connected files. Anyhow, this file allows you to link a commodity, and the commodity will "count" down (or up) to the value you've set based on the speed (called decay_rate) you also set, and as it does so the states will switch based on what range you've set in them until it reaches the last one. Now if you want the item to simply disappear after, in the very last state you can set a new_client_state with a replace_object, enable the destroy_original_object but leave new_object disabled still. That should work. Examples using the commodity states include stuff like upgrading objects (upgrade_Generic_FasterHygiene), StuffedAnimal, any of the baby states (Baby_Asleep, baby_state_Bladder, etc.), bonsai trees (BonsaiGrowth) and more. There are no tutorials just on commodity states (could try Step 2 in this one for a brief overview of regular states at least) and there is this tutorial series on commodities, part 1 and part 2. This one covers decay rates that may also be helpful for understanding.
|
|