Yagi2137 Posted November 6, 2022 Share Posted November 6, 2022 Hi, i've been trying to change values of fresh food for my character. I have no idea how to do that though. Like stale and spoiled food have their own value for this (inst.components.eater.stale/spoiled_hunger/health), there is no such thing for fresh food or at least I cant find one. So i've tried this if inst.components.eater ~= nil then inst.components.eater:SetAbsorptionModifiers(1,1,1) if inst.components.eater:HasTag("fresh") then inst.components.eater:SetAbsorptionModifiers(0.25,0.25,0.25) end inst.components.eater.ignoresspoilage = true inst.components.eater.SetCanEatHorrible = true inst.components.eater.stale_hunger = 0.5 inst.components.eater.stale_health = 0.5 inst.components.eater.spoiled_hunger = 1 inst.components.eater.spoiled_health = 1 end I know for sure this part is wrong (game is stuck in endless loading,no crash, no lag, just loading) but I believe im on a right track with that one, I just don't know how to check if food have fresh tag. inst.components.eater:HasTag("fresh") If there is easier or better way to do that, that's awesome. Also if there is a way to make alter stale/spoiled food sanity values (just like hunger/health) that would be helpful (I've added 'ignoresspoilage' but i haven't tested it yet so i don't know if it works as i intended it to work; but i want other values for stale and spoiled anyways if it is possible). Link to comment https://forums.kleientertainment.com/forums/topic/144398-custom-fresh-food-value/ Share on other sites More sharing options...
TemporarySolutn Posted November 7, 2022 Share Posted November 7, 2022 (edited) this is what I had in my mod for Wyrdelyn, if inst.components.eater ~= nil then inst.components.eater:SetAbsorptionModifiers(0, TUNING.WYRDELYN_FOOD_MULT, 1) inst.components.eater:SetDiet({FOODGROUP.OMNI, FOODTYPE.BLOOD}) -- Manual hunger, health, and sanity values (divided by food multiplier to compensate for food multiplier) inst.components.eater.Eat_orig = inst.components.eater.Eat function inst.components.eater:Eat(food) local _edible = food.components.edible if food and _edible and self:CanEat(food) then if food.prefab == "garlic" then _edible.healthvalue = 0 _edible.hungervalue = 12 / TUNING.WYRDELYN_FOOD_MULT _edible.sanityvalue = 1 elseif food.prefab == "garlic_cooked" then _edible.healthvalue = 0 _edible.hungervalue = 12 / TUNING.WYRDELYN_FOOD_MULT _edible.sanityvalue = 3 elseif _edible.foodtype == "BLOOD" then _edible.healthvalue = _edible.healthvalue _edible.hungervalue = _edible.hungervalue / TUNING.WYRDELYN_FOOD_MULT -- wait why am i doing this? _edible.sanityvalue = _edible.sanityvalue inst.components.vamprism:BloodSated(inst) else _edible.healthvalue = 0 _edible.sanityvalue = 0 inst.components.talker:Say("It doesn't taste like much of anything.") -- add more lines end end return inst.components.eater:Eat_orig(food) end end you can ignore the setdiet part entirely aswell as the vamprism and talker things i have, and I am dividing something because iirc this overrides absorptionmodifiers (i kept this in my characters master_postinit) Edited November 7, 2022 by TemporarySolutn Link to comment https://forums.kleientertainment.com/forums/topic/144398-custom-fresh-food-value/#findComment-1607366 Share on other sites More sharing options...
Yagi2137 Posted November 8, 2022 Author Share Posted November 8, 2022 You truly are my hero. Thanks you so much <3 I was losing my marbles trying to do that. Idk why didn't even thought about using function from other files this way. Thx u. Link to comment https://forums.kleientertainment.com/forums/topic/144398-custom-fresh-food-value/#findComment-1607651 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