macrophage001 Posted April 3, 2020 Share Posted April 3, 2020 (edited) I'm currently working on a mod that requires the player to sleep for a set amount of time, which resets some variables when the player wakes up. I'm having a hard time figuring out how to track the player sleeping though and was wondering if someone could help me out? Here is my script code which i "procured" some of from Gopher's Pumping Iron mod. It does exactly what I need but for some reason I can't seem to apply it to my mod: Scriptname hw_SleepTrackerScript extends Quest GlobalVariable Property hw_MaxExhaustionPoints Auto GlobalVariable Property hw_ExhaustionPoints Auto GlobalVariable Property hw_SleptCounter Auto Float lastSlept Float sleepTime Float maxSleepHours = 8.0000 Float minTimeBetweenSleep = 0.5000 Float minTimesSlept = 7.0000 EVENT OnInit() RegisterForSleep() ENDEVENT EVENT OnSleepStart(Float afSleepStartTime, Float afDesiredSleepTime) If afSleepStartTime - lastSlept > minTimeBetweenSleep sleepTime = afDesiredSleepTime - afSleepStartTime Else sleepTime = 0.0000 EndIf ENDEVENT EVENT OnSleepStop(Bool abInterrupted) lastSlept = Utility.GetCurrentGameTime() if sleepTime >= maxSleepHours / 24 as Float hw_ExhaustionPoints.SetValue(0) if hw_SleptCounter.GetValue() == minTimesSlept hw_MaxExhaustionPoints.Mod(1) hw_SleptCounter.SetValue(0) else hw_SleptCounter.Mod(1) endif EndIf ENDEVENT Any help would be greatly appreciated. Thank you! Edited April 3, 2020 by macrophage001 Link to comment Share on other sites More sharing options...
macrophage001 Posted April 27, 2020 Author Share Posted April 27, 2020 Bump. Seems like this is an issue that's hard to solve? Link to comment Share on other sites More sharing options...
Recommended Posts