Moved mound digging to a quest

This commit is contained in:
Eddoursul 2024-02-05 01:33:58 +01:00
parent 300b559ba3
commit 0c25f928dc
9 changed files with 99 additions and 100 deletions

BIN
DigControl.esp Normal file

Binary file not shown.

BIN
scripts/_00E_DigControl.pex Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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

View File

@ -19,3 +19,5 @@ _00E_SoundControl Property SoundControl Auto
_00E_SympathyControl Property SympathyControl Auto
_00E_MiningControl Property MiningControl Auto
_00E_DigControl Property DigControl Auto

View File

@ -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

View File

@ -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