heya, I made some changes to the way you're handling the water requirement to be more seamless with the Soap Required feature and refactored the code a bit. Feel free use it on your version, I'll explain it a bit
Your version with my comments:
Here you nest the water conditions within the Soap Required feature, therefore the users are only required to be in water if they have that feature disabled, which in my view are unrelated.
There's also this issue that if they have that disabled they will not spend the soap in the inventory which is also not desirable because the user might want to have the soap requirement off but still use and spend the soaps when they have them.
Lastly you call the function to actually spend the soap but then again, this is only if they have the soap required feature enabled. That part of the code could also be improved as there are some repetition (checking for the same thing twice).
Event OnEffectStart(Actor akTarget, Actor akCaster) If (!Dirty_BatheQuest) Dirty_BatheQuest = Game.GetFormFromFile(0x00000DC3, "Dirt and Blood - Dynamic Visuals.esp") as Dirty_BathingQuest Debug.trace("DIRTY quest is now " + Dirty_BatheQuest) endIf If PlayerRef.IsInCombat() Dirty_MessageBathCombat.Show() elseif PlayerRef.IsWeaponDrawn() Dirty_MessageBathWeapon.Show()
The water requirement is checked regardless of the SoapRequired because that's an unrelated feature.
If the user has soaps it doesn't matter if they have the SoapRequired toggle enabled or not, they have soaps after all, so why check if the soap requirement is enabled? just call the animation function with the removeSoap boolean set to true and be done with it without unnecessary validations.
If they don't have soaps then yes, we can check if the user has that feature enabled and show the appropriate message and not allow them to take the bath.
Otherwise just play the animation and don't remove the soap since they don't have any this is good because the popular animation replacement script here on the nexus plays the animation with a rug when you call the function with the removeSoap set to false making the integration seamless.
Event OnEffectStart(Actor akTarget, Actor akCaster) If (!Dirty_BatheQuest) Dirty_BatheQuest = Game.GetFormFromFile(0x00000DC3, "Dirt and Blood - Dynamic Visuals.esp") as Dirty_BathingQuest Debug.trace("DIRTY quest is now " + Dirty_BatheQuest) endIf If PlayerRef.IsInCombat() Dirty_MessageBathCombat.Show() ElseIf PlayerRef.IsWeaponDrawn() Dirty_MessageBathWeapon.Show()
PS: What an ungodly "CODE" feature nexus has, code boxes shouldn't wrap... sorry for the mess with the comments, hope it's readable enough. I can send you the code without the comments by pm.
Post PS: I removed all comments from the code blocks and added them as pseudocode explanations above each box instead.
I don't know it it's your mod or some other problem but, sometimes when standing in water, the PC eats the soap instead of bathing. Not all water does this. How is your script detecting water? Cause Damage flag? Not sure how to trouble shoot as I have added Cause Damage flag every where I could find water.
(For instance, Raven Rock Bathouse doesn't work. Even after adding Cause Damage Flag.)
ffs just use a bashed patch or a synthesis patch, you'll need one or the one (optimally both) anyway for leveled lists, records and etc Just tick the option/add the patch water causes damage, there's no need to blindly add the flag "everywhere" with water. Plus, some water mods, already come with the flag, it shouldn't even be needed after po3's universal water damage fix
Hello. Quick suggestions, without intending any harm;
- You may want to allow this to detect water reliably without using other mods or Synthesis ETC.
- You may also want to address compatibility with Simple Inn Baths, though perhaps this should be asked of the author of that. I've no idea what they've done so that the tub water in the instanced bath room isn't actual water.
The condition that checks if you're in water is a bit too strict; it does not scan for nearby water bassin or bathes, something you can use when washing yourself. elseif !IsActorInWater(akTarget) Is there an option (maybe you can give me a pointer) to scan around for water instead. Since PO3's water detection is already included, could we not use one of its functions (not sure if there is any) to facilitate this?
+1 I would love a compatibility patch with Simple Inn Bath, there you bathe in a large basin that's technically not water, though it looks amazing. It was basically the main reason I uninstalled this
I believe that would be caused by the Simple Inn Bath tubs lacking the proper keywords, which would be solved using this mod. Also has the side effect of causing other mods' water to work as well, such as Legacy of the Dragonborn.
This mod in amazing, but it breaks immersion for me in the answering dialogue, because when for example a kid is telling me I stink, (hehe) I have a non immersive answer to give back, like ok lets play a game for instance.
Added NPC reactions plugin, so I changed this mod page name. Only guards and kids react to your dirtiness and bloodiness for now. Generate and editing voice lines take too much time. I'm also thinking about allowing bathing near wells/wash basins but need to figure out how to do it first :) Edited: Uploaded 2.0b to fix FOMOD missing pekora image which is unforgivable!
47 comments
Your version with my comments:
Event OnEffectStart(Actor akTarget, Actor akCaster)
If (!Dirty_BatheQuest)
Dirty_BatheQuest = Game.GetFormFromFile(0x00000DC3, "Dirt and Blood - Dynamic Visuals.esp") as Dirty_BathingQuest
Debug.trace("DIRTY quest is now " + Dirty_BatheQuest)
endIf
If PlayerRef.IsInCombat()
Dirty_MessageBathCombat.Show()
elseif PlayerRef.IsWeaponDrawn()
Dirty_MessageBathWeapon.Show()
elseif Dirty_SoapRequired.GetValue() == 0
If IsActorUnderwater(akTarget)
Debug.Notification("Cannot bathe underwater.")
elseif PlayerRef.IsSwimming()
Debug.Notification("Cannot bathe while swimming.")
elseif !IsActorInWater(akTarget)
Debug.Notification("Cannot bathe without water.")
Else
Dirty_BatheQuest.PlayBatheAnimation(PlayerRef, true)
EndIf
elseif Dirty_SoapRequired.GetValue() == 1 && PlayerRef.GetItemCount(Dirty_ListofSoaps) == 0
Dirty_MessageBathSoap.Show()
elseif Dirty_SoapRequired.GetValue() == 1 && PlayerRef.GetItemCount(Dirty_ListofSoaps) > 0
Dirty_BatheQuest.PlayBatheAnimation(PlayerRef, true, true)
EndIf
EndEvent
My version of the OnEffectStart function:
Event OnEffectStart(Actor akTarget, Actor akCaster)
If (!Dirty_BatheQuest)
Dirty_BatheQuest = Game.GetFormFromFile(0x00000DC3, "Dirt and Blood - Dynamic Visuals.esp") as Dirty_BathingQuest
Debug.trace("DIRTY quest is now " + Dirty_BatheQuest)
endIf
If PlayerRef.IsInCombat()
Dirty_MessageBathCombat.Show()
ElseIf PlayerRef.IsWeaponDrawn()
Dirty_MessageBathWeapon.Show()
ElseIf IsActorUnderwater(akTarget)
Debug.Notification("Cannot bathe underwater.")
ElseIf PlayerRef.IsSwimming()
Debug.Notification("Cannot bathe while swimming.")
ElseIf !IsActorInWater(akTarget)
Debug.Notification("Cannot bathe without water.")
Else
If PlayerRef.GetItemCount(Dirty_ListofSoaps) > 0
Dirty_BatheQuest.PlayBatheAnimation(PlayerRef, true, true)
ElseIf Dirty_SoapRequired.GetValue() == 1
Dirty_MessageBathSoap.Show()
Else
Dirty_BatheQuest.PlayBatheAnimation(PlayerRef, true)
EndIf
EndIf
EndEvent
hope you find this useful :)
PS: What an ungodly "CODE" feature nexus has, code boxes shouldn't wrap... sorry for the mess with the comments, hope it's readable enough. I can send you the code without the comments by pm.
Post PS: I removed all comments from the code blocks and added them as pseudocode explanations above each box instead.
have a good day!
(For instance, Raven Rock Bathouse doesn't work. Even after adding Cause Damage Flag.)
- You may want to allow this to detect water reliably without using other mods or Synthesis ETC.
- You may also want to address compatibility with Simple Inn Baths, though perhaps this should be asked of the author of that. I've no idea what they've done so that the tub water in the instanced bath room isn't actual water.
elseif !IsActorInWater(akTarget)
Is there an option (maybe you can give me a pointer) to scan around for water instead. Since PO3's water detection is already included, could we not use one of its functions (not sure if there is any) to facilitate this?
I would love a compatibility patch with Simple Inn Bath, there you bathe in a large basin that's technically not water, though it looks amazing. It was basically the main reason I uninstalled this
Thank you for your work!!
Dialogues like "you filthy nord/nuah"
Only guards and kids react to your dirtiness and bloodiness for now. Generate and editing voice lines take too much time.
I'm also thinking about allowing bathing near wells/wash basins but need to figure out how to do it first :)
Edited: Uploaded 2.0b to fix FOMOD missing pekora image which is unforgivable!