I want to disable sleeping when the player is either hungry or thirsty to certain degrees(global variables configurable in MCM). Is there a function that lets me abort the sleeping event? Or should I bind another script to a different type of event? Here is my code;
Event OnPlayerSleepStart(float afSleepStartTime, float afDesiredSleepEndTime, ObjectReference akBed)
; if Hunger and Thirst values are equal or bigger than the threshold values, abort sleeping
; Value example: 1 is Peckish, 2 is Hungry, 3 is Famished, 4 is Ravenous, 5 is Starving
currentHunger = pPlayerREF.GetValue(HC_HungerEffect)
currentThirst = pPlayerREF.GetValue(HC_ThirstEffect)
If (currentHunger > THTS_HUNGERTHRESHOLD.GetValue() )
Debug.Notification("You feel too hungry to sleep.")
; Abort sleep
return
ElseIf (currentThirst > THTS_THIRSTTHRESHOLD.GetValue() )
Debug.Notification("You feel too thirsty to sleep.")
; Abort sleep
return
Else
return
Endif
EndEvent