Lets give a example here
- Player Location == Riverwood
- NPC's location == Riften Blacksmith
- GetSleepState does not function this way
Reason for the Game Hour detection was to EvaluatePackage on a NPC, because Asbjorn would sometimes stay down in the basemant of Riften Blacksmith and not goto sleep period until the player actually entered the cell then his package would then Evaluate it self (reason for EVPBlacksmithOwner function). But what if another mod had changed the package schedule, this this would no longer be a valid sleep detection
Spoiler
ReferenceAlias Property pBalimund AutoReferenceAlias Property pAsbjorn AutoLocation Property pRiftenBlacksmithLocation AutoGlobalVariable Property pGameHour AutoPackage Property pRiftenBalimundSleep0x6 AutoPackage Property pRiftenAsbjornSleeps0x6 AutoFunction EVPBlacksmithOwner() If RiftenBlacksmithOwnersDead() Return EndIf If IsValidSleepHour() Actor akBalimund = pBalimund.GetActorRef() Actor akAsbjorn = pAsbjorn.GetActorRef() If akBalimund.GetCurrentPackage() != pRiftenBalimundSleep0x6 akBalimund.EvaluatePackage() EndIf If akAsbjorn.GetCurrentPackage() != pRiftenAsbjornSleeps0x6 akAsbjorn.EvaluatePackage() EndIf EndIfEndFunctionBool Function IsValidSleepHour() If (pGameHour.GetValue() >= 0 && pGameHour.GetValue() < 6) Return True EndIf Return FalseEndFunctionBool Function RiftenBlacksmithOwnersSleeping() Actor akBalimund = pBalimund.GetActorRef() Actor akAsbjorn = pAsbjorn.GetActorRef() ;incase the player has killed both actors, then they are sleeping with the fishes If RiftenBlacksmithOwnersDead() Return True EndIf If (akBalimund.GetCurrentPackage() == pRiftenBalimundSleep0x6 && akAsbjorn.GetCurrentPackage() == pRiftenAsbjornSleeps0x6) &&\ (akAsbjorn.GetCurrentLocation() == pRiftenBlacksmithLocation && akBalimund.GetCurrentLocation() == pRiftenBlacksmithLocation) &&\ IsValidSleepHour() Return True EndIf Return FalseEndFunctionBool Function RiftenBlacksmithOwnersDead() Actor akBalimund = pBalimund.GetActorRef() Actor akAsbjorn = pAsbjorn.GetActorRef() ;incase the player has killed both actors If akAsbjorn.IsDead() && akBalimund.IsDead() Return True EndIf Return FalseEndFunction