function OnWarpEnter()
	PlaySound("Sounds/SFX/A_TempleU.ogg",-1)	
--	TUYA_IN_NAOS = true
	if not TUYA_IN_NAOS then	
		SetMarker("Pi Ramses\\Temple U\\Warp_0035.wp",0,0)
		SetMarker("Pi Ramses\\Temple U\\Warp_0039.wp",0,0)
	end
	CanHitTuya = false
	FOUND_TUYA = true
	if TUYA_IN_NAOS then
		HideMayaHealth()
		HideTuyaHealth()
		LookAt(096,010)
		StartAnimationPart("TOU1",0,60,1,true)
	end
end

function OnMovieFinished(movieId)
	ChangeWarp("3D\\Pi Ramses\\Temple U\\Warp_0039.wp")
end

function OnDialogFinished(dialogName)
	if dialogName=="TOUY1414" then
		DrawText("TOUY1431","TOUY1431.ogg")
		StartAnimationPart("TOU1",380,420,-1,true)
		CanHitTuya = true
		InitHealths()
		ShowMayaHealth()
		ShowTuyaHealth()
	elseif dialogName=="TOUY1431" then
		StartAnimationPart("TOU1",60,80,-1,true)
		SetMarker("TOU1",4,0)
		tuyaSpell = "comeDeath"
		ReduceMayaHealth(10 )
	elseif dialogName=="TOUY1420" then
		DrawText("TOUY1425","TOUY1425.ogg")
		StartAnimationPart("TOU1",320,370,-1,true)
		tuyaSpell = "ashesSpell"
	elseif dialogName=="TOUY1421" then
		DrawText("TOUY1427","TOUY1427.ogg")
		StartAnimationPart("TOU1",0,30,-1,true)
		tuyaSpell = "reSpell"
	elseif dialogName=="TOUY1422" then
		DrawText("TOUY1429","TOUY1429.ogg")
		StartAnimationPart("TOU1",420,500,-1,true)
		tuyaSpell = "stoneSpell"
	elseif dialogName=="TOUY1423" then
		DrawText("TOUY1433","TOUY1433.ogg")
		StartAnimationPart("TOU1",510,540,-1,true)
		tuyaSpell = "shadowSpell"
	elseif dialogName=="TOUY1424" then
		DrawText("TOUY1435","TOUY1435.ogg")
		StartAnimationPart("TOU1",540,600,-1,true)
		tuyaSpell = "bindSpell"
	elseif dialogName=="MAIA1432" or dialogName=="MAIA1426" or dialogName=="MAIA1428" or dialogName=="MAIA1434" or dialogName=="MAIA1436" or dialogName=="MAIA1430" then
		StartAnimationPart("TOU1",180,200,1,true)
		ReduceTuyaHealth(14)
	elseif dialogName=="TOUY1415" or dialogName=="TOUY1416" or dialogName=="TOUY1417" or dialogName=="TOUY1418" or dialogName=="TOUY1419"  then
		StartAnimationPart("TOU1",60,80,-1,true)
		SetMarker("TOU1",4,0)
	elseif dialogName=="TOUY1425" or dialogName=="TOUY1427" or dialogName=="TOUY1429" or dialogName=="TOUY1433" or dialogName=="TOUY1435"  then
		StartAnimationPart("TOU1",60,80,-1,true)
		SetMarker("TOU1",4,0)
		ReduceMayaHealth(10)
		if not IsMayaAlive()  then
			HideMayaHealth()
			HideTuyaHealth()
			PlayMovie("Videos/GC_C32_Montage.ogv", "Videos/cine32.ogg")
			--ChangeWarp("3D\\Pi Ramses\\Temple U\\Warp_0039.wp")
		end
	elseif dialogName=="MAIA1438" then
		HideMayaHealth()
		HideTuyaHealth()
		StartAnimationPart("TOU1",610,660,1,true)
	end
	if dialogName=="TOUY1415" or dialogName=="TOUY1416" or dialogName=="TOUY1417" or dialogName=="TOUY1418" or dialogName=="TOUY1419" then
		if not IsMayaAlive()  then
			HideMayaHealth()
			HideTuyaHealth()
			PlayMovie("Videos/GC_C32_Montage.ogv", "Videos/cine32.ogg")
		end
	end
end

