diff --git a/scripts/_00e_complex_addsilencesc.pex b/scripts/_00e_complex_addsilencesc.pex index e1073e56b..3b1c41980 100644 Binary files a/scripts/_00e_complex_addsilencesc.pex and b/scripts/_00e_complex_addsilencesc.pex differ diff --git a/source/scripts/_00e_complex_addsilencesc.psc b/source/scripts/_00e_complex_addsilencesc.psc index 970ba998e..3d7fb82e2 100644 --- a/source/scripts/_00e_complex_addsilencesc.psc +++ b/source/scripts/_00e_complex_addsilencesc.psc @@ -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) - _00E_SilenceLongTransitionHighPriority.Add() - bActive = true + If (__Config_QuestToSet.GetCurrentStageID() >= __Config_iMinStage) && (__Config_QuestToSet.GetCurrentStageID() <= __Config_iMaxStage) + if GetState() == "" + _00E_SilenceLongTransitionHighPriority.Add() + 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 - RegisterForSingleUpdate(3.0) - EndIf -EndEvent +Event OnCombatStateChanged(Actor akTarget, int aeCombatState) + ; +endEvent -Event OnUpdate() - _00E_SilenceLongTransitionHighPriority.Remove() - bActive = false -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 + + Event OnUpdate() + GoToState("") + EndEvent + + Event OnEndState() + _00E_SilenceLongTransitionHighPriority.Remove() + ;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