Jump to content

Water damage


Recommended Posts

hey there! i,m working on a Character Mod, I wanted to know if i can make my Character loose sanity in rain?

This is my third try at modding, and i'm really hoping to get this one to work, so if you could help with posting a code, or where to put the code, even where to find it, that would be amazing, thank you!

Link to comment
Share on other sites

10 hours ago, SashaSongbird said:

if i can make my Character loose sanity in rain?

-- We are on your character prefab file

-- Assets, common_postinit, etc. over here

local function sanityfn(inst)
	local delta = 0
	if TheWorld.state.israining then
		-- actually is -0.056, a reverse top hat for reference
		delta = -TUNING.DAPPERNESS_MED
	end
	return delta
end

-- This is your master_postinit function
local function master_postinit(inst)
	-- Stats and the rest of your code goes here
	inst.components.sanity.custom_rate_fn = sanityfn
end

-- Here the prefab gets returned

 

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