Jump to content

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!

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.

Edited by Zackreaver

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)

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
×
  • Create New...