Scriptname _00E_MQ11c_RyneusEntryHeadacheSc extends ObjectReference  

;=====================================================================================
;              							 EVENTS                    					 
;=====================================================================================

Event OnTriggerEnter(ObjectReference akActionRef)

	If akActionRef != PlayerREF
		Return
	EndIf

	GoToState("DoNothing")

	Int mq11cStage = MQ11c.GetStage()
	If mq11cStage >= 60 && mq11cStage <= 65
		If _00E_MQ11c_Headache.GetValueInt() == 0
			Game.DisablePlayerControls(1, 1, 1, 0, 0, 1, 1)
			Game.ForceFirstPerson()
			Game.ShowFirstPersonGeometry(False)
			Game.SetPlayerAIDriven(True)
			
			If PlayerREF.IsOnMount()
				PlayerREF.Dismount()
				Utility.Wait(4)
			EndIf
			
			StaggerPushFFSelfAreaSP.Cast(playerREF, PlayerREF)
			PlayerREF.PlayIdle(TG05_KnockOut)
			MAGVampireSunlight.Play(PlayerREF)
			_00E_Ark_NQ_Kor_SunlightImod01.Apply()
			Utility.Wait(3.2)
			_00E_NPCKillBodyfall.Play(PlayerREF)
			FadeToBlackHoldImod.Apply()
			_00E_TimescaleDefault.SetValue(Timescale.GetValue())
			Utility.Wait(2)
			PlayerREF.MoveTo(WerkschauBullShitMarker)
			PlayerREF.PlayIdle(TG05_GetUp)
			Utility.Wait(1)
			FadeToBlackHoldImod.remove()
			Game.EnablePlayerControls()
			Game.SetPlayerAIDriven(False)
			Game.ShowFirstPersonGeometry(True)
			_00E_MQ11c_Thoughts.ShowAsHelpMessage("_00E_MQ11c_Thoughts", 5, 1, 1)
			MQ11cBlockMarker.enable()
			_00E_TeleportGlobal.SetValue(1)
			Timescale.SetValue(0.1)
			_00E_MQ11c_Headache.SetValue(1)
			Levelsystem.SkipTimeToHour(6.48)
			MQ11c.AddSilence()
			_00E_MQ11c_SilvergroveEntrySilence.SetValue(1)

			Disable()
		EndIf
	ElseIf mq11cStage > 65
		Disable()
	Else ; mq11cStage < 60
		GoToState("")
	EndIf

EndEvent

State DoNothing
	Event OnTriggerEnter(ObjectReference akActionRef)
		; Do nothing
	EndEvent
EndState


;=====================================================================================
;              							 PROPERTIES                    					 
;=====================================================================================

GlobalVariable Property _00E_MQ11c_Headache Auto
GlobalVariable Property Timescale Auto
GlobalVariable Property _00E_TimescaleDefault Auto
GlobalVariable Property _00E_TeleportGlobal Auto
GlobalVariable Property _00E_MQ11c_SilvergroveEntrySilence Auto

ObjectReference Property WerkschauBullShitMarker Auto
ObjectReference Property MQ11cBlockMarker Auto

Actor Property PlayerREF Auto
_00E_QuestFunctions Property Levelsystem Auto

Idle Property TG05_GetUp Auto
Idle Property TG05_KnockOut Auto
_00E_MQ11c_Functions Property MQ11c Auto

Message Property _00E_MQ11c_Thoughts Auto

Spell Property StaggerPushFFSelfAreaSP Auto

ImageSpaceModifier Property _00E_Ark_NQ_Kor_SunlightImod01 Auto
ImageSpaceModifier Property FadeToBlackHoldImod Auto

Sound Property MAGVampireSunlight Auto
Sound Property _00E_NPCKillBodyfall Auto