grimmsdottir Posted May 14, 2015 Share Posted May 14, 2015 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 Link to comment 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 Share on other sites More sharing options...
grimmsdottir Posted May 14, 2015 Author Share Posted May 14, 2015 @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 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.