diff --git a/DigControl.esp b/DigControl.esp new file mode 100644 index 00000000..f02e3252 Binary files /dev/null and b/DigControl.esp differ diff --git a/scripts/_00E_DigControl.pex b/scripts/_00E_DigControl.pex new file mode 100644 index 00000000..8c1f373a Binary files /dev/null and b/scripts/_00E_DigControl.pex differ diff --git a/scripts/_00E_EnderalControls.pex b/scripts/_00E_EnderalControls.pex index 0371adab..5b1815fd 100644 Binary files a/scripts/_00E_EnderalControls.pex and b/scripts/_00E_EnderalControls.pex differ diff --git a/scripts/_00e_playerfunctions.pex b/scripts/_00e_playerfunctions.pex index 2b163eb6..17b76a0e 100644 Binary files a/scripts/_00e_playerfunctions.pex and b/scripts/_00e_playerfunctions.pex differ diff --git a/scripts/_00e_treasuremarkerscript.pex b/scripts/_00e_treasuremarkerscript.pex index 53b6d937..cabc96bf 100644 Binary files a/scripts/_00e_treasuremarkerscript.pex and b/scripts/_00e_treasuremarkerscript.pex differ diff --git a/source/scripts/_00E_DigControl.psc b/source/scripts/_00E_DigControl.psc new file mode 100644 index 00000000..d2ae33fe --- /dev/null +++ b/source/scripts/_00E_DigControl.psc @@ -0,0 +1,79 @@ +Scriptname _00E_DigControl extends Quest Hidden + +import Utility + +bool function Dig() + + ; Play the mauling animation in werewolf form + if PlayerREF.GetRace() == _00E_Theriantrophist_PlayerWerewolfRace + if PlayerREF.IsInCombat() + _00E_TreasureMarkerScript_sCannotDigInCombat.Show() + return false + endif + Game.DisablePlayerControls(true, true, true, true, true, true, true, true) + Debug.SendAnimationEvent(PlayerREF, "pa_KillWerewolfPairedMaulingWithHuman") + Wait(4.8) + Game.EnablePlayerControls() + return true + endif + + if PlayerREF.GetItemCount(ShovelKeyword) == 0 + _00E_TreasureMarkerScript_sShovelNeeded.Show() + return false + endif + + if PlayerREF.IsInCombat() + _00E_TreasureMarkerScript_sCannotDigInCombat.Show() + return false + endif + + Game.DisablePlayerControls(true, true, true, true, true, true, true, true) + Game.SetPlayerAIDriven() + + bool isFirstPerson = PlayerREF.GetAnimationVariableBool("IsFirstPerson") + + ; Start digging + Game.ForceThirdPerson() + + Form[] equippedTorches = New Form[2] + Bool torchesUnequipping = (PlayerREF as _00E_PlayerFunctions).UnequipTorches(equippedTorches) + + If PlayerREF.IsWeaponDrawn() ; Sheathe the weapon + PlayerREF.PlayIdle(DefaultSheathe) + Wait(2) + ElseIf isFirstPerson ; Give some time for the camera to settle on switch to 3p + Wait(0.5) + ElseIf torchesUnequipping ; Give some time for torch unequip animations to settle + Wait(0.25) + EndIf + + Debug.SendAnimationEvent(PlayerREF, "IdleSmelterEnter") + Wait(5.0) + + ; Stop digging + Debug.SendAnimationEvent(PlayerREF, "IdleForceDefaultState") + + (PlayerREF as _00E_PlayerFunctions).ReequipTorches(equippedTorches) + Wait(1) + + Game.SetPlayerAIDriven(false) + Game.EnablePlayerControls() + + If isFirstPerson + Game.ForceFirstPerson() + EndIf + + return true + +endfunction + +Actor Property PlayerRef Auto + +Message Property _00E_TreasureMarkerScript_sCannotDigInCombat Auto +Message Property _00E_TreasureMarkerScript_sShovelNeeded Auto + +Keyword Property ShovelKeyword Auto + +Idle Property DefaultSheathe Auto + +Race Property _00E_Theriantrophist_PlayerWerewolfRace Auto diff --git a/source/scripts/_00E_EnderalControls.psc b/source/scripts/_00E_EnderalControls.psc index eb69bd98..bdbdb999 100644 --- a/source/scripts/_00E_EnderalControls.psc +++ b/source/scripts/_00E_EnderalControls.psc @@ -19,3 +19,5 @@ _00E_SoundControl Property SoundControl Auto _00E_SympathyControl Property SympathyControl Auto _00E_MiningControl Property MiningControl Auto + +_00E_DigControl Property DigControl Auto diff --git a/source/scripts/_00e_playerfunctions.psc b/source/scripts/_00e_playerfunctions.psc index ebbe9e3e..656ff615 100644 --- a/source/scripts/_00e_playerfunctions.psc +++ b/source/scripts/_00e_playerfunctions.psc @@ -63,6 +63,10 @@ _00E_MiningControl function GetMiningControl() Global return (Game.GetForm(0x14) as _00E_PlayerFunctions).ControlRepository.MiningControl endfunction +_00E_DigControl function GetDigControl() Global + return (Game.GetForm(0x14) as _00E_PlayerFunctions).ControlRepository.DigControl +endfunction + ;===================================================================================== ; Stop/restart random headtracking diff --git a/source/scripts/_00e_treasuremarkerscript.psc b/source/scripts/_00e_treasuremarkerscript.psc index 0fa2da8b..6d519a35 100644 --- a/source/scripts/_00e_treasuremarkerscript.psc +++ b/source/scripts/_00e_treasuremarkerscript.psc @@ -1,125 +1,39 @@ Scriptname _00E_TreasureMarkerScript extends ObjectReference -Import Utility - -;===================================================================================== -; EVENTS -;===================================================================================== - Event OnInit() - Self.BlockActivation() + BlockActivation() endEvent Auto State Waiting Event OnActivate (ObjectReference akActionRef) - ; Play the mauling animation in werewolf form - if akActionRef == PlayerREF && PlayerREF.GetRace() == Game.GetFormFromFile(0x2EE47, "Enderal - Forgotten Stories.esm") as Race - Game.DisablePlayerControls(true, true, true, true, true, true, true, true) - Debug.SendAnimationEvent(PlayerREF, "pa_KillWerewolfPairedMaulingWithHuman") - Utility.Wait(4.8) - Self.BlockActivation(False) - Game.EnablePlayerControls() - Self.Activate(PlayerREF) - GoToState("Alldone") + if akActionRef != Game.GetForm(0x14) return endif - If akActionRef.GetItemCount(ShovelKeyword) > 0 - TreasureDigger = akActionRef as Actor - if TreasureDigger.IsInCombat() - _00E_TreasureMarkerScript_sCannotDigInCombat.Show() - Else - GoToState("CurrentlyDigging") - EndIf - Else - _00E_TreasureMarkerScript_sShovelNeeded.Show() - EndIf - - EndEvent - -EndState - -State CurrentlyDigging - - Event OnBeginState() - - Form[] equippedTorches = New Form[2] - Bool isFirstPerson = False - - ; Start digging - If TreasureDigger == PlayerREF - Game.SetPlayerAIDriven() - Game.DisablePlayerControls(true, true, true, true, true, true, true, true) - isFirstPerson = PlayerREF.GetAnimationVariableBool("IsFirstPerson") - Game.ForceThirdPerson() - EndIf + GotoState("PlayerDigging") - ; TreasureDigger.PathToReference(Self, 1.0) - - If TreasureDigger == PlayerREF - Bool torchesUnequipping = (PlayerREF as _00E_PlayerFunctions).UnequipTorches(equippedTorches) - - If TreasureDigger.IsWeaponDrawn() ; Sheathe the weapon - TreasureDigger.PlayIdle(DefaultSheathe) - Wait(2) - ElseIf isFirstPerson ; Give some time for the camera to settle on switch to 3p - Wait(0.5) - ElseIf torchesUnequipping ; Give some time for torch unequip animations to settle - Wait(0.25) - EndIf - EndIf - - Debug.SendAnimationEvent(TreasureDigger, "IdleSmelterEnter") - Wait(5.0) - - ; Stop digging - Debug.SendAnimationEvent(TreasureDigger, "IdleForceDefaultState") - If TreasureDigger == PlayerREF - Game.SetPlayerAIDriven(false) - Game.EnablePlayerControls() - (PlayerREF as _00E_PlayerFunctions).ReequipTorches(equippedTorches) - Else - (TreasureDigger as Actor).EvaluatePackage() - EndIf - - Wait(1) - - If TreasureDigger == PlayerREF && isFirstPerson == True - Game.ForceFirstPerson() - EndIf - - Self.BlockActivation(False) - Self.Activate(TreasureDigger) - GoToState("Alldone") - EndEvent EndState -State AllDone +State PlayerDigging Event OnBeginState() - ;Nothing to do here + if _00E_PlayerFunctions.GetDigControl().Dig() + BlockActivation(false) + GoToState("DoNothing") + Activate(Game.GetForm(0x14) as Actor) + else + GoToState("Waiting") + endif EndEvent - ;Nothing to do here - EndState - -;===================================================================================== -; PROPERTIES -;===================================================================================== - -Actor TreasureDigger - -Message Property _00E_TreasureMarkerScript_sCannotDigInCombat Auto -Message Property _00E_TreasureMarkerScript_sShovelNeeded Auto - -Keyword Property ShovelKeyword Auto -Actor Property PlayerREF Auto -Idle Property DefaultSheathe Auto +State DoNothing + ; Nothing to do here +EndState