Jump to content

Making a food item slowly regen sanity


boardman94

Recommended Posts

I have a food item that I want to make regen the players sanity over time.

I have tried using sanity:DoDelta, that is only instant.

I have tried making the player have a sanityaura, that doesn't work.

I can do repeated DoDeltas (with a task) but then it plays the sound and flashes the indicator green.

I want just the arrow. I looked at the code for the garland but could not find the sanity part.

 

Any help would be great.

Thanks

Link to comment
Share on other sites

So I started working on this yesterday but it turns out it's quite difficult to add things to be counted into the sanity UI badge. I couldn't come up with a good solution after an hour. Good luck.

 

The simplest solution I could come up with was this for the prefab

 

inst.components.edible:SetOnEatenFn(oneaten)

 

local function oneaten(inst, eater)
  eater.components.sanity.dapperness = eater.components.sanity.dapperness + 1
  eater:DoTaskInTime(30, function (inst)
   inst.components.sanity.dapperness = inst.components.sanity.dapperness - 1
   end)
end
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...