Jump to content

Recommended Posts

inst:AddComponent("edible")

In order for it to give any stats, you'd have to edit the component afterwards. You might be able to set one parameter, by saying:

inst:AddComponent("edible").healthvalue = 40

How you get the inst (the food-to-be item) is a whole other story. There are several lists of possible console commands on the assorted Wikis to get things in your inventory, under the mouse etc.

Why do you want to do this with a console command and not a mod?

42 minutes ago, Ultroman said:

Why do you want to do this with a console command and not a mod?

Because im way too lazy to mod in every gorge dish and make them eatable for roleplay.

Edited by __IvoCZE__

But...you'll be doing this for every single item...using a console command...it's MUCH faster to make a mod that just does it for every item prefab you want to make edible. If you're profoundly lazy, you can just give them all the same hunger/health/sanity stats. Here's a script you can put in a modmain, which applies the given stats to each given prefab. There are other values you could put in, like foodtype, foodstate, temperature, caffeine, etc. if you want.

local food_bonuses = {
	twigs = { sanity = 10 },
	monsterlasagna = { health = 25, sanity = -10 },
	fishsticks = { health = 20, sanity = 20, hunger = 20 },
}

for k,v in ipairs(food_bonuses) do
	AddPrefabPostInit(k, function(inst)
		if v.health then
			k.components.edible.healthvalue = v.health
		end
		if v.sanity then
			k.components.edible.sanityvalue = v.sanity
		end
		if v.hunger then
			k.components.edible.hungervalue = v.hunger
		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...