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()
			Message.ResetHelpMessage("Empty")
			If akNewLoc && akNewLoc.HasKeyword(_00E_Phasmalist_NoSummonLocationTown)
				_00E_Phasmalist_ForceDesummonMessageTown.ShowAsHelpMessage("Empty", 3.0, 1.0, 1)
			Else
				_00E_Phasmalist_ForceDesummonMessage.ShowAsHelpMessage("Empty", 3.0, 1.0, 1)
			EndIf
			RegisterForSingleUpdate(6.0)
		EndIf
	Else
		UnregisterForUpdate()
	EndIf
EndEvent

Event OnUpdate()
	ControlQuest.UnsummonApparition()
EndEvent