public void talk()
	{
		boolean test=false;
		int theTrainer=0;

		for(int i=0; i<numTrainers; i++)
		{
			if(trainer[i] != null && direction==180&&trainer[i].location.x==location.x-1&&trainer[i].location.y==location.y)
			{
				test=true;
				theTrainer=i;
				break;
			}
			else if(trainer[i] != null &&direction==0&&trainer[i].location.x==location.x+1&&trainer[i].location.y==location.y)
			{
				test=true;
				theTrainer=i;
				break;
			}
			else if(trainer[i] != null &&direction==270&&trainer[i].location.y==location.y+1&&trainer[i].location.x==location.x)
			{
				test=true;
				theTrainer=i;
				break;
			}
			else if(trainer[i] != null &&direction==90&&trainer[i].location.y==location.y-1&&trainer[i].location.x==location.x)
			{
				test=true;
				theTrainer=i;
				break;
			}
		}

		if(!test)
			return;

		if(!trainer[theTrainer].hostile)
		{
			trainer[theTrainer].direction=(direction+180)%360;
			repaint();

			messageBox=new ErrorWindow();

			if(!trainer[theTrainer].important&&!Mechanics.isSpecialTrainer(trainer[theTrainer]))
			messageBox.addMessage(trainer[theTrainer].getPostMessage(),trainer[theTrainer].getNameAndType());
			else
			messageBox.addLargeMessage(trainer[theTrainer].getPostMessage(),trainer[theTrainer].getNameAndType());

			messageBox.repaint();
			while(messageBox.isVisible())
			{
				try
				{
					repaint();
					Thread.sleep(10);
				}
				catch(Exception ignored){}
			}

			gameEventHandler(trainer[theTrainer]);

			jf.toFront();
		}
		else
		{
			trainer[theTrainer].direction=(direction+180)%360;
			trainer[theTrainer].setViewRange(1);
		}

		performingAction=false;
	}