function OnAnimationFinished(objectName)
	if objectName=="TOU1" then
		if FOUND_TUYA then
			FOUND_TUYA = false
			DrawText("TOUY1414","TOUY1414.ogg")
			StartAnimationPart("TOU1",110,120,-1,true)
		elseif tuyaSpell=="comeDeath" or tuyaSpell=="ashesSpell" or tuyaSpell=="reSpell" or tuyaSpell=="stoneSpell" or tuyaSpell=="shadowSpell" or tuyaSpell=="bindSpell"then
			SetMarker("TOU1",-1,0)
			StartAnimationPart("TOU1",110,120,-1,true)
		elseif tuyaSpell=="comeDeathHit" then
			DrawText("TOUY1420","TOUY1420.ogg")
			
			StartAnimationPart("TOU1",20,100,-1,true)
		elseif tuyaSpell=="ashesSpellHit" then
			DrawText("TOUY1421","TOUY1421.ogg")
			SetMarker("TOU1",-1,0)
			
			StartAnimationPart("TOU1",20,100,-1,true)
		elseif tuyaSpell=="reSpellHit" then
			DrawText("TOUY1422","TOUY1422.ogg")
			SetMarker("TOU1",-1,0)
			
			StartAnimationPart("TOU1",20,100,-1,true)
		elseif tuyaSpell=="stoneSpellHit" then
			DrawText("TOUY1423","TOUY1423.ogg")
			SetMarker("TOU1",-1,0)
			StartAnimationPart("TOU1",20,100,-1,true)
		elseif tuyaSpell=="shadowSpellHit" then
			DrawText("TOUY1424","TOUY1424.ogg")
			SetMarker("TOU1",-1,0)
			StartAnimationPart("TOU1",20,100,-1,true)
		elseif tuyaSpell=="bindSpellHit" then
			HideMayaHealth()
			HideTuyaHealth()
			RemoveObject("TOU1")
			StartAnimation("SSU1",1)
			tuyaSpell="snake0"
			TUYA_BECAME_SNAKE = true
		end
	end
	if objectName=="SSU1" then
		DrawText("MAIA1473","MAIA1473.ogg")
		DrawText("MAIA1472","MAIA1472.ogg")	
		TUYA_IN_NAOS = false
		SetMarker("Pi Ramses\\Temple U\\Warp_0035.wp",0,0)
		SetMarker("Pi Ramses\\Temple U\\Warp_0039.wp",0,0)
	end
	
end

function OnWarpLeave()
end

function OnWarpObjectHit(objectName)
	if objectName == "TOU1" and CanHitTuya then
			SetMarker("TOU1",-1,0)
			if tuyaSpell=="comeDeath" then
				if Selected("J_cobra") then
					tuyaSpell="comeDeathHit"
					
					DrawText("MAIA1432","MAIA1432.ogg") 
				elseif ObjectInHand() then
					DrawText("TOUY1415","TOUY1415.ogg") 
					StartAnimationPart("TOU1",110,125,-1,true)
					ReduceMayaHealth(10)
				else
					DrawText("TOUY1416","TOUY1416.ogg")
					StartAnimationPart("TOU1",110,125,-1,true)
					ReduceMayaHealth(10)
				end
			elseif tuyaSpell=="ashesSpell" then
				if Selected("Pluie") then
					tuyaSpell="ashesSpellHit"
					
					DrawText("MAIA1426","MAIA1426.ogg") 
				elseif ObjectInHand() then
					DrawText("TOUY1419","TOUY1419.ogg")
					StartAnimationPart("TOU1",110,125,-1,true)
					ReduceMayaHealth(10)
				else
					DrawText("TOUY1418","TOUY1418.ogg")
					StartAnimationPart("TOU1",110,125,-1,true)
					ReduceMayaHealth(10)
				end
			elseif tuyaSpell=="reSpell" then
				if Selected("J_Oeil") then
					tuyaSpell="reSpellHit"
					DrawText("MAIA1428","MAIA1428.ogg") 
				elseif ObjectInHand() then
					DrawText("TOUY1417","TOUY1417.ogg")
					StartAnimationPart("TOU1",110,125,-1,true)
					ReduceMayaHealth(10)
				else
					DrawText("TOUY1415","TOUY1415.ogg")
					StartAnimationPart("TOU1",110,125,-1,true)
					ReduceMayaHealth(10)
				end
			elseif tuyaSpell=="shadowSpell" then
				if Selected("J_filet") then
					tuyaSpell="shadowSpellHit"
					DrawText("MAIA1434","MAIA1434.ogg") 
				elseif ObjectInHand() then
					DrawText("TOUY1415","TOUY1415.ogg")
					StartAnimationPart("TOU1",110,125,-1,true)
					ReduceMayaHealth(10)
				else
					DrawText("TOUY1419","TOUY1419.ogg")
					StartAnimationPart("TOU1",110,125,-1,true)
					ReduceMayaHealth(10)
				end
			elseif tuyaSpell=="bindSpell" then
				if Selected("J_oriflamme") then
					tuyaSpell="bindSpellHit"
					DrawText("MAIA1436","MAIA1436.ogg") 
				elseif ObjectInHand() then
					DrawText("TOUY1417","TOUY1417.ogg")
					StartAnimationPart("TOU1",110,125,-1,true)
					ReduceMayaHealth(10)
				else
					DrawText("TOUY1416","TOUY1416.ogg")
					StartAnimationPart("TOU1",110,125,-1,true)
					ReduceMayaHealth(10)
				end
			elseif tuyaSpell=="stoneSpell" then			
				if Selected("Vase_purification") then
					tuyaSpell="stoneSpellHit"
					DrawText("MAIA1430","MAIA1430.ogg") 
				elseif ObjectInHand() then
					DrawText("TOUY1419","TOUY1419.ogg")
					StartAnimationPart("TOU1",110,125,-1,true)
					ReduceMayaHealth(10)
				else
					DrawText("TOUY1415","TOUY1415.ogg")
					StartAnimationPart("TOU1",110,125,-1,true)
					ReduceMayaHealth(10)
				end
			end
------------------------------------------------------------
	elseif objectName == "CMT1" then

------------------------------------------------------------
	elseif objectName == "LJT1" then
	end
	if objectName=="3D\\Pi Ramses\\Temple U\\Warp_0039.wp" then
		if not TUYA_IN_NAOS then
			ChangeWarp(objectName)
		end
        end
	if objectName=="3D\\Pi Ramses\\Temple U\\Warp_0035.wp" then
		if not TUYA_IN_NAOS then
			ChangeWarp(objectName)
		end
       end
end
