Okay, so those of you who have been following my mod list thread know what's going on here. Basically, what I've been working on is a bit of an overhaul to the game's camping system, which will replace the rather iffy approach I took in BTB's Game Improvements that just disabled camping in every cell entirely. What I currently have is a bit of a crime against nature that's been Frankensteined together from bits of other mods along with a good deal of my own work.
What got the gears in my head turning was a mod called Inns Rent Storage by The One And Only, which aimed to provide some degree of incentive (beyond "none whatsoever") to rent rooms by equipping all that lacked them with empty chests to stash your mountains of stolen [censored] in. Said chests lack ownership of any kind, so nobody will get on your case for using them (even the people you've been robbing blind, hilariously enough), though you will have to re-rent the room if you wait too long and get locked out. This is the mod that I started out with and started building on.
Next, since the goal of the mod is to strongly encourage the player to find a bed by gimping the hell out of camping, it became much more important that inns be readily accessible all around Vvardenfell. I found a mod called Clean Beds For Rent that added rooms to Dagon Fel, Gnisis, Molag Mar, and Suran that were *supposed* to be there, but this game was coded by a bunch of chimps on crack and, well, mistakes happen. Spirithawke has also suggested More Inns 2.0 that further expands upon this by adding rooms to the game's fishing villages (Hla Oad, Gnaar Mok, Ald Velothi, Khuul, and Arrille's Tradehouse at Seyda Neen) and Tel Aruhn. I'm a bit on the fence as to which, if any of those I would like to include, so if anybody has any input I'd be glad to hear it.
Speaking of Spirithawke, he has a mod called Owned Beds that helped me to accomplish a very important aspect of what this mod will aim to achieve, which is prevent the player from sleeping in owned beds (unless you've, *ahem* "disposed" of the owner). Of course, Spirithawke's mod provided the player with a gentle warning when attempting to sleep in an owned bed and then replaced owned beds with unowned ones upon the owner's death. My edited version simply says, "[censored] you, go rent a room", so it ended up being much simpler. I'll post the resulting script here shortly, as soon as I get done modifying it to work with the mod's main script.
So, then, moving on to the main portion of the mod... CAMPING! So, rather than just saying "[censored] you, no camping allowed" I've decided to take what I've learned from working with this game over the years and implement a better system that allows it while still encouraging the player to find a bed. In short, you will only be able to restore up to half of your maximum health and magicka by camping. How I had to script this is needlessly complex because the jackasses who coded this pile didn't give me a way to query a character's maximum health or magicka, but the end result of my efforts ended up being a hell of a lot more interesting and much more what I wanted than I was expecting.
Ok, so here's the code:
begin BTB_Sleeping_Arrangements short camping float hp float mp float xhp float xmp if ( btb_inn == 1 ) return elseif ( getpcsleep ) set camping to 1 elseif ( camping == 1 ) set xhp to ( ( player -> gethealth ) - hp ) set xmp to ( ( player -> getmagicka ) - mp ) set camping to 2 else set hp to ( player -> gethealth ) set mp to ( player -> getmagicka ) return endif if ( camping < 2 ) return endif if ( xhp >= hp ) set xhp to ( xhp * -1 ) player -> modcurrenthealth xhp else set xhp to ( ( player -> gethealth ) / -2 ) player -> modcurrenthealth xhp endif if ( xmp >= mp ) set xmp to ( xmp * -1 ) player -> modcurrentmagicka xmp else set xmp to ( ( player -> getmagicka ) / -2 ) player -> modcurrentmagicka xmp endif set camping to 0end
So, how does it work? Well, the script runs globally and keeps track of your health and magicka. After you rest, it checks your health and magicka again and then calculates the difference. It then does one of two things for each:
? If the difference is greater than or equal to the previous value, then half of your current amount will be subtracted
? If the difference is *less* than the previous value, then the difference will be subtracted from your current amount
So, for example, if you have 40 health and rest until you reach your maximum of 100, then 50 will be subtracted (leaving you at half of your maximum health). However, if you only manage to rest long enough to restore 30 of it, then all 30 will be subtracted. This makes camping a good way to regain some of your health if you're nearly dead - a character with only 6 health before resting would end up with 18 after resting long enough to recover 30 health - but rather imprudent as your sleep tends to get interrupted in the wild. Thus, even though the maximum health/magicka that can be restored through camping is 50% of their maximum values, the only way to get enough uninterrupted sleep to reach that cap is to rest in an interior cell such as a cave. This makes taking shelter when out in the wilderness useful without eliminating the need to go find a proper bed, which hopefully should make this entire aspect of the game much more interesting than it was before.