/***Soldat à l'intérieur du château d'Hyrule, tournant autour des "statues"***/

var chemin;var vue;var soundPlay;var time;var compte;
var VISARR = 2;
var VISDEV = 10;
var VISGAU = 4;
var VISDRO = 4;
var pent = soldat5.getPosition();

if(chemin == undefined)
	chemin = 1;
if(vue == undefined)
	vue = 0;
if(soundPlay == undefined)
	soundPlay = 1;
if(time == undefined)
	time = 0;
if(compte == undefined)
	compte = 0;
	
switch(chemin)
{
	case 4 :
		vue=cheminEst(soldat5,VISARR,VISDEV,VISGAU,VISDRO);		
		break;
	case 1 :
		vue=cheminSud(soldat5,VISARR,VISDEV,VISGAU,VISDRO);		
		break;
	case 2 :
		vue=cheminOuest(soldat5,VISARR,VISDEV,VISGAU,VISDRO);		
		break;
	case 3 :
		vue=cheminNord(soldat5,VISARR,VISDEV,VISGAU,VISDRO);		
		break;
}


if(vue==1 && soldatDetection == false)
{	
	soldatDetection = soldatDetectionON(soldatDetection);
	if(soundPlay == 1)
	{
		chat.print("Guard: You have nothing to do here, get out !");
		sound.playSound3D("sound.whistle",pent.x,pent.y,pent.z);
		soundPlay = 0; compte = 1;
		player.setStunned(3000);
		soldat5.clearPath();
		wait();
		soldat5.pathToEntity(player);		
	}
	soldat5.setTrackPlayer(true);	
	
}

if(compte == 1) {
	time++;
}
if(time == 50)
{
	time = 0; compte = 0;
	overlay();		
	player.setStunned(0);
	soundPlay = 1; vue = 0; time = 0; chemin = 0; compte = 0;
	soldat5.setPosition(241.5,51,-621.5);
	script.runScript("soldat5path.js");
	soldat5.setTrackPlayer(false);
	soldatDetection = soldatDetectionOFF(soldatDetection);
}