grimmsdottir Posted May 14, 2015 Share Posted May 14, 2015 (edited) Hello, I am currently creating a character, who is unable to eat any raw or uncooked food, and crockpot recipes. She can instead can only eat a very specific food(a nutribar) that can be crafted from rocks/other weird things. I was looking a Wigfrid's (wathgrithr) prefab, and the way she can only eat meat is with this lineinst.components.eater:SetDiet({ FOODGROUP.OMNI }, { FOODTYPE.MEAT })as such, I am thinking that I could simply do this for my character as well, by adding something like thisinst.components.eater:SetDiet({ FOODGROUP.ORIONOMNI }, { FOODTYPE.ORIONNUTRI })where Orion is the name of the character, ORIONOMNI is the regular OMNI plus the nutribar, and ORIONNUTRI is the nutribar. However, I am unsure on how to create my own FOODGROUP. As for FOODTYPE, I added inst.components.edible.foodtype = "ORIONNUTRI"to the nutribar's prefab, which has not yet crashed, which should be a good sign. I tried adding thisGLOBAL.FOODGROUP.ORIONOMNI = { name = "ORIONOMNI", types = { FOODTYPE.MEAT, FOODTYPE.VEGGIE, FOODTYPE.INSECT, FOODTYPE.SEEDS, FOODTYPE.GENERIC, FOODTYPE.ORIONNUTRI, }, }to my modmain.lua, but it causes a crash. Will attach the log Any help would be much appreciatedlog.txt Edited May 14, 2015 by grimmsdottir Link to comment https://forums.kleientertainment.com/forums/topic/53959-creating-a-new-exclusive-food-group/ Share on other sites More sharing options...
Blueberrys Posted May 14, 2015 Share Posted May 14, 2015 @grimmsdottir Your log:attempt to index global 'FOODTYPE' (a nil value)Add this to the top:FOODTYPE = GLOBAL.FOODTYPEor replace all "FOODTYPE" with "GLOBAL.FOODTYPE" Link to comment https://forums.kleientertainment.com/forums/topic/53959-creating-a-new-exclusive-food-group/#findComment-637489 Share on other sites More sharing options...
grimmsdottir Posted May 14, 2015 Author Share Posted May 14, 2015 (edited) @Blueberrys, Thanks for the reply, I have done that now, and the game is no longer crashing. However, my character does not seem to be able to eat the nutribar. this is the modmainGLOBAL.FOODGROUP.ORIONOMNI = { name = "ORIONOMNI", types = { GLOBAL.FOODTYPE.MEAT, GLOBAL.FOODTYPE.VEGGIE, GLOBAL.FOODTYPE.INSECT, GLOBAL.FOODTYPE.SEEDS, GLOBAL.FOODTYPE.GENERIC, GLOBAL.FOODTYPE.ORIONNUTRI, }, }GLOBAL.FOODTYPE.ORIONNUTRI = "ORIONNUTRI"My character has this line in the prefabinst.components.eater:SetDiet({ FOODGROUP.ORIONOMNI }, { FOODTYPE.ORIONNUTRI })and the nutribar has theseinst:AddComponent("edible") inst.components.edible.hungervalue = TUNING.CALORIES_SMALL inst.components.edible.healthvalue = TUNING.HEALING_MEDSMALL inst.components.edible.sanityvalue = TUNING.SANITY_TINY inst.components.edible.foodtype = "ORIONNUTRI"However, my character seems to be unable to eat the nutribar. I can only examine it. I tried removing the inspectable component, then I could neither eat nor inspect the nutribar EDIT: My bad, I found out my mistake. I need to declare the ORIONNUTRI foodtype before the foodgroup and that cleared the problems Edited May 14, 2015 by grimmsdottir Link to comment https://forums.kleientertainment.com/forums/topic/53959-creating-a-new-exclusive-food-group/#findComment-637496 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