Soopakoopa Posted December 7, 2013 Share Posted December 7, 2013 How exactly does one go about making a character eat specific items whihc are not foodby default (for example, cut grass) and specify exactly how much health, hunger and sanitythat character gains, without modding the items themselves to be food which any charactercan eat? Is it possible? Link to comment https://forums.kleientertainment.com/forums/topic/30245-making-a-specific-character-eat-non-food-items/ Share on other sites More sharing options...
Rosten Posted December 7, 2013 Share Posted December 7, 2013 (edited) Try looking around Wx78s code, his ability to eat gears might be of help, this looks like what you're looking forlocal 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)endendAnd 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_HUGEMy 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 December 7, 2013 by Blazingice26 Link to comment https://forums.kleientertainment.com/forums/topic/30245-making-a-specific-character-eat-non-food-items/#findComment-385812 Share on other sites More sharing options...
Soopakoopa Posted December 7, 2013 Author Share Posted December 7, 2013 Try looking around Wx78s code, his ability to eat gears might be of help, this looks like what you're looking forlocal 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)endendAnd 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_HUGEMy 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. Link to comment https://forums.kleientertainment.com/forums/topic/30245-making-a-specific-character-eat-non-food-items/#findComment-385856 Share on other sites More sharing options...
Rosten Posted December 7, 2013 Share Posted December 7, 2013 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 Link to comment https://forums.kleientertainment.com/forums/topic/30245-making-a-specific-character-eat-non-food-items/#findComment-385861 Share on other sites More sharing options...
Soopakoopa Posted December 7, 2013 Author Share Posted December 7, 2013 It's ok, I've already gotten that part, figured out I could make a new food type without too much coding and now that works. Link to comment https://forums.kleientertainment.com/forums/topic/30245-making-a-specific-character-eat-non-food-items/#findComment-385889 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now