Jump to content

Recommended Posts

You'll want to take a look at rabbit.lua to see how the rabbits respond to your sanity to turn into beardlings. Specifically the WatchSanity function that gets called by OnPickup. You'll probably want to call WatchSanity in an OnEquip function and StopWatchingSanity in OnUnequip.

I think you would put something like this in YOURCHARACTER.lua inside the master_postinit ;)~

inst:ListenForEvent("sanitydelta", function(inst, data)
   if inst.components.sanity.current >= 150 then
      -- Set max light level
   elseif inst.components.sanity.current >= 100 then
      -- Lower light level
   elseif inst.components.sanity.current >= 50 then
      -- Lower light level
   elseif inst.components.sanity.current <= 50 then
      -- Set min light level
   end
end)

 

On 2/5/2017 at 10:31 PM, SuperDavid said:

I think you would put something like this in YOURCHARACTER.lua inside the master_postinit ;)~


inst:ListenForEvent("sanitydelta", function(inst, data)
   if inst.components.sanity.current >= 150 then
      -- Set max light level
   elseif inst.components.sanity.current >= 100 then
      -- Lower light level
   elseif inst.components.sanity.current >= 50 then
      -- Lower light level
   elseif inst.components.sanity.current <= 50 then
      -- Set min light level
   end
end)

 

This ought to work, you can alternatively call an outside function which is basically the same method.

 

local function sanitylight(inst)
	if inst.components.sanity.current >= 150 then
		inst.Light:SetIntensity(0.5)
		inst.Light:SetRadius(0.9)
		inst.Light:SetFalloff(0.5)
	elseif inst.components.sanity.current >= 100 then
      -- Lower light level
		inst.Light:SetIntensity(0.5)
		inst.Light:SetRadius(0.9)
		inst.Light:SetFalloff(0.5)
	elseif inst.components.sanity.current >= 50 then
      -- Lower light level
		inst.Light:SetIntensity(0.5)
		inst.Light:SetRadius(0.9)
		inst.Light:SetFalloff(0.5)
	elseif inst.components.sanity.current <= 50 then
      -- Set min light level
		inst.Light:SetIntensity(0.5)
		inst.Light:SetRadius(0.9)
		inst.Light:SetFalloff(0.5)
	end
end
                                              
--Put this part in Master Post Init
inst:ListenForEvent("sanitydelta", sanitylight)

Then just change the light settings to whatever you want for each stage like SuperDavid mentioned.

http://dontstarve.wikia.com/wiki/Console/Don't_Starve_Together_Commands

open the console

type :

c_give("green_cap", 20)

repeat for

c_give("green_cap_cooked", 20)

 

Eat the green_cap to loose sanity, eat the green_cap_cooked to recover sanity, see if it's work fine, adjust the values if not.

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
×
  • Create New...