ScriptName aaaKimachuuDungeonsExit Extends ObjectReference

GlobalVariable Property aaaKimachuuDungeonsNFFFollowerMove Auto
ObjectReference Property aaaKimachuuDungeonsTeleportRef Auto
Quest Property DialogueFollower Auto

Event OnActivate(ObjectReference akActionRef)
	akActionRef.MoveTo(aaaKimachuuDungeonsTeleportRef, 0.0, 0.0, 0.0, True)
	followerMoveFunction(aaaKimachuuDungeonsTeleportRef)
EndEvent

Function followerMoveFunction(ObjectReference obj01)
	if Game.GetModByName("nwsFollowerFramework.esp") < 255 && aaaKimachuuDungeonsNFFFollowerMove.GetValue() == 1
		Quest NFFQuest = DialogueFollower
		int i = 2
		While i <= 12
			Utility.Wait(0.1)
			Actor Follower = (NFFQuest.GetAlias(i) as ReferenceAlias).GetRef() as Actor
			if Follower
				Follower.MoveTo(obj01)
			endif
			i += 1
		EndWhile
	Endif
EndFunction