stomarver Posted October 30, 2024 Share Posted October 30, 2024 I used to use this code for such purposes: local TUNING = GLOBAL.TUNING local require = GLOBAL.require local resolvefilepath = GLOBAL.resolvefilepath local FOODTYPE = GLOBAL.FOODTYPE FOODTYPE.GURI = "GURI" _G = GLOBAL require = _G.require PrefabFiles = { "woodie", "lucy", } local Screen=require "widgets/screen" local Widget=require "widgets/widget" --(edible log) AddComponentPostInit("eater", function(self) function self:SetCanEatLogs() table.insert(self.preferseating, FOODTYPE.GURI) table.insert(self.caneat, FOODTYPE.GURI) self.inst:AddTag(FOODTYPE.GURI.."_eater") end end) AddPrefabPostInit("woodie", function(inst) if not GLOBAL.TheWorld.ismastersim then return inst end inst.components.eater:SetCanEatLogs() end) local HUNGER_CHANGE = GetModConfigData("HUNGER") local SANITY_CHANGE = GetModConfigData("SANITY") local HEALTH_CHANGE = GetModConfigData("HEALTH") function new_fn(inst) if GLOBAL.TheWorld.ismastersim then inst:AddComponent("edible") inst.components.edible.foodtype = FOODTYPE.GURI inst.components.edible.hungervalue = HUNGER_CHANGE inst.components.edible.sanityvalue = SANITY_CHANGE inst.components.edible.healthvalue = HEALTH_CHANGE end end AddPrefabPostInit("log", new_fn) but now I have a need to add more edible items that will have their own value for food. Is there any modular example where it would be possible to enter an item tag, and then set the desired values for it? Link to comment https://forums.kleientertainment.com/forums/topic/160467-help-how-to-make-an-edible-item/ 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