
function CreateNPCGate1()


	-- setup table for npc
	NPCGate1			=	{}
	NPCGate1.name 		=	"NPC_Gate1"
	NPCGate1.callback	=	CreateNPCGate1Briefing
	        
	-- create npc
	CreateNPC(NPCGate1)
	
end

function CreateNPCGate1Briefing()

	NPCGate1Briefing					=	{}
	NPCGate1Briefing.restoreCamera		=	true
	NPCGate1Briefing.finished			=	NPCGate1BriefingFinished

	local page = 0
	
	if IsBridgeQuestDone() then
		
		if KeyForGate1Found ~= true then
		
		--	page 1
		
			page = page +1
		
			NPCGate1Briefing[page] 					= 	{}
			NPCGate1Briefing[page].title			= 	String.Key("Gatekeeper")
			NPCGate1Briefing[page].text				=	String.Key("NPCGate1Briefing[1].text")
			
			NPCGate1Briefing[page].position 		=	GetPosition("NPC_Gate1")
			NPCGate1Briefing[page].dialogCamera		=	true
	
			if NPCGate1BriefingShowTower == nil then
		
			--	page 2
			
				page = page +1
			                                        	
				NPCGate1Briefing[page] 					= 	{}
				NPCGate1Briefing[page].title			= 	String.Key("Gatekeeper")
				NPCGate1Briefing[page].text				=	String.Key("NPCGate1Briefing[2].text")
				                                    	
				NPCGate1Briefing[page].position 		=	GetPosition("P2_Nephilim_TribalCamp1")
				NPCGate1Briefing[page].explore			=	2000
				NPCGate1Briefing[page].marker			=	STATIC_MARKER
		                                            	
				NPCGate1BriefingShowTower				=	NPCGate1Briefing[page]
		
			end
	
		else
			
		--	page 1b
			
			page = page +1
		
			NPCGate1Briefing[page] 					= 	{}
			NPCGate1Briefing[page].title			= 	String.Key("Gatekeeper")
			NPCGate1Briefing[page].text				=	String.Key("NPCGate1Briefing[1b].text")
			
			NPCGate1Briefing[page].position 		=	GetPosition("NPC_Gate1")
			
			Gate1ToBeOpen = true
	
		end
	
	else
			
		--	page 1c
		
			page = page +1
		
			NPCGate1Briefing[page] 					= 	{}
			NPCGate1Briefing[page].title			= 	String.Key("Gatekeeper")
			NPCGate1Briefing[page].text			=	String.Key("NPCGate1Briefing[1c].text")
			
			NPCGate1Briefing[page].position 		=	GetPosition("NPC_Gate1")
			NPCGate1Briefing[page].dialogCamera		=	true
				
	end
	--	go
	
	StartBriefing(NPCGate1Briefing)
						
end

function NPCGate1BriefingFinished()

	if Gate1ToBeOpen ~= true then
			
		-- Reinit NPC
		CreateNPCGate1()
	
	else
	
		end1stSubChapter()
	
	end

end
