Scriptname TEGTelDremorFollowerScript extends Quest  

Actor Property Dremora01melee  Auto  
Actor Property Dremora01missile  Auto  
Actor Property Dremora01magic  Auto  
GlobalVariable Property pPlayerFollowerCount Auto
Faction Property CurrentFollowerFaction  Auto  
ReferenceAlias Property pFollowerAlias  Auto  


Function SetFollower(ObjectReference FollowerRef)

	actor FollowerActor = FollowerRef as Actor
	If FollowerActor.GetRelationshipRank(Game.GetPlayer()) < 3 && FollowerActor.GetRelationshipRank(Game.GetPlayer()) >= 0
		FollowerActor.SetRelationshipRank(Game.GetPlayer(), 3)
	EndIf
	FollowerActor.SetPlayerTeammate()
	pFollowerAlias.ForceRefTo(FollowerActor)
	pPlayerFollowerCount.SetValue(1)
	
EndFunction

Function FollowerWait()

	actor FollowerActor = pFollowerAlias.GetActorRef() as Actor
	FollowerActor.SetAv("WaitingForPlayer", 1)
	pFollowerAlias.RegisterForUpdateGameTime(72)

EndFunction

Function FollowerFollow()

	actor FollowerActor = pFollowerAlias.GetActorRef() as Actor
	FollowerActor.SetAv("WaitingForPlayer", 0)
	SetObjectiveDisplayed(10, abdisplayed = false)

EndFunction

Function DismissFollower()

	If pFollowerAlias && pFollowerAlias.GetActorRef().IsDead() == False

		actor DismissedFollowerActor = pFollowerAlias.GetActorRef() as Actor
		DismissedFollowerActor.StopCombatAlarm()
		DismissedFollowerActor.SetPlayerTeammate(false)
		DismissedFollowerActor.SetAV("WaitingForPlayer", 0)
                DismissedFollowerActor.EvaluatePackage()
                pFollowerAlias.Clear()
                pPlayerFollowerCount.SetValue(0)
     Endif
EndFunction
