Jump to content

Make monstermeat not perishable in my character's inventory


Recommended Posts

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 :)

  • Like 1
Link to comment
Share on other sites

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

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.

  • Like 1
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...