Jump to content

How can I make rot good for my character mod


Recommended Posts

OK, so I've been working on a character, and he is all working good, but there is one problem. I want him to be able to eat rot and for the rot to be good for him, but I can't find anything to help me with this.
Anyone know how to do this? My steam name is Lord_Trolldork and my email is lordtrolldork@gmail.com if you want to send me a message about this. Thanks!

Link to comment
Share on other sites

Put this in your modmain.lua

if GLOBAL.TheNet:GetIsServer() then	AddPrefabPostInit("spoiled_food", function(inst)		local old = inst.components.edible.oneaten		inst.components.edible.oneaten = function(inst, eater)			if eater.prefab == "wilson" then				eater.components.health:DoDelta(4)				eater.components.hunger:DoDelta(4) --note that this is in addition to whatever it has already				eater.components.sanity:DoDelta(4)			end			if old then				old(inst,eater)			end		end	end)end

wilson now gains 4 of all stats on top of the effects of eating rot.

 

Change wilson's name to your characters prefab name and your good to go.

 

Edit: Oh right, this isn't the DST forums, I keep forgetting that.

Link to comment
Share on other sites

Put this in your modmain.lua

wilson now gains 4 of all stats on top of the effects of eating rot.

 

Change wilson's name to your characters prefab name and your good to go.

 

That's for Together. In DS, leave the first and last line out.

AddPrefabPostInit("spoiled_food", function(inst)

    local old = inst.components.edible.oneaten

    inst.components.edible.oneaten = function(inst, eater)

        if eater.prefab == "wilson" then --Replace "wilson" with your character's prefab name

            eater.components.health:DoDelta(4)

            eater.components.hunger:DoDelta(4) --note that this is in addition to whatever it has already

            eater.components.sanity:DoDelta(4)

        end

        if old then

            old(inst,eater)

         end

    end

end)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...