cheminEst = function(entity,VISARR,VISDEV,VISGAU,VISDRO)
{
	var vue;
	var pent = entity.getPosition();
	var pos = player.getPosition();
	var results = entity.rayTrace(pent,pos);
	var blockCoords = results[1];
	
	if((pos.x >=  pent.x-VISARR && pos.x < pent.x+VISDEV) && (pos.z > pent.z-VISGAU && pos.z < pent.z+VISDRO) && (pos.y <= pent.y+3))
	{
		if(blockCoords == null) {
			vue=1;
		}
	}
	return(vue);
}

cheminSud = function(entity,VISARR,VISDEV,VISGAU,VISDRO)
{
	var vue;
	var pent = entity.getPosition();
	var pos = player.getPosition();
	var results = entity.rayTrace(pent,pos);
	var blockCoords = results[1];
	
	if((pos.x >=  pent.x-VISGAU && pos.x < pent.x+VISDRO) && (pos.z > pent.z-VISDEV && pos.z < pent.z+VISARR) && (pos.y <= pent.y+3))
	{
		if(blockCoords == null) {
			vue=1;
		}
	}
	return(vue);
}


cheminOuest = function(entity,VISARR,VISDEV,VISGAU,VISDRO)
{
	var vue;
	var pent = entity.getPosition();
	var pos = player.getPosition();
	var results = entity.rayTrace(pent,pos);
	var blockCoords = results[1];
	
	if((pos.x >=  pent.x-VISDEV && pos.x < pent.x+VISARR) && (pos.z > pent.z-VISDRO && pos.z < pent.z+VISGAU) && (pos.y <= pent.y+3))
	{
		if(blockCoords == null) {
			vue=1;
		}
	}
	return(vue);
}


cheminNord = function(entity,VISARR,VISDEV,VISGAU,VISDRO)
{
	var vue;
	var pent = entity.getPosition();
	var pos = player.getPosition();
	var results = entity.rayTrace(pent,pos);
	var blockCoords = results[1];
	
	if((pos.x >=  pent.x-VISDRO && pos.x < pent.x+VISGAU) && (pos.z > pent.z-VISARR && pos.z < pent.z+VISDEV) && (pos.y <= pent.y+3))
	{
		if(blockCoords == null) {
			vue=1;
		}
	}
	return(vue);
}

overlay = function()
{
	time.sleep(0.05)
	effect.setOverlay("/00677.png")
	time.sleep(0.05)
	effect.setOverlay("/00676.png")
	time.sleep(0.05)
	effect.setOverlay("/00675.png")
	time.sleep(0.05)
	effect.setOverlay("/00674.png")
	time.sleep(0.05)
	effect.setOverlay("/00673.png")
	time.sleep(0.05)
	effect.setOverlay("/00672.png")
	time.sleep(0.05)
	effect.setOverlay("/00671.png")
	time.sleep(0.05)
	effect.setOverlay("/00670.png")
	time.sleep(0.05)
	effect.setOverlay("/00669.png")
	time.sleep(0.05)
	effect.setOverlay("/00668.png")
	time.sleep(0.05)
	effect.setOverlay("/00667.png")
	time.sleep(0.05)
	effect.setOverlay("/00666.png")
	time.sleep(0.05)
	effect.setOverlay("/00665.png")
	time.sleep(0.05)
	effect.setOverlay("/00664.png")
	time.sleep(0.05)
	effect.setOverlay("/00663.png")
	time.sleep(0.05)
	effect.setOverlay("/00662.png")
	time.sleep(0.05)
	effect.setOverlay("/00661.png")
	time.sleep(0.05)
	effect.setOverlay("/00660.png")
	time.sleep(0.05)
	effect.setOverlay("/00659.png")
	time.sleep(0.05)
	effect.setOverlay("/00658.png")
	time.sleep(0.05)
	effect.setOverlay("/00657.png")
	player.setPosition(343,52,-643);
	sound.stopMusic();
	time.sleep(1)
	sound.playMusic("music.plainehyrule");
	effect.setOverlay("/00658.png")
	time.sleep(0.05)
	effect.setOverlay("/00659.png")
	time.sleep(0.05)
	effect.setOverlay("/00660.png")
	time.sleep(0.05)
	effect.setOverlay("/00661.png")
	time.sleep(0.05)
	effect.setOverlay("/00662.png")
	time.sleep(0.05)
	effect.setOverlay("/00663.png")
	time.sleep(0.05)
	effect.setOverlay("/00664.png")
	time.sleep(0.05)
	effect.setOverlay("/00665.png")
	time.sleep(0.05)
	effect.setOverlay("/00666.png")
	time.sleep(0.05)
	effect.setOverlay("/00667.png")
	time.sleep(0.05)
	effect.setOverlay("/00668.png")
	time.sleep(0.05)
	effect.setOverlay("/00669.png")
	time.sleep(0.05)
	effect.setOverlay("/00670.png")
	time.sleep(0.05)
	effect.setOverlay("/00671.png")
	time.sleep(0.05)
	effect.setOverlay("/00672.png")
	time.sleep(0.05)
	effect.setOverlay("/00673.png")
	time.sleep(0.05)
	effect.setOverlay("/00674.png")
	time.sleep(0.05)
	effect.setOverlay("/00675.png")
	time.sleep(0.05)
	effect.setOverlay("/00676.png")
	time.sleep(0.05)
	effect.setOverlay("/00677.png")
	time.sleep(0.05)
	effect.clearOverlay();
}

wait = function()
{
	time.sleep(0.1);
}

soldatDetectionON = function(soldatDetection)
{	
	soldatDetection = true;
	return(soldatDetection);
}
soldatDetectionOFF = function(soldatDetection)
{	
	soldatDetection = false;
	return(soldatDetection);
}