Ok here is the code but it actually triggers a quest. as I said this all works except the Block activate only works on the first shot and then fails on the next activate.
I am considering adding a loop to this which exits when the player wakes... for timing purposes.
Scriptname TheSleepingBed extends ObjectReference ObjectReference Property SpecialSleepingBed AutoQuest Property SleepingBedQuest AutoInt SleepStatebool SleptReferenceAlias Property SleepingPlayer Auto ;Player in QuestReferenceAlias Property SleepingPartner Auto ; CompanionEvent OnInit()SpecialSleepingBed.BlockActivation() : added because on load did not seem to work 100% ???EndeventEvent OnLoad()SpecialSleepingBed.BlockActivation()endEventEvent OnActivate(ObjectReference akActionRef)Actor Sleeper = akActionRef as Actor if Sleeper == Game.Getplayer()SleepingBedQuest.Start() ;Start quest that causes player to sleep, Quest has code in script to send player to be AI DrivenSleepingBedQuest.SetStage(10);Debug.notification("Player Sleep Starts")utility.wait(5.0)Else;Debug.notification("Actor Sleep Starts")utility.wait(15.0)endif; Debug.Trace("Activated by " + akActionRef);The following values are returned:;0 - Not sleeping;2 - Not sleeping, wants to sleep;3 - Sleeping;4 - Sleeping, wants to wake; Is the actor sleeping?SleepState = Sleeper.GetSleepState();Debug.notification("Sleeper State = " + SleepState)if SleepState == 3 && Sleeper == Game.Getplayer()Slept = True;Debug.Trace("Yes sleeping!")registerForSleep()Endifif SleepState == 3 && Sleeper != Game.Getplayer()Slept = True;Debug.Trace("Yes sleeping!")Endifif (Sleeper == Game.Getplayer() && SleepState == 3) || (Sleeper == Game.Getplayer() && SleepState == 4)Game.EnablePlayerControls()Game.SetPlayerAIDriven(False)SleepingPlayer.clear()SleepingPartner.clear()SleepingBedQuest.Stop()Utility.wait(5.0)endifif (SleepState == 4 || SleepState == 0) && (Sleeper != Game.Getplayer() && Slept == True)Slept = FalseEndifif (SleepState == 4 || SleepState == 0) && (Sleeper == Game.Getplayer() && Slept == True)Slept = FalseUnregisterForSleep()Game.ForceFirstPerson()EndifEndEvent