SKrnPride Posted August 11, 2016 Share Posted August 11, 2016 Hey guys I'm relatively new to this modding stuff. I have the general gist but what I'm trying to do might be out of my realm of knowledge. I like to be "camp mom" which is sit at camp maintain things and cook food for the adventurers. I'm trying to make a character that basically gains a little bit of hunger and sanity whenever I cook because thats basically all that I do. I tried to look at Wilson's coding to find his "get sanity whenever he invents something" for the life of me I cannot find the part of his coding that allows for that. And I couldn't even find wigfrid. If any of you experts could tell me where it is or what that kind of coding would look like I would really really appreciate it. Link to comment Share on other sites More sharing options...
Joachim Posted August 12, 2016 Share Posted August 12, 2016 Do you mean cooking food with a fire or in a crockpot? Or both? Link to comment Share on other sites More sharing options...
SKrnPride Posted August 12, 2016 Author Share Posted August 12, 2016 Both If possible @Joachim Link to comment Share on other sites More sharing options...
Joachim Posted August 14, 2016 Share Posted August 14, 2016 I am looking at the code, but it is a bit tricky. It should be possible, but the question is: what is the best way to achieve this? Link to comment Share on other sites More sharing options...
SKrnPride Posted August 14, 2016 Author Share Posted August 14, 2016 Theres a mod out there for a crock pot that can be moved. But im more looking for like a "nibbler" passive where you get hunger for cookng anything. If its not possible thats find I appreciate the help either way @Joachim Link to comment Share on other sites More sharing options...
Joachim Posted August 14, 2016 Share Posted August 14, 2016 The question is not whether it is possible, but what the best is to achieve this. The problem is that the cookpot and the chef are decoupled. So while there is an event that is fired when the cookpot is done cooking, the problem is: how do we know who did the cooking? It is lost somewhere in the cook action (ACTIONS.COOK). I will check whether I didn't forget something. Link to comment Share on other sites More sharing options...
SKrnPride Posted August 14, 2016 Author Share Posted August 14, 2016 Is there maybe a way to trigger the event as the person presses cook on the crockpot? does the game have any listen coding for that? Link to comment Share on other sites More sharing options...
rezecib Posted August 15, 2016 Share Posted August 15, 2016 (edited) The most straightforward way to do this is to override the COOK action's function, I think. local _COOK_fn = GLOBAL.ACTIONS.COOK.fn function GLOBAL.ACTIONS.COOK.fn(act, ...) local result = _COOK_fn(act, ...) if result and act.doer and act.doer.campmom then --assuming you marked the character with this, e.g. inst.campmom = true act.doer.components.hunger:DoDelta(3) act.doer.components.sanity:DoDelta(3) end return result end I think that captures both cooking on a fire and with a crock pot, but I didn't investigate that exhaustively. (side note, I didn't want to suggest using a tag for "campmom" because it doesn't need to be known to clients, and tags get networked and have limited capacity, with serialization errors occurring around 30 tags) There might also be some edge cases I didn't catch there. COOK.fn is actually pretty long and complicated-- it looks like it returns true in at least one other situation where cooking didn't actually get done/started. Edited August 15, 2016 by rezecib Link to comment Share on other sites More sharing options...
SKrnPride Posted August 15, 2016 Author Share Posted August 15, 2016 (edited) Oo this looks promising i will try this as soon as i am able thanks for your help ! My only question is that, since this only applies to the campmom character that means this wont affect the other player's ability to cook right? Edited August 15, 2016 by SKrnPride Link to comment Share on other sites More sharing options...
Joachim Posted August 15, 2016 Share Posted August 15, 2016 1 hour ago, SKrnPride said: Oo this looks promising i will try this as soon as i am able thanks for your help ! My only question is that, since this only applies to the campmom character that means this wont affect the other player's ability to cook right? No. The way rezecib suggests you do it, means that all previous behavior remains, but that something additional is added to it. It is just something extra. 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