Scriptname _00E_SetTimescaleAndFreezeScript extends ObjectReference  

Event OnTriggerEnter(ObjectReference akActionRef)

if akActionRef == PlayerREF
	Debug.Notification("Trigger entered, Time-manipulation started")
	TimescaleBefore = Timescale.GetValue()
	Timescale.SetValue(TimescaleModValue)
	RegisterForSingleUpdate(1)
EndIf

EndEvent

Event OnTriggerLeave(ObjectReference akActionRef)

if akActionRef == PlayerREF
	Debug.Notification("Trigger left, timescale reset to normal")
	Timescale.SetValue(TimescaleBefore)
EndIf
EndEvent

Event OnUpdate()
	if GameHour.GetValue() == DesiredGameHour
		UnregisterForUpdate()
		Timescale.SetValue(0)
	Else
		RegisterForSingleUpdate(1)
	EndIf
EndEvent



	
float TimescaleBefore	
float Property TimescaleModValue Auto
float Property DesiredGameHour Auto  ;Freeze the game-hour at this point

Actor Property PlayerREF Auto
GlobalVariable Property Timescale Auto
GlobalVariable Property GameHour Auto