Scriptname __LALLSleepAtHomeScript extends ReferenceAlias  




Actor Property PlayerRef Auto
Actor Property Bjorn Auto Hidden
Actor Property Nicolette Auto Hidden
SexLabFramework Property sexLab Auto
GlobalVariable Property GameHour Auto
ImageSpaceModifier Property Black Auto
Quest Property ThisQuest Auto
Int Property StageReq Auto
ReferenceAlias Property BjornRA Auto
ReferenceAlias Property NicoletteRA Auto
Int Property WatchSexObjective Auto




Event OnTriggerEnter(ObjectReference akActionRef)
if akActionRef == PlayerRef && ThisQuest.GetStage() == StageReq
float hour = GameHour.GetValue()
if hour >= 21 || hour <= 5
Sleep()
else
debug.messagebox("It's not time to sleep right now. I should sleep after 9 PM.")
endif
endif
EndEvent

Function GetParents()
Bjorn = BjornRA.GetActorRef()
Nicolette = NicoletteRA.GetActorRef()

EndFunction


Function Sleep()
debug.messagebox("Time for bed!")
GetParents()
ParentsSex()
Game.FadeOutGame(true,true,0.5,1)
Black.Apply()
utility.wait(1.0)
debug.messagebox("One sheep... two sheep... three... shee... zzz")
utility.wait(2.0)
debug.messagebox("H...hm? I hear something in the other room. Maybe I should... *yawn* check it out?")
Black.Remove()
ThisQuest.SetObjectiveDisplayed(WatchSexObjective)
EndFunction


Function ParentsSex()
SexLab.QuickStart(Nicolette,Bjorn,none,none,none,none,"MyHook","sex")
RegisterForModEvent("AnimationEnding_MyHook","SexAnimEnded")
ThisQuest.SetObjectiveCompleted(WatchSexObjective)
EndFunction

Event SexAnimEnded(string eventName, string argString, float argNum, form sender)
if ThisQuest.GetStage() < 10
ThisQuest.SetStage(10)
UnregisterForModEvent("SexAnimEnded")
UnregisterForModEvent("AnimationEnding_MyHook")
endif
EndEvent