diff --git a/scripts/_00e_smoking_crossleggedmarkerscript.pex b/scripts/_00e_smoking_crossleggedmarkerscript.pex index f4add3bf..d7666aff 100644 Binary files a/scripts/_00e_smoking_crossleggedmarkerscript.pex and b/scripts/_00e_smoking_crossleggedmarkerscript.pex differ diff --git a/scripts/barreddoor.pex b/scripts/barreddoor.pex index 0e79a32e..53700b38 100644 Binary files a/scripts/barreddoor.pex and b/scripts/barreddoor.pex differ diff --git a/source/scripts/_00e_smoking_crossleggedmarkerscript.psc b/source/scripts/_00e_smoking_crossleggedmarkerscript.psc index 66bb0bb8..3ccb4443 100644 --- a/source/scripts/_00e_smoking_crossleggedmarkerscript.psc +++ b/source/scripts/_00e_smoking_crossleggedmarkerscript.psc @@ -12,70 +12,83 @@ Event OnEffectStart(Actor akTarget, Actor akCaster) ; Debug.Trace(self + ": OnEffectStart, " + akTarget) Target = akTarget - AnimationStage = 0 - RegisterForSingleUpdate(1.5) - RegisterForSleep() + GotoState("Smoking") EndEvent -Event OnUpdate() - _LockAnimationUpdates() +state Smoking - If AnimationStage == 0 && Target.GetSitState() != 3 - ; Debug.Trace(self + ": OnUpdate, " + Target + ", stage " + AnimationStage + ", waiting...") - RegisterForSingleUpdate(1.0) - ElseIf bIsFinished == False - AnimationStage += 1 - - ; Debug.Trace(self + ": OnUpdate, " + Target + ", stage " + AnimationStage) - - If AnimationStage == 1 - Target.SetHeadtracking(False) - Target.SetDontMove(True) - Debug.SendAnimationEvent(Target, "pipesmokingcrossleggedstartblaze") - Debug.SendAnimationEvent(Target, "pipesmokingcrossleggedblazed") - RegisterForSingleUpdate(2.5) - ElseIf AnimationStage == 2 - Debug.SendAnimationEvent(Target, "pipesmokingcrosslegged") - _00E_Smoking_PipeSmokingSmokeExhaleEffect.Play(Target, -1 as Float, none) + event OnBeginState() + ; Debug.Trace(self + ": Registering for updates, " + Target) + AnimationStage = 0 + RegisterForSingleUpdate(1.5) + RegisterForSleep() + endevent + + Event OnUpdate() + _LockAnimationUpdates() + + If AnimationStage == 0 && Target.GetSitState() != 3 + ; Debug.Trace(self + ": OnUpdate, " + Target + ", stage " + AnimationStage + ", waiting...") + RegisterForSingleUpdate(1.0) + ElseIf bIsFinished == False + AnimationStage += 1 + + ; Debug.Trace(self + ": OnUpdate, " + Target + ", stage " + AnimationStage) + + If AnimationStage == 1 + Target.SetHeadtracking(False) + Target.SetDontMove(True) + Debug.SendAnimationEvent(Target, "pipesmokingcrossleggedstartblaze") + Debug.SendAnimationEvent(Target, "pipesmokingcrossleggedblazed") + RegisterForSingleUpdate(2.5) + ElseIf AnimationStage == 2 + Debug.SendAnimationEvent(Target, "pipesmokingcrosslegged") + _00E_Smoking_PipeSmokingSmokeExhaleEffect.Play(Target, -1 as Float, none) + EndIf EndIf - EndIf - _UnlockAnimationUpdates() -EndEvent + _UnlockAnimationUpdates() + EndEvent -Event OnPackageChange(Package akOldPackage) - ; Debug.Trace(self + ": OnPackageChange, " + Target + ", old package " + akOldPackage) + Event OnSleepStart(float afSleepStartTime, float afDesiredSleepEndTime) + ; Debug.Trace(self + ": OnSleepStart, " + Target) - ; Failsafe auto-stop smoking on package change - Target.RemoveSpell(_00E_Smoking_CrossLeggedMarkerSP) -EndEvent + ; Force reset of the animations to make the NPC re-enter the furniture (if it wishes). + ; Fixes NPCs creeping away from the furniture while the player is sleeping in the same location. + _LockAnimationUpdates() + + If bIsFinished == False + UnregisterForUpdate() + StopAnimations(True) + Target.RemoveSpell(_00E_Smoking_CrossLeggedMarkerSP) + EndIf + + _UnlockAnimationUpdates() + EndEvent + + Event OnCellDetach() + GotoState("") + endEvent + + event OnEndState() + ; Debug.Trace(self + ": Unregistering for updates, " + Target) + UnregisterForUpdate() + UnregisterForSleep() + endevent + +endstate Event OnCellAttach() If ! bIsFinished - RegisterForSingleUpdate(1.0) - RegisterForSleep() + GotoState("Smoking") endif endEvent -Event OnCellDetach() - UnregisterForUpdate() - UnregisterForSleep() -endEvent - -Event OnSleepStart(float afSleepStartTime, float afDesiredSleepEndTime) - ; Debug.Trace(self + ": OnSleepStart, " + Target) - - ; Force reset of the animations to make the NPC re-enter the furniture (if it wishes). - ; Fixes NPCs creeping away from the furniture while the player is sleeping in the same location. - _LockAnimationUpdates() - - If bIsFinished == False - UnregisterForUpdate() - StopAnimations(True) - Target.RemoveSpell(_00E_Smoking_CrossLeggedMarkerSP) - EndIf +Event OnPackageChange(Package akOldPackage) + ; Debug.Trace(self + ": OnPackageChange, " + Target + ", old package " + akOldPackage) - _UnlockAnimationUpdates() + ; Failsafe auto-stop smoking on package change + Target.RemoveSpell(_00E_Smoking_CrossLeggedMarkerSP) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) diff --git a/source/scripts/barreddoor.psc b/source/scripts/barreddoor.psc index 9b312d7c..9c3f0a75 100644 --- a/source/scripts/barreddoor.psc +++ b/source/scripts/barreddoor.psc @@ -37,7 +37,9 @@ EVENT onActivate(objectReference actronaut) UnlockMeMSG.show() endif ; either way, play a nice ker-chunk sound to feedback why door isn't opening - barredSFX.play(self) + if barredSFX + barredSFX.play(self) + endif ; add a tiny rumble bump for good measure game.shakeController(0.1, 0.1, 0.1) else