AkaiNight Posted November 13, 2021 Share Posted November 13, 2021 I know how to make a food item (only craftable) but i don't know how to make a custom food type(diet) and i don't know how to make it only diet for custom character. I checked food tutorial but there was nothign about food type(or i miss it). It would be great if anyone have an example or tutorial for it. Link to comment https://forums.kleientertainment.com/forums/topic/135270-how-to-make-a-custom-food-type-and-make-it-only-diet/ Share on other sites More sharing options...
skittles sour Posted November 15, 2021 Share Posted November 15, 2021 if you check the constants.lua right under the scripts folder, you'll find a list of existing food types. and if you check the eater component, it has a series of functions - confusing enough for me - that includes AbleToEat, CanEat, PrefersToEat, and the like, these functions check whether or not the food type is included in the list of food types that make up the player's diet. i would imagine it would be as simple as 1) adding it to the list of foodtypes under constants.lua and then 2) making your custom character only able to eat this food type and 3) don't forget to add the food type to the diets of other players or mobs - if that's what you want - so they can eat it too. Link to comment https://forums.kleientertainment.com/forums/topic/135270-how-to-make-a-custom-food-type-and-make-it-only-diet/#findComment-1513366 Share on other sites More sharing options...
AkaiNight Posted November 15, 2021 Author Share Posted November 15, 2021 (edited) FOODTYPE = { GENERIC = "GENERIC", MEAT = "MEAT", VEGGIE = "VEGGIE", ELEMENTAL = "ELEMENTAL", GEARS = "GEARS", HORRIBLE = "HORRIBLE", INSECT = "INSECT", SEEDS = "SEEDS", BERRY = "BERRY", --hack for smallbird; berries are actually part of veggie RAW = "RAW", -- things which some animals can eat off the ground, but players need to cook BURNT = "BURNT", --For lavae. ROUGHAGE = "ROUGHAGE", WOOD = "WOOD", GOODIES = "GOODIES", MONSTER = "MONSTER", -- Added in for woby, uses the secondary foodype originally added for the berries } so you mean its ok if i just add local FOODTYPE = { CUSTOM_FOODTYPE = "CUSTOM_FOODTYPE"} in modmain and in food.lua inst.components.edible.foodtype = "CUSTOM_FOODTYPE" and same for diet? Edited November 15, 2021 by AkaiNight Link to comment https://forums.kleientertainment.com/forums/topic/135270-how-to-make-a-custom-food-type-and-make-it-only-diet/#findComment-1513387 Share on other sites More sharing options...
skittles sour Posted November 16, 2021 Share Posted November 16, 2021 i would think that you should insert the food type into the table of the constants, so: GLOBAL.FOODTYPES.MYFOODTYPE = "MYFOODTYPE" -- and then, in the player prefab file inst.components.eater.caneat = {FOODTYPES.MYFOODTYPE} inst.componetns.eater.preferseating = {FOODTYPES.MYFOODTYPE} 1 Link to comment https://forums.kleientertainment.com/forums/topic/135270-how-to-make-a-custom-food-type-and-make-it-only-diet/#findComment-1513400 Share on other sites More sharing options...
AkaiNight Posted November 16, 2021 Author Share Posted November 16, 2021 15 hours ago, Bad Willow said: i would think that you should insert the food type into the table of the constants, so: GLOBAL.FOODTYPES.MYFOODTYPE = "MYFOODTYPE" -- and then, in the player prefab file inst.components.eater.caneat = {FOODTYPES.MYFOODTYPE} inst.componetns.eater.preferseating = {FOODTYPES.MYFOODTYPE} oh i see thanks. And i assume i can add "inst.components.eater.caneat" as much as i like. 1 Link to comment https://forums.kleientertainment.com/forums/topic/135270-how-to-make-a-custom-food-type-and-make-it-only-diet/#findComment-1513570 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