Jump to content

Gain sanity boost from a certain food?

Recommended Posts

Hey everyone! Haven't been here in a while! I've been kinda busy lol.

So I've started making mods again, but this time it's for other people!

So, one of the things for this mod was to have a certain food give an extra boost. not all types of food, just one food item. The goal is to have one crockpot food just add a bit extra to the sanity, that's all. 

I had this added in another mod because I found a thread that explained how to do it, but now I can't find that thread, and I have no idea where the strip of code is that did this.

Any help would be greatly appreciated, thank you!


Edited by FrontierHero
Link to comment
Share on other sites

On 6/21/2017 at 6:06 PM, SuperDavid said:

inst:ListenForEvent("oneat", function(inst, data) 
	if data.food.prefab == "humanmeat" then

in character.lua inside master_postinit

thank you! this does work, but it doesn't seem to add the sanity boost benefit. do you know how I can add that, or would that be too much of a trouble to ask?

although, thank you!! this code was great!! I appreciate the time taken to reply to this thread to help me!

Edited by FrontierHero
Link to comment
Share on other sites

On 6/24/2017 at 10:29 PM, FrontierHero said:

Thank you so much for helping me! I really appreciate it! :)

that got me interested 

is 420 the sanity boost ? 

or ?

perhaps could you explain to me how dis works >3>; kinda interesting 

Link to comment
Share on other sites

yes, 420 should be the value you want to add. You could also remove a value, by doing something like :


The value could be either a numeric value, like 420 or a value like TUNING.SANITY_SMALL (look at tuning.lua to see the existing value). These are the 2 main ways to set a value, i guess you could have others options (variables ?).

Link to comment
Share on other sites

On 6/24/2017 at 3:07 AM, SuperDavid said:



oh 1 more thing

any idea how to set specific food to eat ? 

here i have this so my char eat meat only 

but i thought to add mandrake and such but not sure how that works 

    inst.components.eater:SetDiet({ FOODGROUP.OMNI }, { FOODTYPE.MEAT }, { FOODTYPE.FISH })

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

  • Create New...