enderalse/source/scripts/_00e_mc_calia_healmonitor.psc

80 lines
1.8 KiB
Plaintext

Scriptname _00E_MC_Calia_HealMonitor extends ReferenceAlias
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnCombatStateChanged(Actor akTarget, Int aeCombatState)
if aeCombatState == 1
InCombat = True
If _00E_MC_CaliaREF.IsEquipped(Torch01)
CarriedTorch = True
EndIf
RegisterForSingleUpdate(1)
ElseIf aeCombatState == 0
InCombat = False
CarriedTorch = False
EndIf
EndEvent
Event OnUpdate()
if InCombat == True
if PlayerREF.GetActorValuePercentage("Health") <= 0.45 && (_00E_MC_CaliaREF.GetCurrentPackage() != MC_Calia_CombatHeal)
_00E_MC_CaliaREF.EvaluatePackage()
EndIf
RegisterForSingleUpdate(1)
Else
Return
EndIf
EndEvent
Event OnPackageStart(Package akNewPackage)
if akNewPackage == MC_Calia_CombatHeal
_00E_MC_CaliaREF.Say(CaliaDialogue_HealPlayerTopic)
EndIf
EndEvent
Event OnPackageEnd(Package akOldPackage)
if akOldPackage == MC_Calia_CombatHeal
CaliaHeal.SetValueInt(1)
RegisterForSingleUpdateGameTime(0.05)
_00E_MC_CaliaREF.EvaluatePackage()
If CarriedTorch == True
_00E_MC_CaliaREF.EquipItem(Torch01, true)
EndIf
EndIf
EndEvent
Event OnUpdateGameTime()
CaliaHeal.SetValueInt(0)
EndEvent
;=====================================================================================
; PROPERTIES
;=====================================================================================
bool CarriedTorch
bool InCombat
Actor Property PlayerREF Auto
Light Property Torch01 Auto
GlobalVariable Property CaliaHeal Auto
Actor Property _00E_MC_CaliaREF Auto
Topic Property CaliaDialogue_HealPlayerTopic Auto
Package Property MC_Calia_CombatHeal Auto