So as the few followers I have (I know of only one; feel free to post guys) knows, one of the things I am struggling to provide a good solution to is the mod's ability to allow you to choose how to use and consume water. There are three real choices I'd like to make available.
- Bottling the water
- Drinking the water
- Bathing with the water
The menu options I want to present will allow the user to use water in the game with the mod in various combinations of these three ways.
[Easy Mode]
The easy mode would be to do all three with any given source of water. This would allow the user to fill any available water bottles (as long as that water didn't come from an existing bottled solution).
[Average Mode]
The average or medium difficulty mode is the recommended one. It basically states that with any given source of water any one of the above three solutions will work (given that you're not filling all your bottles from a bottle; I may eventually allow filling a bottle from a bottle for completeness sake but aside from that it will be initially not allowed).
[Hard Mode]
Finally there is hard mode; this mode allows you to do 1 and 2 from all sources that make sense but only allows bathing from larger sources of water (such as lakes, bathtubs, etc...). This option will likely be cut unless I come up with a fairly clever solution to the problem that large bodies of water are not really something I can script. I have a potential roundabout solution but it likely doesn't provide enough granularity to make a lot of sense.
The Trouble
The trouble with everything stems from the lack of scriptability of water from several sources. There are also issues with determining what source of water was even used. Some examples, I could say if the player is swimming then lower the hygiene penalty for simply swimming in water. The problem is that I have no access or reference to the type of water the player is swimming in so I have no idea how to script the hygiene monitors or recovery rates. This means you can swim in dirty radiated water and come out clean as a whistle as though you were using the Ultra Lux baths.
Another big issue is that you can drink from a pond or clear stream (pure water) but I can't attach a script directly to that action so, again, I have no idea what type of water the player is drinking from nor how to script even the option to offer the menu to allow the player a way to choose options 1, 2 or 3 above.
The Problems
Currently when drinking water a spell effect is added to the player to heal and sate H20 needs for hardcore mode. These get applied through Actor Effects (AE) linked to a particular water type. Each AE has a list of Base Effects (BEs) that affect the player. To each of the water AEs I've created and attached a BE that affects the new Hygiene attribute. Examples of the BEs normally attached to water are Damage Rads (for irradiated water), Restore Dehydration, Restore Health, etc... One frustrating experience I had when developing the hygiene BEs was that a very applicable attribute of BEs, magnitude, doesn't work on newly created scriptable BEs as there is no way to determine the magnitude from the script.
The flow is
Water -> Actor Effect -> Base Effect -> Script.
When I first started writing the mod I created 3 BEs to handle the hygiene penalty restoration, 20 BEs to handle hygiene penalty allocation, 20 BEs to handle waste penalty allocation and 43 associated scripts; one per BE. You may be asking me why do I need 20 BEs to handle allocation of these two new attributes? Rember the mangintude problem I described above? Yeah I have a ton of BEs with names like IncreaseHygiene5, IncreaseHygiene10, etc... I did 5 point allocation BEs from 5 to 100. One for each attribute where I could have had only one per attribute if the damn magnitude problem was fixed.
That alone is staggering and it's not yet enough, nor does it include the other scripts I have in place to do things like monitor the hygiene and variables to track the rest of the mod values and modifications.
Loss of Granularity
The first loss of granularity with water happens in the first chain link. The water type is unknown as they all use one of about 5 different types of AEs. This means the granularity I have is down to the 6 levels of AEs (pure, rads, good, average, bad, terrible). From this point, I can almost hard code the AE type in the BE scripts and have the water use quest (see below) act accordingly.
The second loss of granularity is in the 3 BEs I have handling the hygiene penalty resotration. 6->3 is, again, a 50% loss in granularity. I may end up having to write/copy the 3 BEs into 6; one per AE.
While limiting to the granularity of the AE types may seem to be sufficient, I lose one major component in the conversion from Water to AE. I now no longer know if the water source was a large body of water, a bathtub or a cup of water. This prevents me from allowing the players to play in Hard Mode.
My first thought was to copy all 6 AEs and create "big water" versions of them. In order to make this work I had to also duplicate the 3 BEs I have from things like RestoreHygiene1 to RestoreHygieneBigWater1. This means that if I want to have a 1:1 solution from AE to BE I now not only need to move to 6 BEs for restoring hygiene but 12. This may work, but it creates some mod incompatibilities described in more detail below.
If Bethesda, Obsidian or the NVSE/FOSE team would provide a way to determine the water type source that invoked the original AE effect I could do so much more. But enough of the pining, lets start solving the problem.
Water Type Mapping
I counted around 78 distinct water types without about half of those not being used in Fallout New Vegas (many of which look like hold overs from Fallout 3 with names like MegatonBombWater and WaterTypeRivetcitySubmerged).
If I created a 1:1 mapping for Water Type -> Actor Effects, I could essentially restore the bridge and loss of granularity. It would also require me to create a restore hygiene base effect for each actor effect. This would work for most of the problems I have and I could delete the existing 6 BEs I have (3 for water and 3 for "big water") as I would be able to tailor the restoration of hygiene to the specific water type.
This is great, right? I mean what's a little monotony in exchange for a better user experience, right? It may be, but it does introduce a new issue. First of all, I have now made the mod incompatible with any other mod that directly modifies the 6 Actor Effects Bethesda provided. Now, that may already be the case if another mod wants to modify the base effects of existing water types. I don't know if they merge or overwrite. I suspect they do the later which would make the mods incompatible.
If I stick to the original list of AEs, it would only conflict with mods that directly modify the AE's BEs. If you have ideas on an alternate solution to this, please let me know. I'm all ears.
Water Use Quest
So another issue with the whole BE/AE bits are that you cannot invoke a message box UI menu for the user from within an Actor Effect or Base Effect script. "But wait!" you cry, "there are already water bottling mods with menus when using the water!"
I thought it would be easy to. On close inspection of those mods it's clear that they only affect objects that provide you with water, not lakes and statics or other furniture items like outhouses. My solution to this problem, I think (as I haven't coded it yet), is to create a Water Use quest that runs in the background. When I want to invoke a menu from the base effect (or anywhere else), what I do is set a flag on the Water Use (WU) quest to show the menu and likely a few other context values to let the quest know which menu and what types of options to provide
This way, even with items, I can simply say Set FurtherNeedsWaterUse.WaterType to 1 (I have to make a numeric mapping since we can't have string variables) followed by setting a reference if I have one and any other context variables I can think of. When those are set I saySet FurtherNeedsWaterUse.Process to 1. This would queue the quest script, which is always looping, to show the message box (menu) and begin the process.
Closing Thoughts
This is a lot to read and process. If you have ideas or alternate solutions, please let me know. As I make some more progress I'll write more. Sorry Андрей, no updates yet.