Moved torch reequipping to a separate script
This commit is contained in:
parent
1e76ddf587
commit
16f10be14a
Binary file not shown.
BIN
scripts/_00E_TorchControl.pex
Normal file
BIN
scripts/_00E_TorchControl.pex
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2268,6 +2268,7 @@ scripts\ski_questbase.pex
|
|||||||
scripts\ski_settingsmanager.pex
|
scripts\ski_settingsmanager.pex
|
||||||
scripts\ski_widgetbase.pex
|
scripts\ski_widgetbase.pex
|
||||||
scripts\ski_widgetmanager.pex
|
scripts\ski_widgetmanager.pex
|
||||||
|
scripts\_00e_torchcontrol.pex
|
||||||
scripts\_00e_digcontrol.pex
|
scripts\_00e_digcontrol.pex
|
||||||
scripts\tif__000a5ebd.pex
|
scripts\tif__000a5ebd.pex
|
||||||
scripts\tif__000a5ebe.pex
|
scripts\tif__000a5ebe.pex
|
||||||
|
Binary file not shown.
@ -36,7 +36,7 @@ bool function Dig()
|
|||||||
Game.ForceThirdPerson()
|
Game.ForceThirdPerson()
|
||||||
|
|
||||||
Form[] equippedTorches = New Form[2]
|
Form[] equippedTorches = New Form[2]
|
||||||
Bool torchesUnequipping = (PlayerREF as _00E_PlayerFunctions).UnequipTorches(equippedTorches)
|
Bool torchesUnequipping = _00E_TorchControl.UnequipTorches(equippedTorches)
|
||||||
|
|
||||||
If PlayerREF.IsWeaponDrawn() ; Sheathe the weapon
|
If PlayerREF.IsWeaponDrawn() ; Sheathe the weapon
|
||||||
PlayerREF.PlayIdle(DefaultSheathe)
|
PlayerREF.PlayIdle(DefaultSheathe)
|
||||||
@ -53,7 +53,7 @@ bool function Dig()
|
|||||||
; Stop digging
|
; Stop digging
|
||||||
Debug.SendAnimationEvent(PlayerREF, "IdleForceDefaultState")
|
Debug.SendAnimationEvent(PlayerREF, "IdleForceDefaultState")
|
||||||
|
|
||||||
(PlayerREF as _00E_PlayerFunctions).ReequipTorches(equippedTorches)
|
_00E_TorchControl.ReequipTorches(equippedTorches)
|
||||||
Wait(1)
|
Wait(1)
|
||||||
|
|
||||||
Game.SetPlayerAIDriven(false)
|
Game.SetPlayerAIDriven(false)
|
||||||
|
43
source/scripts/_00E_TorchControl.psc
Normal file
43
source/scripts/_00E_TorchControl.psc
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
Scriptname _00E_TorchControl Hidden
|
||||||
|
|
||||||
|
Int Function _GetHandSlotEx(int iHand) global
|
||||||
|
; By default, iHand = 0 for left hand, 1 for right hand
|
||||||
|
; In SKSE's "Equip Ex" functions though: iHand = 2 for left hand, 1 for right hand
|
||||||
|
Return 2 - iHand
|
||||||
|
EndFunction
|
||||||
|
|
||||||
|
Bool Function UnequipTorches(Form[] equippedTorches) global
|
||||||
|
Actor PlayerREF = Game.GetForm(0x14) as Actor
|
||||||
|
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)
|
||||||
|
If torch
|
||||||
|
PlayerREF.UnequipItemEx(torch, _GetHandSlotEx(iHand))
|
||||||
|
equippedTorches[iHand] = torch
|
||||||
|
unequipping = True
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
iHand += 1
|
||||||
|
EndWhile
|
||||||
|
|
||||||
|
Return unequipping
|
||||||
|
EndFunction
|
||||||
|
|
||||||
|
Function ReequipTorches(Form[] equippedTorches) global
|
||||||
|
Actor PlayerREF = Game.GetForm(0x14) as Actor
|
||||||
|
Int iHand = 0
|
||||||
|
While iHand < equippedTorches.Length
|
||||||
|
Form torch = equippedTorches[iHand]
|
||||||
|
If torch
|
||||||
|
If PlayerREF.GetItemCount(torch) > 0
|
||||||
|
PlayerREF.EquipItemEx(torch, _GetHandSlotEx(iHand), False, True)
|
||||||
|
EndIf
|
||||||
|
; "Forget" about the form to not keep it persistent if equippedTorches is a script's property or variable
|
||||||
|
equippedTorches[iHand] = None
|
||||||
|
EndIf
|
||||||
|
iHand += 1
|
||||||
|
EndWhile
|
||||||
|
EndFunction
|
@ -71,7 +71,7 @@ Function EnterClassMenu()
|
|||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
Form[] equippedTorches = New Form[2]
|
Form[] equippedTorches = New Form[2]
|
||||||
(PlayerREF as _00E_PlayerFunctions).UnequipTorches(equippedTorches)
|
_00E_TorchControl.UnequipTorches(equippedTorches)
|
||||||
|
|
||||||
_00E_RealWorldOrigin.MoveTo(playerREF)
|
_00E_RealWorldOrigin.MoveTo(playerREF)
|
||||||
_00E_Class_MenuMeditationSound.Play(PlayerREF)
|
_00E_Class_MenuMeditationSound.Play(PlayerREF)
|
||||||
|
@ -156,7 +156,7 @@ Function _TryStartSmoking()
|
|||||||
RegisterCancelKeys()
|
RegisterCancelKeys()
|
||||||
|
|
||||||
EquippedTorches = New Form[2]
|
EquippedTorches = New Form[2]
|
||||||
Bool bTorchesUnequipping = (PlayerRef as _00E_PlayerFunctions).UnequipTorches(EquippedTorches)
|
Bool bTorchesUnequipping = _00E_TorchControl.UnequipTorches(EquippedTorches)
|
||||||
|
|
||||||
If PlayerRef.IsWeaponDrawn()
|
If PlayerRef.IsWeaponDrawn()
|
||||||
_UnlockSmokingStage()
|
_UnlockSmokingStage()
|
||||||
@ -294,7 +294,7 @@ Function StopSmoking()
|
|||||||
StoredEquippedShield = None
|
StoredEquippedShield = None
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
(PlayerRef as _00E_PlayerFunctions).ReequipTorches(EquippedTorches)
|
_00E_TorchControl.ReequipTorches(EquippedTorches)
|
||||||
|
|
||||||
If StoredCameraState == 0
|
If StoredCameraState == 0
|
||||||
Game.ForceFirstPerson()
|
Game.ForceFirstPerson()
|
||||||
|
@ -82,48 +82,3 @@ Function ResumeRandomHeadTracking()
|
|||||||
Game.SetGameSettingFloat("fAIHoldDefaultHeadTrackTimer", fDefaultHeadTrackTimerOldValue)
|
Game.SetGameSettingFloat("fAIHoldDefaultHeadTrackTimer", fDefaultHeadTrackTimerOldValue)
|
||||||
Game.SetGameSettingFloat("fAIStayonScriptHeadtrack", fStayHeadTrackTimerOldValue)
|
Game.SetGameSettingFloat("fAIStayonScriptHeadtrack", fStayHeadTrackTimerOldValue)
|
||||||
EndFunction
|
EndFunction
|
||||||
|
|
||||||
|
|
||||||
;=====================================================================================
|
|
||||||
; Equip/unequip torches
|
|
||||||
;=====================================================================================
|
|
||||||
|
|
||||||
Int Function _GetHandSlotEx(int iHand)
|
|
||||||
; By default, iHand = 0 for left hand, 1 for right hand
|
|
||||||
; In SKSE's "Equip Ex" functions though: iHand = 2 for left hand, 1 for right hand
|
|
||||||
Return 2 - iHand
|
|
||||||
EndFunction
|
|
||||||
|
|
||||||
Bool Function UnequipTorches(Form[] equippedTorches)
|
|
||||||
Bool unequipping = False
|
|
||||||
Int iHand = 0
|
|
||||||
While iHand < equippedTorches.Length
|
|
||||||
If GetEquippedItemType(iHand) == 11 ; A torch is in the hand?
|
|
||||||
Form torch = GetEquippedObject(iHand)
|
|
||||||
If torch
|
|
||||||
UnequipItemEx(torch, _GetHandSlotEx(iHand))
|
|
||||||
equippedTorches[iHand] = torch
|
|
||||||
unequipping = True
|
|
||||||
EndIf
|
|
||||||
EndIf
|
|
||||||
|
|
||||||
iHand += 1
|
|
||||||
EndWhile
|
|
||||||
|
|
||||||
Return unequipping
|
|
||||||
EndFunction
|
|
||||||
|
|
||||||
Function ReequipTorches(Form[] equippedTorches)
|
|
||||||
Int iHand = 0
|
|
||||||
While iHand < equippedTorches.Length
|
|
||||||
Form torch = equippedTorches[iHand]
|
|
||||||
If torch
|
|
||||||
If GetItemCount(torch) > 0
|
|
||||||
EquipItemEx(torch, _GetHandSlotEx(iHand), False, True)
|
|
||||||
EndIf
|
|
||||||
; "Forget" about the form to not keep it persistent if equippedTorches is a script's property or variable
|
|
||||||
equippedTorches[iHand] = None
|
|
||||||
EndIf
|
|
||||||
iHand += 1
|
|
||||||
EndWhile
|
|
||||||
EndFunction
|
|
||||||
|
@ -117,7 +117,7 @@ Function TryPlayerActivate(ObjectReference myLinkedRef)
|
|||||||
;USKP 1.3.0 FixEnd
|
;USKP 1.3.0 FixEnd
|
||||||
|
|
||||||
EquippedTorches = New Form[2]
|
EquippedTorches = New Form[2]
|
||||||
If (PlayerREF as _00E_PlayerFunctions).UnequipTorches(EquippedTorches)
|
If _00E_TorchControl.UnequipTorches(EquippedTorches)
|
||||||
Utility.Wait(0.25) ; Give some time for torch unequip animations to settle
|
Utility.Wait(0.25) ; Give some time for torch unequip animations to settle
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
@ -193,7 +193,6 @@ Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile,
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
endEvent
|
endEvent
|
||||||
|
|
||||||
event onReset()
|
event onReset()
|
||||||
@ -220,7 +219,7 @@ Function OnFurnitureExit()
|
|||||||
; Debug.Trace(self + ": OnFurnitureExit")
|
; Debug.Trace(self + ": OnFurnitureExit")
|
||||||
If PlayerIsInFurniture
|
If PlayerIsInFurniture
|
||||||
PlayerIsInFurniture = False
|
PlayerIsInFurniture = False
|
||||||
(PlayerREF as _00E_PlayerFunctions).ReequipTorches(EquippedTorches)
|
_00E_TorchControl.ReequipTorches(EquippedTorches)
|
||||||
EndIf
|
EndIf
|
||||||
EndFunction
|
EndFunction
|
||||||
|
|
||||||
|
@ -153,8 +153,6 @@ bool bFX = FALSE
|
|||||||
Shade02 = selfRef.placeAtMe(EncWispShade) as Actor
|
Shade02 = selfRef.placeAtMe(EncWispShade) as Actor
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
;Set AV06 to 1 as a flag for being in this state (used in Frostmere Crypt)
|
|
||||||
selfRef.SetActorValue("Variable06", 1)
|
|
||||||
;/ selfRef.setActorValue("Variable07",1)
|
;/ selfRef.setActorValue("Variable07",1)
|
||||||
selfRef.damageActorValue("Magicka", -(selfRef.getActorValue("Magicka")))
|
selfRef.damageActorValue("Magicka", -(selfRef.getActorValue("Magicka")))
|
||||||
selfRef.SetActorValue("Magicka", 0.0)
|
selfRef.SetActorValue("Magicka", 0.0)
|
||||||
|
Loading…
Reference in New Issue
Block a user