Jump to content

Creating a new exclusive food group


Recommended Posts

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 line

inst.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 this

inst.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 this

GLOBAL.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 appreciated

log.txt

Link to comment
Share on other sites

@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 modmain

GLOBAL.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 prefab

inst.components.eater:SetDiet({ FOODGROUP.ORIONOMNI }, { FOODTYPE.ORIONNUTRI })

and the nutribar has these

inst: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

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.

×
  • Create New...