enderalse/scripts/source/_00e_a2_eldritchbloodplayermarksc.psc

134 lines
3.7 KiB
Plaintext

Scriptname _00E_A2_EldritchBloodPlayerMarkSC extends ReferenceAlias
Import Utility
;=====================================================================================
; EVENTS
;=====================================================================================
Auto State Marking
Event OnCrosshairRefChange(ObjectReference ref)
if lastTarget != None
lastTarget.blockActivation(false)
EndIf
lastTarget = ref
ref.blockActivation(true)
If _00E_A2_EldritchBloodGlobal.GetValueInt() == 1
If Ref.GetSelfAsActor() && Ref != Game.GetPlayer()
EldritchBloodEffectScript.SelectEnemy(Ref as Actor)
EndIf
Else
UnregisterForCrosshairRef()
EndIf
EndEvent
Event OnAnimationEvent(ObjectReference akSource, string asEventName)
if(akSource == akSelfRef && asEventName == "weaponSwing")
if iAttackCounter == 0
iAttackCounter = 1
Else
; Debug.Notification(sMarkingModeInterrupted)
_00E_MarkingTalents_sMarkingModeInterrupted.Show()
EldritchBloodEffectScript.abort()
UnregisterForAnimationEvent(akSelfRef, "weaponSwing")
EndIf
EndIf
EndEvent
Event OnObjectEquipped(Form equippedObject, ObjectReference reference)
Shout equippedShout = equippedObject as Shout
if(!equippedShout)
; Debug.Notification(sMarkingModeInterrupted)
_00E_MarkingTalents_sMarkingModeInterrupted.Show()
EldritchBloodEffectScript.abort()
EndIf
EndEvent
Event OnSpellCast(Form akSpell)
Shout equippedShout = akSpell as Shout
if akSpell != _00E_A2_EldritchBloodSP
; Debug.Notification(sMarkingModeInterrupted)
_00E_MarkingTalents_sMarkingModeInterrupted.Show()
EldritchBloodEffectScript.abort()
EndIf
EndEvent
Event OnPlayerBowShot(Weapon akWeapon, Ammo akAmmo, float afPower, bool abSunGazing)
; Debug.Notification(sMarkingModeInterrupted)
_00E_MarkingTalents_sMarkingModeInterrupted.Show()
EldritchBloodEffectScript.abort()
EndEvent
EndState
;=====================================================================================
; FUNCTIONS
;=====================================================================================
Function EnterMarkingMode(Float iReach, _00E_A2_EldritchBloodPlayerSC _00E_A2_EldritchBloodMEScript)
akSelfRef = Self.GetActorReference()
RegisterForAnimationEvent(akSelfRef, "weaponSwing")
Game.DisablePlayerControls(false, false, false, false, false, false, false, false)
fActivatePickLengthBefore = GetINIFloat("fActivatePickLength:Interface")
SetINIFloat("fActivatePickLength:Interface", iReach)
EldritchBloodEffectScript = _00E_A2_EldritchBloodMEScript
RegisterForCrosshairRef()
EndFunction
Function ExitMarkingMode()
if lastTarget != None
lastTarget.blockActivation(false)
EndIf
lastTarget = None
iAttackCounter = 0
UnregisterForAnimationEvent(akSelfRef, "weaponSwing")
Game.EnablePlayerControls()
UnregisterForCrosshairRef()
SetINIFloat("fActivatePickLength:Interface", 150)
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
ObjectReference lastTarget ; the last target before the crosshair; used to block and unblock activation
Actor akSelfRef
int iAttackCounter
_00E_A2_EldritchBloodPlayerSC Property EldritchBloodEffectScript Auto Hidden
float fActivatePickLengthBefore
;String Property sMarkingModeInterrupted = "Marking interrupted by attacking." Auto
GlobalVariable Property _00E_A2_EldritchBloodGlobal Auto
Spell Property _00E_A2_EldritchBloodSP Auto
Shout Property _00E_A2_EldritchBlood Auto
Message Property _00E_MarkingTalents_sMarkingModeInterrupted Auto