Jump to content

Sanity and hunger mod help


Recommended Posts

This will watch your character's hunger. When her hunger is below 20, once a second it will drop her sanity. How much sanity it drops increases as her hunger decreases.

inst:DoPeriodicTask(1, function(inst)	if inst.components.hunger.current < 20 then		inst.components.sanity:DoDelta((inst.components.hunger.current/inst.components.hunger.max)-1)	endend)
My suggestion is to change it so instead of waiting for her hunger to drop below a specific number, have it drop when below a certain percent. This makes it easy to adjust her stats without having to adjust when the sanity debuff will be applied. For example, this will apply the debuff when her hunger drops below 15%:

inst:DoPeriodicTask(1, function(inst)	if inst.components.hunger.current/inst.components.hunger.max < .15 then		inst.components.sanity:DoDelta((inst.components.hunger.current/inst.components.hunger.max)-1)	endend)
Link to comment
Share on other sites

This will watch your character's hunger. When her hunger is below 20, once a second it will drop her sanity. How much sanity it drops increases as her hunger decreases.

inst:DoPeriodicTask(1, function(inst)	if inst.components.hunger.current < 20 then		inst.components.sanity:DoDelta((inst.components.hunger.current/inst.components.hunger.max)-1)	endend)
My suggestion is to change it so instead of waiting for her hunger to drop below a specific number, have it drop when below a certain percent. This makes it easy to adjust her stats without having to adjust when the sanity debuff will be applied. For example, this will apply the debuff when her hunger drops below 15%:

inst:DoPeriodicTask(1, function(inst)	if inst.components.hunger.current/inst.components.hunger.max < .15 then		inst.components.sanity:DoDelta((inst.components.hunger.current/inst.components.hunger.max)-1)	endend)

Thanks! I took your suggestion and it worked great!

 

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