homo1145141919810 Posted September 24, 2021 Share Posted September 24, 2021 (edited) 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 Edited September 24, 2021 by homo1145141919810 Link to comment Share on other sites More sharing options...
DieFeM Posted September 25, 2021 Share Posted September 25, 2021 (edited) I would try with a perk, using an Activate entry point with Replace Default, which subject conditions are hunger or thirst, and target condition object type is bed. Edited September 25, 2021 by DieFeM Link to comment Share on other sites More sharing options...
DlinnyLag Posted September 25, 2021 Share Posted September 25, 2021 (edited) Is there a function that lets me abort the sleeping event? You can use something like PlayerRef.Moveto(PlayerRef) to interrupt started sleeping process. It is an example from Bethesda's Hardcore/HC_ManagerScript.psc Edited September 25, 2021 by DlinnyLag Link to comment Share on other sites More sharing options...
homo1145141919810 Posted September 26, 2021 Author Share Posted September 26, 2021 (edited) PlayerRef.Moveto(PlayerRef) This worked! Thank you Here is my modhttps://www.nexusmods.com/fallout4/mods/54681 Edited September 26, 2021 by homo1145141919810 Link to comment Share on other sites More sharing options...
Recommended Posts