Added _00E_EquipControl, implemented torch reequipping fallback
This commit is contained in:
parent
9146903b39
commit
1cfacfadfc
Binary file not shown.
BIN
scripts/_00E_EquipControl.pex
Normal file
BIN
scripts/_00E_EquipControl.pex
Normal file
Binary file not shown.
Binary file not shown.
@ -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
|
||||
|
@ -35,17 +35,19 @@ 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()
|
||||
|
32
source/scripts/_00E_EquipControl.psc
Normal file
32
source/scripts/_00E_EquipControl.psc
Normal file
@ -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
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user