charpagon Posted July 2, 2016 Share Posted July 2, 2016 I mean, is there a script so he can eat rocks? I tried to discover this on my own but I'm a newby in coding and stuff like that. I found in Woodie_nobeav.lua this: TUNING.SANITY_PER_CONE_WOODIE = 1.25 So can I somehow remake this so he gains "hunger" while eating rocks? Link to comment Share on other sites More sharing options...
DarkXero Posted July 2, 2016 Share Posted July 2, 2016 -- So you can eat all elementals local eater = inst.components.eater table.insert(eater.preferseating, FOODTYPE.ELEMENTAL) table.insert(eater.caneat, FOODTYPE.ELEMENTAL) eater.inst:AddTag(FOODTYPE.ELEMENTAL.."_eater") local _TestFood = eater.TestFood eater.TestFood = function(self, food, testvalues) -- So you can only eat rocks, out of all stuff of the elementals group if food and food.components.edible and food.components.edible.foodtype == FOODTYPE.ELEMENTAL then return food.prefab == "rocks" end return _TestFood(self, food, testvalues) end -- So you benefit for eating rocks eater.oneatfn = function(inst, food) if food and food.prefab == "rocks" then -- rocks give 1 hunger back by default, 1 + 9 = 10 inst.components.hunger:DoDelta(9) end end Link to comment Share on other sites More sharing options...
charpagon Posted July 2, 2016 Author Share Posted July 2, 2016 Thank you very much. Where do I paste it though? In the prefab? Link to comment Share on other sites More sharing options...
DarkXero Posted July 2, 2016 Share Posted July 2, 2016 12 minutes ago, charpagon said: Thank you very much. Where do I paste it though? In the prefab? Inside the master_postinit function of the character's prefab file. Link to comment Share on other sites More sharing options...
charpagon Posted July 2, 2016 Author Share Posted July 2, 2016 Ok, so I copied that and it shows me this: And that's how looks my file local master_postinit = function(inst) inst.soundsname = "willow" if food and food.components.edible and food.components.edible.foodtype == FOODTYPE.ELEMENTAL then return food.prefab == "rocks" end return _TestFood(self, food, testvalues) end eater.oneatfn = function(inst, food) if food and food.prefab == "rocks" then inst.components.hunger:DoDelta(4) end end --inst.talker_path_override = "dontstarve_DLC001/characters/" inst.components.health:SetMaxHealth(150) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(200) inst.components.combat.damagemultiplier = 1 inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE inst.OnLoad = onload inst.OnNewSpawn = onload end return MakePlayerCharacter("cygan", prefabs, assets, common_postinit, master_postinit, start_inv) Link to comment Share on other sites More sharing options...
DarkXero Posted July 2, 2016 Share Posted July 2, 2016 (edited) * thing.txt Edited July 2, 2016 by DarkXero Link to comment 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