
function CreateNPCGate2()


	-- setup table for npc
	NPCGate2			=	{}
	NPCGate2.name 		=	"NPC_Gate2"
	NPCGate2.callback	=	CreateNPCGate2Briefing
	        
	-- create npc
	CreateNPC(NPCGate2)
	
end

function CreateNPCGate2Briefing()

	NPCGate2Briefing					=	{}
	NPCGate2Briefing.restoreCamera		=	true
	NPCGate2Briefing.finished			=	NPCGate2BriefingFinished

	local page = 0
		
	if IsBridgeQuestDone() then	
		
		if KeyForGate2Found ~= true then
		
		--	page 1
		
			page = page +1
		
			NPCGate2Briefing[page] 					= 	{}
			NPCGate2Briefing[page].title			= 	String.Key("Gatekeeper")
			NPCGate2Briefing[page].text				=	String.Key("NPCGate2Briefing[1].text")
			
			NPCGate2Briefing[page].position 		=	GetPosition("NPC_Gate2")
			NPCGate2Briefing[page].dialogCamera		=	true
	
			if NPCGate2BriefingShowTower == nil then
		
			--	page 2
			
				page = page +1
			                                        	
				NPCGate2Briefing[page] 					= 	{}
				NPCGate2Briefing[page].title			= 	String.Key("Gatekeeper")
				NPCGate2Briefing[page].text				=	String.Key("NPCGate2Briefing[2].text")
				                                    	
				NPCGate2Briefing[page].position 		=	GetPosition("P2_Nephilim_TribalCamp2")
				NPCGate2Briefing[page].explore			=	2000
				NPCGate2Briefing[page].marker			=	STATIC_MARKER
		                                            	
				NPCGate2BriefingShowTower				=	NPCGate2Briefing[page]
		
			end
	
		else
			
		--	page 1
			
			page = page +1
		
			NPCGate2Briefing[page] 					= 	{}
			NPCGate2Briefing[page].title			= 	String.Key("Gatekeeper")
			NPCGate2Briefing[page].text				=	String.Key("NPCGate2Briefing[1b].text")
			
			NPCGate2Briefing[page].position 		=	GetPosition("NPC_Gate2")
			
			Gate2ToBeOpen = true
	
		end

	else

		--	page 1c
		
			page = page +1
		
			NPCGate2Briefing[page] 					= 	{}
			NPCGate2Briefing[page].title			= 	String.Key("Gatekeeper")
			NPCGate2Briefing[page].text				=	String.Key("NPCGate2Briefing[1c].text")
			
			NPCGate2Briefing[page].position 		=	GetPosition("NPC_Gate2")
			NPCGate2Briefing[page].dialogCamera		=	true

	
	end


	--	go
	
	StartBriefing(NPCGate2Briefing)
						
end

function NPCGate2BriefingFinished()

	if Gate2ToBeOpen ~= true then
			
		-- Reinit NPC
		CreateNPCGate2()
	
	else
	
		end2ndSubChapter()
	
	end

end
