enderalse/source/scripts/_00e_treasuremarkerscript.psc

126 lines
3.2 KiB
Plaintext
Raw Normal View History

Scriptname _00E_TreasureMarkerScript extends ObjectReference
Import Utility
;=====================================================================================
; EVENTS
;=====================================================================================
2024-01-25 01:39:16 +00:00
Event OnInit()
Self.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")
2024-01-25 01:39:16 +00:00
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
; 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
Event OnBeginState()
;Nothing to do here
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
2024-01-25 01:39:16 +00:00
Idle Property DefaultSheathe Auto