Jump to content

Character Modding


Recommended Posts

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

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

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 by rezecib
Link to comment
Share on other sites

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 by SKrnPride
Link to comment
Share on other sites

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

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
 Share

×
  • Create New...