function OnWarpEnter()
	PlaySound("Sounds/SFX/A_Wind2.ogg",-1)
	SetMarker("Memphis\\Warp_0003.wp",0,0)
	
	AnimationSetToEnd("d2s1",false)
	AnimationSetToEnd("d3s1",false)
	AnimationSetToEnd("d7s1",false)
	AnimationSetToEnd("d6s1",false)
	AnimationSetToStart("bas1", false)

	

	if FinishCH6_me and not resetVbles_me then
		resetVbles_me=true
		GuardHipnotized_me_004=false
		SemiHip_me_004=false
		KnowName_me_004=true
	end

	if FinishCH6_me then
		AnimationSetToEnd("KHS1", false)
	elseif WentOf_me_3 then

	elseif Puzzle_me_009 and  PerfumeGiven_me_009 and  O_frag_me_017 then
		StartAnimation("KHS1",-1)
	end


	if not GuardHipnotized_me_004 and not FinishCH5_as then
		if SemiHip_me_004 then
			StartAnimationPart("gas1",139,180,-1,true)
			SetMarker("gas1",4,0)
		else
			StartAnimationPart("gas1",0,30,-1,true)
			SetMarker("gas1",4,0)
		end
	elseif not GuardHipnotized_me_004 and FinishCH6_me then
		if SemiHip_me_004 then
			StartAnimationPart("gas1",139,180,-1,true)
			SetMarker("gas1",4,0)
		else
			StartAnimationPart("gas1",0,90,-1,true)
			SetMarker("gas1",4,0)
		end
	
	elseif FinishCH6_me then
		StartAnimationPart("gas1",340,370,-1,true)
	--	SetMarker("gas1",4,0)
		SetMarker("Memphis\\Warp_0007.wp",0,0)

	elseif FinishCH5_as then
		StartAnimationPart("gas1",0,90,-1,true)
		SetMarker("gas1",4,0)
	else
		StartAnimationPart("gas1",340,370,-1,true)
	--	SetMarker("gas1",4,0)
		SetMarker("Memphis\\Warp_0007.wp",0,0)
	end
	


end

function OnWarpLeave()
end

function OnDialogFinished(dialogName)
	if not SemiHip_me_004 then
		if dialogName=="MAIA0928" or dialogName=="MAIA0466" or dialogName=="MAIA0468" or dialogName=="" or dialogName=="MAIA0495" or dialogName=="" then
			StartAnimationPart("gas1",30,60,-1,true)
		elseif dialogName=="MAIA0799"  then
		
		else
			StartAnimationPart("gas1",0,30,-1,true)
		end
	end
	if dialogName=="MAIA0471" or dialogName=="GARD1047" then
		StartAnimationPart("gas1",0,30,-1,true)
		SetMarker("gas1",4,0)
	end
	if dialogName=="GARD0496" then
			
	end

	
	
	
	if dialogName=="GARD0929" and  not KnowName_me_004 and not SemiHip_me_004 then
		StartAnimationPart("gas1",0,30,-1,true)
		
	elseif dialogName=="GARD0929"  then
		SetMarker("gas1",4,0)
	end
end

function OnAnimationFinished(objectName)
	
	if objectName=="gas1" and not GuardHipnotized_me_004 then
		StartAnimationPart("gas1",139,180,-1,true)
	elseif objectName=="gas1" and SemiHip_me_004 then
		StartAnimationPart("gas1",340,370,-1,true)
		SetMarker("Memphis\\Warp_0007.wp",0,0)
		
	
	end
	
end

function OnWarpObjectHit(objectName)
	if objectName == "kes1" then

------------------------------------------------------------
	elseif objectName == "bfs1" then

------------------------------------------------------------
	elseif objectName == "d2s1" then

------------------------------------------------------------
	elseif objectName == "d3s1" then

------------------------------------------------------------
	elseif objectName == "d6s1" then

------------------------------------------------------------
	elseif objectName == "d7s1" then

