Enderia Posted July 23, 2019 Share Posted July 23, 2019 Hello, again dearest forum. Today I need help with food, specify - adding new recipes to a crockpot. I've been searching for already existing dishes but I can't find them? I've been trying for a few hours and now I'm slowly giving up. So - I wanted to add gingerbreads and biscuits. (I will probably change the recipes, I'm too tired to think rn) Gingerbreads: honey + egg + butter + ice/twigs e.t.c Biscuits: egg + egg + (not sure but probably just ice/twigs) I've wanted to add it to mod adding 2 other characters and like...Character1 is Gingerbreads fanatic while Character2 is Biscuits fanatic. Is it possible to make both of them regenerate more while eating their favorite dish? Gingerbreads (normal): Hunger >> 50 Sanity >> 10 Health >> 20 Gingerbreads (for Ch1): Hunger >> 70 Sanity >> 30 Health >> 35 Biscuits (normal): Hunger >> 20 Sanity >> 0 Health >> 5 Biscuits (for Ch2): Hunger >> 30 Sanity >> 30 Health >> 10 Thanks a lot Link to comment Share on other sites More sharing options...
Ultroman Posted July 23, 2019 Share Posted July 23, 2019 This should be a fabulous start. For making each character get more from a certain food, add an oneat function to their eater component, where you check whether the food is a certain prefab, and if it is, you give them something extra. local function OnEat(inst, food) if food.prefab == "biscuit" then inst.components.health:DoDelta(5) inst.components.sanity:DoDelta(5) inst.components.hunger:DoDelta(5) end end local function master_postinit(inst) -- lots of other code that you have in here -- Add this line at the bottom of master_postinit (just before the "end" that closes it) inst.components.eater:SetOnEatFn(OnEat) end Link to comment 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