Well you could do a looping timer, which checks if (new_sanity >= old_sanity) 0.5 seconds ago.
If it isn't, it deducts x sanity from the player, and checks if (sanity >= (sanity - x)).
(If it is true it doesn't deduct sanity and recalls the timer)
This can loop every 0.5 seconds. x should be really small. The drawback is it will deduce extra sanity when you lose sanity other ways.
As mentioned earlier you can also make a full conversion, but if you weren't planning on making a full conversion in the first place, this is a pretty good alternative. (I've used it in my story

)