enderalse/source/scripts/_00e_a2_eldritchbloodplayermarksc.psc
Eddoursul 6f96053d76 Entropic Blood fixes:
- Controlled actor no longer remains hostile to player.
- Fixed floating in the air after save reload or player's death, occurred during victim selection or ghostwalking.
- Unmarking attacking actor unmarks its target as well.
2024-07-30 17:35:20 +02:00

135 lines
3.6 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
if ref
ref.blockActivation(true)
endif
If _00E_A2_EldritchBloodGlobal.GetValueInt() == 1
If ref as Actor && ref != Game.GetForm(0x14)
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")
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")
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