Jump to content

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

Edited by grimmsdottir

@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

Edited by grimmsdottir

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...