igel69 Posted July 7, 2021 Share Posted July 7, 2021 Hello. I'm currently creating a mod where a character is supposed to make Monster meat unperishable in its inventory. Thanks in advance Link to comment Share on other sites More sharing options...
Monti18 Posted July 7, 2021 Share Posted July 7, 2021 From Wurt: local function FishPreserverRate(inst, item) return (item ~= nil and item:HasTag("fish")) and TUNING.WURT_FISH_PRESERVER_RATE or nil end inst:AddComponent("preserver") inst.components.preserver:SetPerishRateMultiplier(FishPreserverRate) This gives all fishes that Wurt holds a 4 times longer time before they perish. If you set it the value to 0, it won't perish. Try to make working for your needs 1 Link to comment Share on other sites More sharing options...
igel69 Posted July 7, 2021 Author Share Posted July 7, 2021 24 minutes ago, Monti18 said: From Wurt: local function FishPreserverRate(inst, item) return (item ~= nil and item:HasTag("fish")) and TUNING.WURT_FISH_PRESERVER_RATE or nil end inst:AddComponent("preserver") inst.components.preserver:SetPerishRateMultiplier(FishPreserverRate) This gives all fishes that Wurt holds a 4 times longer time before they perish. If you set it the value to 0, it won't perish. Try to make working for your needs thank you, though I'm not quite sure I understand the code. You said it holds 4 times longer and that I need to change the value to 0 but where do I do that? Link to comment Share on other sites More sharing options...
Monti18 Posted July 7, 2021 Share Posted July 7, 2021 If you have a look at tuning.lua, you will find WURT_FISH_PRESERVER_RATE, which is described as a value of 0.25. That means, the time to perish is divided by 0.25, which means that the time is 4 times as long. --in the character prefab local function MonsterMeatPreserverRate(inst, item) return (item ~= nil and item.prefab = "monstermeat") and 0 or nil end --in master postinit inst:AddComponent("preserver") inst.components.preserver:SetPerishRateMultiplier(MonsterMeatPreserverRate) This would be the correct function for you, you check if the item is monstermeat by seing if the prefab is "monstermeat", then the perish rate for this item is 0. If it's not monstermeat, it's nil, which means it makes no changes. 1 Link to comment Share on other sites More sharing options...
igel69 Posted July 7, 2021 Author Share Posted July 7, 2021 14 minutes ago, Monti18 said: If you have a look at tuning.lua, you will find WURT_FISH_PRESERVER_RATE, which is described as a value of 0.25. That means, the time to perish is divided by 0.25, which means that the time is 4 times as long. --in the character prefab local function MonsterMeatPreserverRate(inst, item) return (item ~= nil and item.prefab = "monstermeat") and 0 or nil end --in master postinit inst:AddComponent("preserver") inst.components.preserver:SetPerishRateMultiplier(MonsterMeatPreserverRate) This would be the correct function for you, you check if the item is monstermeat by seing if the prefab is "monstermeat", then the perish rate for this item is 0. If it's not monstermeat, it's nil, which means it makes no changes. Ah worked perfectly thank you so much! 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