Jump to content

Recommended Posts

A friend and I have been working on making a custom character and one of the cons we want to add is eating food that isn't meat still restores hunger and can be consumed but takes away 4 hp and a pro we want to add is that eating restores 15 sanity

Edited by godzilly4
Link to comment
https://forums.kleientertainment.com/forums/topic/131605-need-help-with-modding/
Share on other sites

12 hours ago, godzilly4 said:

A friend and I have been working on making a custom character and one of the cons we want to add is eating food that isn't meat still restores hunger and can be consumed but takes away 4 hp and a pro we want to add is that eating restores 15 sanity

I am sure there is a better way to do this but if there is not you can change the vaules manually 

local function oneat(inst, food)
	if food and food.components.edible and food.prefab == "food_1" then
    
		inst.components.health:DoDelta(vaule)
    	inst.components.sanity:DoDelta(vaule)
    	inst.components.hunger:DoDelta(vaule)
    elseif food and food.components.edible and food.prefab == "food_2" then
    	inst.components.health:DoDelta(vaule)
    	inst.components.sanity:DoDelta(vaule)
    	inst.components.hunger:DoDelta(vaule)
	end
end

put that in your character.lua. Change "food_1" with the food you want to edit and change vaules as you like.

and put that in master_postinit

inst.components.eater:SetOnEatFn(oneat)

let me know if there is any error

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...