Jump to content

Character mod help - setting sanity to a flat value


Recommended Posts

Just trying to get my character's moisture level to set the current sanity level.

The following doesn't seem to work:

 

local function onmoistsanity(inst)
--Current moisture as percentage
  local moistness = 100 * (GetMoisture(inst) / GetMaxMoisture(inst))
 
  if moistness ~= 0 then
    inst.components.sanity.rate = 0
    inst.components.sanity.rate_modifier = 0
    inst.components.sanity:DoDelta(0)
    inst.components.sanity.current = moistness
    inst.components.temperature.current = 35
  end
end
Link to comment
Share on other sites

@MrJerkbird:

How are moisture and sanity related?

I can't gather what you want to do from your function.

 

If you are insane when you are not moist, then you are going to be insane 3/4 seasons. Seems pretty harsh.

I can't imagine equating a 0 moisture value into a 0 sanity value.

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