diff --git a/scripts/_00E_DigControl.pex b/scripts/_00E_DigControl.pex index ad7b8dda..1114b736 100644 Binary files a/scripts/_00E_DigControl.pex and b/scripts/_00E_DigControl.pex differ diff --git a/scripts/_00E_EquipControl.pex b/scripts/_00E_EquipControl.pex new file mode 100644 index 00000000..fa951d72 Binary files /dev/null and b/scripts/_00E_EquipControl.pex differ diff --git a/scripts/_00E_TorchControl.pex b/scripts/_00E_TorchControl.pex index 947283cc..7b20f3b1 100644 Binary files a/scripts/_00E_TorchControl.pex and b/scripts/_00E_TorchControl.pex differ diff --git a/scripts/scriptarchiveorder.txt b/scripts/scriptarchiveorder.txt index 6b44d16c..f594c5ff 100644 --- a/scripts/scriptarchiveorder.txt +++ b/scripts/scriptarchiveorder.txt @@ -2267,6 +2267,7 @@ scripts\ski_settingsmanager.pex scripts\ski_widgetbase.pex scripts\ski_widgetmanager.pex scripts\_00e_torchcontrol.pex +scripts\_00e_equipcontrol.pex scripts\_00e_digcontrol.pex scripts\tif__000a5ebd.pex scripts\tif__000a5ebe.pex diff --git a/source/scripts/_00E_DigControl.psc b/source/scripts/_00E_DigControl.psc index 2eda1ecf..029e4dea 100644 --- a/source/scripts/_00E_DigControl.psc +++ b/source/scripts/_00E_DigControl.psc @@ -35,18 +35,20 @@ bool function Dig() ; Start digging Game.ForceThirdPerson() - Form[] equippedTorches = New Form[2] - Bool torchesUnequipping = _00E_TorchControl.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 + If 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 + endif + + Form[] equippedTorches = New Form[2] + bool bUnequippingTorch = _00E_TorchControl.UnequipTorches(equippedTorches) + if bUnequippingTorch + ; Give some time for torch unequip animations to settle Wait(0.25) - EndIf + endif + _00E_EquipControl.SheatheWeapon(PlayerREF) + Wait(0.5) + Debug.SendAnimationEvent(PlayerREF, "IdleSmelterEnter") Wait(5.0) @@ -54,7 +56,7 @@ bool function Dig() Debug.SendAnimationEvent(PlayerREF, "IdleForceDefaultState") _00E_TorchControl.ReequipTorches(equippedTorches) - Wait(1) + Wait(1.0) Game.SetPlayerAIDriven(false) Game.EnablePlayerControls() diff --git a/source/scripts/_00E_EquipControl.psc b/source/scripts/_00E_EquipControl.psc new file mode 100644 index 00000000..9e3e2425 --- /dev/null +++ b/source/scripts/_00E_EquipControl.psc @@ -0,0 +1,32 @@ +Scriptname _00E_EquipControl Hidden + +bool function SheatheWeapon(Actor actorRef = None, bool bWaitForAnimation = true) global + + if actorRef == None + actorRef = Game.GetForm(0x14) as Actor + endif + + if ! actorRef.IsWeaponDrawn() + return false + endif + + if SKSE.GetVersion() + actorRef.SheatheWeapon() + else + Debug.SendAnimationEvent(actorRef, "Unequip") + endif + + if ! bWaitForAnimation + return true + endif + + int i = 0 + while i < 25 && actorRef.GetAnimationVariableBool("IsUnequipping") + Utility.Wait(0.1) + i += 1 + endwhile + Utility.Wait(0.1) + + return true + +endfunction diff --git a/source/scripts/_00E_TorchControl.psc b/source/scripts/_00E_TorchControl.psc index 0a81c7e0..47f766e7 100644 --- a/source/scripts/_00E_TorchControl.psc +++ b/source/scripts/_00E_TorchControl.psc @@ -8,8 +8,21 @@ EndFunction Bool Function UnequipTorches(Form[] equippedTorches) global Actor PlayerREF = Game.GetForm(0x14) as Actor + + if ! SKSE.GetVersion() + if PlayerREF.GetEquippedItemType(0) == 11 || PlayerREF.GetEquippedItemType(1) == 11 + Form torchDefault = Game.GetForm(0x1D4EC) + equippedTorches[0] = torchDefault + PlayerREF.UnequipItem(torchDefault as Light, false, true) + Utility.Wait(0.1) + return true + endif + return false + endif + Bool unequipping = False Int iHand = 0 + While iHand < equippedTorches.Length If PlayerREF.GetEquippedItemType(iHand) == 11 ; A torch is in the hand? Form torch = PlayerREF.GetEquippedObject(iHand) @@ -28,6 +41,18 @@ EndFunction Function ReequipTorches(Form[] equippedTorches) global Actor PlayerREF = Game.GetForm(0x14) as Actor + + if ! SKSE.GetVersion() + if equippedTorches[0] || equippedTorches[1] + equippedTorches[0] = None + equippedTorches[1] = None + if PlayerREF.GetItemCount(Game.GetForm(0x1D4EC)) > 0 + Debug.SendAnimationEvent(PlayerREF, "equipTorch") + endif + endif + return + endif + Int iHand = 0 While iHand < equippedTorches.Length Form torch = equippedTorches[iHand]