Scriptname _00E_Phasmalist_PlayerAliasScript extends ReferenceAlias

Actor Property PlayerREF Auto
_FS_Phasmalist_ControlQuest Property ControlQuest Auto
Keyword Property _00E_Phasmalist_NoSummonLocationTown Auto
Message Property _00E_Phasmalist_ForceDesummonMessageTown Auto
Message Property _00E_Phasmalist_ForceDesummonMessage Auto

Event OnLocationChange(Location akOldLoc, Location akNewLoc)
	If ControlQuest.IsBadApparitionLocation(akNewLoc)
		If ControlQuest.IsBadApparitionLocation(akOldLoc) == False && ControlQuest.IsApparitionSpawned()
			If akNewLoc && akNewLoc.HasKeyword(_00E_Phasmalist_NoSummonLocationTown)
				 _00E_QuestFunctions.ShowHelpMessage(_00E_Phasmalist_ForceDesummonMessageTown, 3.0)
			Else
				_00E_QuestFunctions.ShowHelpMessage(_00E_Phasmalist_ForceDesummonMessage, 3.0)
			EndIf
			RegisterForSingleUpdate(6.0)
		EndIf
	Else
		UnregisterForUpdate()
	EndIf
EndEvent

Event OnUpdate()
	ControlQuest.UnsummonApparition()
EndEvent