Jump to content

Recommended Posts

How exactly does one go about making a character eat specific items whihc are not food

by default (for example, cut grass) and specify exactly how much health, hunger and sanity

that character gains, without modding the items themselves to be food which any character

can eat? Is it possible?

Try looking around Wx78s code, his ability to eat gears might be of help, this looks like what you're looking for

local function oneat(inst, food) if food and food.components.edible and food.components.edible.foodtype == "GEARS" then--give an upgrade!inst.level = inst.level + 1applyupgrades(inst) inst.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")inst.HUD.controls.status.heart:PulseGreen()inst.HUD.controls.status.stomach:PulseGreen()inst.HUD.controls.status.brain:PulseGreen() inst.HUD.controls.status.brain:ScaleTo(1.3,1,.7)inst.HUD.controls.status.heart:ScaleTo(1.3,1,.7)inst.HUD.controls.status.stomach:ScaleTo(1.3,1,.7)endend

And i found this, in the gears.lua 

inst:AddComponent("edible")inst.components.edible.foodtype = "GEARS"inst.components.edible.healthvalue = TUNING.HEALING_HUGEinst.components.edible.hungervalue = TUNING.CALORIES_HUGEinst.components.edible.sanityvalue = TUNING.SANITY_HUGE

My guess is that adding the foodtype "GEARS" to a food and making it so only the character can eat that specific foodtype is how its done.

Edited by Blazingice26

Try looking around Wx78s code, his ability to eat gears might be of help, this looks like what you're looking for

local function oneat(inst, food) if food and food.components.edible and food.components.edible.foodtype == "GEARS" then--give an upgrade!inst.level = inst.level + 1applyupgrades(inst) inst.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")inst.HUD.controls.status.heart:PulseGreen()inst.HUD.controls.status.stomach:PulseGreen()inst.HUD.controls.status.brain:PulseGreen() inst.HUD.controls.status.brain:ScaleTo(1.3,1,.7)inst.HUD.controls.status.heart:ScaleTo(1.3,1,.7)inst.HUD.controls.status.stomach:ScaleTo(1.3,1,.7)endend

And i found this, in the gears.lua 

inst:AddComponent("edible")inst.components.edible.foodtype = "GEARS"inst.components.edible.healthvalue = TUNING.HEALING_HUGEinst.components.edible.hungervalue = TUNING.CALORIES_HUGEinst.components.edible.sanityvalue = TUNING.SANITY_HUGE

My guess is that adding the foodtype "GEARS" to a food and making it so only the character can eat that specific foodtype is how its done.

So that would mean I'd have to mod various items and thus mod incompatibility. Oh well.

So that would mean I'd have to mod various items and thus mod incompatibility. Oh well.

Well, you never did specify exactly what you wanted him to eat, it would probably be as easy as 

inst:AddComponent("edible")
inst.components.edible.foodtype = "FOODTYPE"

to something, and adding something that lets the character eat that foodtype

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