. . . Posted May 17, 2018 Share Posted May 17, 2018 (edited) Hello, I was wondering if it's possible to make certain prefab not take penalty of faster spoilage rate when put on the ground, like is there a line of code or something to disable it like "inst.groundperishmult = nil" or something, thanks for your time ! Edited May 17, 2018 by SuperDavid Link to comment Share on other sites More sharing options...
whatsherface Posted May 21, 2018 Share Posted May 21, 2018 Looking in the meats prefab for example the closest I found was: inst:AddComponent("perishable") inst.components.perishable:SetPerishTime(TUNING.PERISH_FAST) inst.components.perishable:StartPerishing() But I think there's no specific line for it being on the ground...unless I'm blind or misread... Maybe you could try an if else statement to check if its on the ground or in the inventory, then change the TUNING.PERISH_FAST? Hope this helps a little ^^ Link to comment Share on other sites More sharing options...
PuffinBy Posted May 21, 2018 Share Posted May 21, 2018 To actually do that, you might need to modify perishable component. But, if you don't want to modify the component only for that one item, here's a tricky way. Spoiler local function ondrop(inst) inst.components.perishable.localPerishMultiplyer = 1/TUNING.PERISH_GROUND_MULT end local function onpickup(inst) inst.components.perishable.localPerishMultiplyer = 1 end -- then in perfab fn inst.components.inventoryitem:SetOnDroppedFn(ondrop) inst.components.inventoryitem:SetOnPutInInventoryFn(onpickup) -- I haven't tested yet, could be buggy. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now