------------------------------------------------------------
	elseif objectName == "gas1" then
	
	if  not FinishCH5_as then

		if not TalkedPamose_me_004 then
			LookAt(090,003)
			SetMarker("gas1",-1,0)
			DrawText("MAIA0928","MAIA0928.ogg")
			DrawText("GARD0929","GARD0929.ogg")
			DrawText("MAIA0466","MAIA0466.ogg")
			DrawText("GARD0464","GARD0464.ogg")
			DrawText("MAIA0468","MAIA0468.ogg")
			DrawText("GARD0464","GARD0464.ogg")
			DrawText("MAIA0471","MAIA0471.ogg")		
			TalkedPamose_me_004=true
		elseif Selected("J_cobra") and KnowName_me_004 and not SemiHip_me_004 then
			SemiHip_me_004=true
			SetMarker("gas1",-1,0)
			LookAt(090,003)
			StartAnimationPart("gas1",110,180,1,true)
			DrawText("MAIA0799","MAIA0799.ogg")
			DrawText("GARD0929","GARD0929.ogg")
			
		elseif ObjectInHand() and KnowName_me_004 and SemiHip_me_004 and not GuardHipnotized_me_004 then
			GuardHipnotized_me_004=true
			LookAt(090,003)
			SetMarker("gas1",-1,0)
			StartAnimationPart("gas1",210,340,1,true)
			DrawText("MAIA0495","MAIA0495.ogg")
			DrawText("GARD0496","GARD0496.ogg")
		
		
		elseif KnowName_me_004 and not GuardHipnotized_me_004 then
			SetMarker("gas1",-1,0)
			LookAt(090,003)
			StartAnimationPart("gas1",30,60,-1,true)
			DrawText("GARD0464","GARD0464.ogg")
                elseif not GuardHipnotized_me_004 then
			SetMarker("gas1",-1,0)
			LookAt(090,003)
			StartAnimationPart("gas1",30,60,-1,true)
			DrawText("GARD0464","GARD0464.ogg")
			DrawText("MAIA0471","MAIA0471.ogg")		
		end
		
	elseif Selected("J_cobra") and KnowName_me_004 and not SemiHip_me_004 then
		SemiHip_me_004=true
		SetMarker("gas1",-1,0)
		LookAt(090,003)
		StartAnimationPart("gas1",110,180,1,true)
		DrawText("MAIA0799","MAIA0799.ogg")
		DrawText("GARD0929","GARD0929.ogg")
		
	elseif ObjectInHand() and KnowName_me_004 and SemiHip_me_004 and not GuardHipnotized_me_004 then
		LookAt(090,003)
		SetMarker("gas1",-1,0)
		StartAnimationPart("gas1",170,340,1,true)
		DrawText("MAIA0495","MAIA0495.ogg")
		DrawText("GARD0496","GARD0496.ogg")
		GuardHipnotized_me_004=true
	elseif FinishCH6_me and not GuardHipnotized_me_004 then
		LookAt(090,003)
		DrawText("GARD0464","GARD0464.ogg")

	elseif FinishCH5_as and not TalkedPamCH6_me and not GuardHipnotized_me_004 then
		TalkedPamCH6_me=true
		SetMarker(objectName,-1,0)
		DrawText("MAIA0467","MAIA0467.ogg")
		DrawText("GARD1045","GARD1045.ogg")
		DrawText("MAIA1046","MAIA1046.ogg")
		DrawText("GARD1047","GARD1047.ogg")
	elseif FinishCH5_as and TalkedPamCH6_me and not GuardHipnotized_me_004 then
		SetMarker(objectName,-1,0)
		DrawText("MAIA1046","MAIA1046.ogg")
		DrawText("GARD1047","GARD1047.ogg")
	end

	elseif  objectName=="3D\\Memphis\\Warp_0003.wp"or objectName=="3D\\Memphis\\Warp_0007.wp"   then
		if objectName=="3D\\Memphis\\Warp_0007.wp" then
			if GuardHipnotized_me_004 then
				ChangeWarp(objectName)
			end	
		else
			ChangeWarp(objectName)
		end
	end
end
