Jump to content

How to add Maxwell's Dapperness to Wickerbottom with a mod.


Recommended Posts

Just to preface, I'm very new to modding.

I'm trying to make a mod that will add Maxwell's Dapperness to Wickerbottom. This is my modmain.lua so far.

local function ModifyWickerbottomFn(player)

	local function master_postinit(inst)
	
	inst.components.sanity.dapperness = TUNING.DAPPERNESS_LARGE
	
	end
	
end

AddPlayerPostInit(ModifyWickerbottomFn)

I'm basing all of this off of a wiki post I read earlier (don't have the link, sorry) and a Maxwell mod I was able to create from said wiki post that tweaked his health. Here's the Maxwell mod I was able to make that tweaks his health. 

local function ModifyWaxwellFn(player)
	player.components.health:SetMaxHealth(150)
	player.components.hunger:SetMax(150)
	player.components.sanity:SetMax(200)

end

AddPlayerPostInit(ModifyWaxwellFn)

I need help with Wickerbottom's tweak though, as nothing I've been trying has worked.

Thanks in advance!!

Edited by Lakefruit
Link to comment
Share on other sites

masterpostinit has nothing to do there. It should only ever appear inside a prefab LUA file. You also need to do a prefab name check, in order to only apply this to Wickerbottom.

local function ModifyWickerbottomFn(player)
	if player.prefab == "wickerbottom" then
		player.components.sanity.dapperness = TUNING.DAPPERNESS_LARGE
	end
end

AddPlayerPostInit(ModifyWickerbottomFn)

This next version is better and simpler, but I'm not sure if it works:

local function ModifyWickerbottomFn(player)
	player.components.sanity.dapperness = TUNING.DAPPERNESS_LARGE
end

AddPrefabPostInit("wickerbottom", ModifyWickerbottomFn)

 

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