Jump to content

Aborting OnPlayerSleepStart when hungry/thirsty is possible?


Recommended Posts

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 by homo1145141919810
Link to comment
Share on other sites

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 by DieFeM
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...