enderalse/source/scripts/_00e_actorcarryscript.psc

40 lines
925 B
Plaintext

Scriptname _00E_ActorCarryScript extends Actor
Idle Property StopCarryingIdle Auto
Int nCarryStateCounter = 0
; Called from OnBegin in packages
Function StartCarrying()
; Debug.Trace(self + ", StartCarrying")
If nCarryStateCounter < 0 ; Just in case...
nCarryStateCounter = 1
Else
nCarryStateCounter += 1
EndIf
EndFunction
; Called from OnChange in packages
Function StopCarrying()
; Debug.Trace(self + ", StopCarrying")
nCarryStateCounter -= 1
_ResetCarrying()
EndFunction
Event OnCombatStateChanged(Actor akTarget, int aeCombatState)
If nCarryStateCounter > 0 && aeCombatState > 0
_ResetCarrying()
EndIf
EndEvent
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If nCarryStateCounter > 0
_ResetCarrying()
EndIf
EndEvent
Function _ResetCarrying()
PlayIdle(StopCarryingIdle)
EndFunction