Use states in _00E_Complex_AddSilenceSC

This commit is contained in:
Eddoursul 2025-07-27 18:24:59 +02:00
parent 9442c10d26
commit 96f0e89d72
2 changed files with 44 additions and 15 deletions

View File

@ -1,11 +1,15 @@
Scriptname _00E_Complex_AddSilenceSC extends ObjectReference
; Eddoursul: Reworked in 2.1.4 to use states and the OnTrigger() event to encure silence track removal
Event OnTriggerEnter(ObjectReference akActionRef)
If akActionRef == PlayerREF
If (__Config_QuestToSet.GetCurrentStageID() >= __Config_iMinStage) && (__Config_QuestToSet.GetCurrentStageID() <= __Config_iMaxStage)
if GetState() == ""
_00E_SilenceLongTransitionHighPriority.Add()
bActive = true
GoToState("WaitLeave")
endif
EndIf
EndIf
@ -15,27 +19,52 @@ Event OnTriggerLeave(ObjectReference akActionRef)
If akActionRef == PlayerREF
_00E_SilenceLongTransitionHighPriority.Remove()
GoToState("")
UnregisterForUpdate()
bActive = false
;Debug.Notification("Leaving area")
EndIf
EndEvent
; 2.1.4 Failsafe to ensure silence removal when OnTriggerLeave does not fire
Event OnTrigger(ObjectReference akActionRef)
If bActive && akActionRef == PlayerREF
Event OnCombatStateChanged(Actor akTarget, int aeCombatState)
;
endEvent
State WaitLeave
Event OnBeginState()
RegisterForSingleUpdate(3.0)
;Debug.Notification("Waiting to leave")
EndEvent
Event OnCombatStateChanged(Actor akTarget, int aeCombatState)
if akTarget == PlayerREF
; Remove silence on combat start
if aeCombatState == 1
GoToState("")
endif
endif
endEvent
Event OnTrigger(ObjectReference akActionRef)
If akActionRef == PlayerREF
RegisterForSingleUpdate(3.0)
EndIf
EndEvent
EndEvent
Event OnUpdate()
Event OnUpdate()
GoToState("")
EndEvent
Event OnEndState()
_00E_SilenceLongTransitionHighPriority.Remove()
bActive = false
EndEvent
;Debug.Notification("Leaving area")
EndEvent
EndState
int Property __Config_iMinStage Auto
int Property __Config_iMaxStage Auto
Actor Property PlayerREF Auto
Quest Property __Config_QuestToSet Auto
MusicType Property _00E_SilenceLongTransitionHighPriority Auto
bool bActive