Scriptname Dirty_QuestSoapScript extends Quest Actor Property PlayerRef Auto Spell Property Dirty_SoapEffectSpell Auto Spell Property Dirty_Spell_Dirt1 Auto Spell Property Dirty_Spell_Dirt2 Auto Spell Property Dirty_Spell_Dirt3 Auto Spell Property Dirty_Spell_Dirt4 Auto Spell Property Dirty_Spell_Blood1 Auto Spell Property Dirty_Spell_Blood2 Auto Spell Property Dirty_Spell_Blood3 Auto Spell Property Dirty_Spell_Blood4 Auto Spell Property Dirty_Spell_Clean Auto Sound Property Dirty_WashingMarkerSound auto Message Property Dirty_MessageBathWeapon Auto Message Property Dirty_MessageBathCombat Auto Message Property Dirty_MessageBathSoap Auto Formlist property Dirty_ListofSoaps Auto GlobalVariable Property Dirty_WashingAutomaticClothes Auto GlobalVariable Property Dirty_SoundEffect Auto Bool Property IsPlayerReady = false Auto Hidden Form[] Clothing Event OnInit() if IsRunning() IsPlayerReady = UseSoap(PlayerRef) if IsPlayerReady MySendModEvent("DirtyBatheStart") ; force 3rd person Game.ForceThirdPerson() Game.DisablePlayerControls(True, True, False, False, True, False, True) if Dirty_WashingAutomaticClothes.GetValue() == 1 Clothing = Undress(PlayerRef) endif Utility.Wait(0.1) PlayBatheAnimation(PlayerRef) if Dirty_WashingAutomaticClothes.GetValue() == 1 Reequip(PlayerRef, Clothing) endif ; enable controls Game.EnablePlayerControls() MySendModEvent("DirtyBatheFinish") else Debug.Notification("You have run out of soap") endif Utility.Wait(10.0) Stop() endif EndEvent Bool Function UseSoap(Actor akTarget) If akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(0)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(0)) elseif akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(1)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(1)) elseif akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(2)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(2)) elseif akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(3)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(3)) elseif akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(4)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(4)) elseif akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(5)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(5)) elseif akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(6)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(6)) elseif akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(7)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(7)) elseif akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(8)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(8)) elseif akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(9)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(9)) elseif akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(10)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(10)) elseif akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(11)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(11)) elseif akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(12)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(12)) elseif akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(13)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(13)) elseif akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(14)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(14)) elseif akTarget.GetItemCount(Dirty_ListofSoaps.GetAt(15)) > 0 akTarget.RemoveItem(Dirty_ListofSoaps.GetAt(15)) else return false Endif return true EndFunction Form[] Function Undress(Actor akTarget) weapon weapon1 weapon weapon2 if Game.GetModByName("All Geared Up Derivative.esp") != 255 Spell Display = Game.GetFormFromFile(0x02003000, "All Geared Up Derivative.esp") As Spell akTarget.RemoveSpell(Display) endif Form[] kClothing = new Form[33] Int Index = kClothing.Length While Index Index -= 1 Int ArmorSlotMask = Armor.GetMaskForSlot(Index + 30) kClothing[Index] = akTarget.GetWornForm(ArmorSlotMask) If kClothing[Index] && kClothing[Index].IsPlayable() akTarget.UnequipItem(kClothing[Index], False, True) EndIf EndWhile Weapon1 = akTarget.GetEquippedWeapon() Weapon2 = akTarget.GetEquippedWeapon(True) ;akTarget.Unequipall() if Weapon1 akTarget.UnequipItem(Weapon1, False, True) endif if Weapon2 akTarget.UnequipItem(Weapon2, False, True) endif return kClothing EndFunction Function Reequip(Actor akTarget, Form[] akClothing) if Game.GetModByName("All Geared Up Derivative.esp") != 255 Spell Display = Game.GetFormFromFile(0x02003000, "All Geared Up Derivative.esp") As Spell akTarget.AddSpell(Display) endif Int ClothingIndex = akClothing.Length While ClothingIndex ClothingIndex -= 1 If akClothing[ClothingIndex] akTarget.EquipItem(akClothing[ClothingIndex], False, True) EndIf EndWhile ;akTarget.EquipItemEx(Weapon1, 1, false, true) ;akTarget.EquipItemEx(Weapon2, 2, false, true) EndFunction Function PlayBatheAnimation(Actor akTarget) if Dirty_SoundEffect.GetValue() == 1 int instanceID = Dirty_WashingMarkerSound.play(akTarget) Sound.SetInstanceVolume(instanceID, 1.0) endif ; lather up Debug.SendAnimationEvent(akTarget, "IdleForceDefaultState") Utility.Wait(0.1) Debug.SendAnimationEvent(akTarget, "IdleSearchingChest") ;Utility.Wait(3.0) Utility.Wait( Utility.RandomFloat(3.0, 3.5) ) Debug.SendAnimationEvent(akTarget, "IdleStop") Utility.Wait(0.3) Debug.SendAnimationEvent(akTarget, "IdleWarmArms") ;Utility.Wait(1.5) Utility.Wait( Utility.RandomFloat(1.5, 2.0) ) Debug.SendAnimationEvent(akTarget, "IdleStop") akTarget.AddSpell(Dirty_SoapEffectSpell, False) Utility.Wait(0.3) Debug.SendAnimationEvent(akTarget, "IdleWarmArms") ;Utility.Wait(1.5) Utility.Wait( Utility.RandomFloat(1.5, 2.0) ) Debug.SendAnimationEvent(akTarget, "IdleStop") Utility.Wait(1.0) Debug.SendAnimationEvent(akTarget, "IdleWipeBrow") ;Utility.Wait(3.0) Utility.Wait( Utility.RandomFloat(3.0, 3.5) ) Debug.SendAnimationEvent(akTarget, "IdleStop") Utility.Wait(0.3) ; wash Debug.SendAnimationEvent(akTarget, "IdleWarmArms") ;Utility.Wait(1.5) Utility.Wait( Utility.RandomFloat(1.5, 2.0) ) Debug.SendAnimationEvent(akTarget, "IdleStop") Utility.Wait(0.3) Debug.SendAnimationEvent(akTarget, "IdleWarmArms") ;Utility.Wait(1.5) Utility.Wait( Utility.RandomFloat(1.5, 2.0) ) Debug.SendAnimationEvent(akTarget, "IdleStop") Utility.Wait(0.3) Debug.SendAnimationEvent(akTarget, "IdleWarmArms") ;Utility.Wait(1.5) Utility.Wait( Utility.RandomFloat(1.5, 2.0) ) Debug.SendAnimationEvent(akTarget, "IdleStop") Utility.Wait(0.3) Debug.SendAnimationEvent(akTarget, "IdleWarmArms") ;Utility.Wait(1.5) Utility.Wait( Utility.RandomFloat(1.5, 2.0) ) Debug.SendAnimationEvent(akTarget, "IdleStop") Utility.Wait(1.0) ; rinse off Debug.SendAnimationEvent(akTarget, "IdleWarmHandsCrouched") ;Utility.Wait(3.0) Utility.Wait( Utility.RandomFloat(3.0, 3.5) ) akTarget.RemoveSpell(Dirty_SoapEffectSpell) akTarget.RemoveSpell(Dirty_Spell_Dirt1) akTarget.RemoveSpell(Dirty_Spell_Dirt2) akTarget.RemoveSpell(Dirty_Spell_Dirt3) akTarget.RemoveSpell(Dirty_Spell_Dirt4) akTarget.RemoveSpell(Dirty_Spell_Blood1) akTarget.RemoveSpell(Dirty_Spell_Blood2) akTarget.RemoveSpell(Dirty_Spell_Blood3) akTarget.RemoveSpell(Dirty_Spell_Blood4) akTarget.AddSpell(Dirty_Spell_Clean, False) Utility.Wait(1.0) Debug.SendAnimationEvent(akTarget, "IdleStop") Utility.Wait(1.0) Debug.SendAnimationEvent(akTarget, "IdleWipeBrow") ;Utility.Wait(3.0) Utility.Wait( Utility.RandomFloat(3.0, 3.5) ) Debug.SendAnimationEvent(akTarget, "IdleStop") Utility.Wait(0.3) EndFunction Function MySendModEvent(String asEventName) Int h = ModEvent.Create(asEventName) if h ModEvent.Send(h) endif EndFunction