enderalse/source/scripts/_00e_treasuremarkerscript.psc

113 lines
2.8 KiB
Plaintext
Raw Normal View History

Scriptname _00E_TreasureMarkerScript extends ObjectReference
Import Utility
;=====================================================================================
; EVENTS
;=====================================================================================
Auto State Waiting
Event OnLoad()
Self.BlockActivation()
endEvent
Event OnActivate (ObjectReference akActionRef)
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
Idle Property DefaultSheathe Auto