Background for Skyrim SE
Member of the Form script
eventOnSleepStart(floatafSleepStartTime, floatafDesiredSleepEndTime)

Description

Wiki Description

Event called when the player goes to sleep - if this active magic effect/alias/form is registered for it.

Documentation Comment

Received when the player sleeps. Start and desired end time are in game time days (after registering)


Caveats

CK Wiki - Notes

  • Aliases and quests will automatically unregister for this event when the quest stops. Active magic effects will automatically unregister when they are removed.
  • This event is not relayed to any aliases or magic effects attached to the form.

Parameters

  1. floatafSleepStartTime

    CK Wiki Description

    The time the player went to sleep, in game days passed.

  2. floatafDesiredSleepEndTime

    CK Wiki Description

    The time the player wants to wake up at, in game days passed.


Examples

Function SomeFunction()
  RegisterForSleep() ; Before we can use OnSleepStart we must register.
EndFunction

Event OnSleepStart(float afSleepStartTime, float afDesiredSleepEndTime)
    Debug.Trace("Player went to sleep at: " + Utility.GameTimeToString(afSleepStartTime))
    Debug.Trace("Player wants to wake up at: " + Utility.GameTimeToString(afDesiredSleepEndTime))
endEvent

Auto-Generated Example

Scriptname MyCoolScript extends Form

event OnSleepStart(float afSleepStartTime, float afDesiredSleepEndTime)
    Debug.trace("Event received - OnSleepStart: afSleepStartTime = " + afSleepStartTime + " afDesiredSleepEndTime = " + afDesiredSleepEndTime)
endEvent

Related Pages


Additional References

View this event’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.