Scriptname SimpleNeeds extends ReferenceAlias

Float TimeToEat = 3.0
Float TimeToSleep = 8.0
; Keyword Property FoodKeyword auto

Event OnInit()
    Debug.Notification("SimpleNeeds EX 1.0")
    RegisterForSleep()
    RegisterForSingleUpdateGameTime(0.1)
EndEvent

Event OnUpdateGameTime()
  if (TimeToEat < 0.0) && (TimeToSleep < 0.0)
    Debug.Notification("You are hungry and sleepy.")
  else  
    If TimeToEat < 0.0
      Debug.Notification("You are hungry.")
    Else
      TimeToEat = TimeToEat - 0.1
    Endif
    If TimeToSleep < 0.0
      Debug.Notification("You are sleepy.")
    Else
      TimeToSleep = TimeToSleep - 0.1
    Endif
  Endif
  RegisterForSingleUpdateGameTime(0.1)
EndEvent

; Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
;   if (akBaseObject.HasKeyword(FoodKeyword))
;     TimeToEat = 6.0
;     Debug.Notification("You are sated for six hours.")
;   EndIf
; EndEvent

Event OnSleepStop(bool abInterrupted)
  TimeToSleep = 16.0
  TimeToEat = 1.0
EndEvent

Event OnPlayerUsePotion(form akForm, Int type)
	if (type == 3)
		TimeToEat = 6.0
		Debug.Notification("You are sated for six hours.")
	endif
endEvent
