Jump to content

Help on food, and temperature for mod character (muti)

Recommended Posts

I been dealing with this for a good while, and I tried many times, and always get an crash. When it doesn't carsh it didn't really do what I wanted.

Few things I did figure out it was pretty simple, and from other mod characters. But the things I want to do I can't seem to find an character do the same thing, or just plainly not possible, (or very complex to.)

What I'm doing firstly, is trying to have my character eat berries. I have done the foodpref on foodgroup/type on seeds, berries, and meats. it works perfectly, but my character can't eat berries. I look on data to said to addtag "edible" to berries, since they are consider an veggie. But I am not sure where to add this tag, and/or so.

2ndly I wanted to gain sanity from foods. I preferring want it berries, but I be fine if it works on any kind of food. I work around, it doesn't crash but it doesn't give the results.

And last one was to see if I can keep my character from ever getting cold. supposedly winter is in mutiplayer now, (though for some reason the world refuses to go into winter..maybe not in yet or I'm having issues)

Link to comment
Share on other sites


-------------- mycharacter, master_postinit --------------------------------------------------    -- Only eat berries and meat.    inst.components.eater.foodprefs = { FOODTYPE.BERRY, FOODTYPE.MEAT }    inst:AddTag(FOODTYPE.BERRY.."_eater")        -- Based on rezecib's code, gain sanity when eating berries.    local OldEat = inst.components.eater.Eat    inst.components.eater.Eat = function(self, food)        if self:CanEat(food) and food.prefab:find("berries") then            food.components.edible.sanityvalue = food.components.edible.sanityvalue + 50        end        return OldEat(self,food)    end        -- No more freezing    inst.components.temperature.mintemp = 20-------------------- modmain -------------------------------------------AddPrefabPostInit("berries", function(inst)    inst:AddTag("edible_"..GLOBAL.FOODTYPE.BERRY)end)-- Smallbirds are now able to eat roasted berries >>;AddPrefabPostInit("berries_cooked", function(inst)    inst:AddTag("edible_"..GLOBAL.FOODTYPE.BERRY)end)
Edited by Ryuushu
Link to comment
Share on other sites

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