Making AI talk/say speech

Hey fellas,
I’m making an exploring game based on my book, “Europa”, and the first area is a village which is a little creepy and mysterious. I’ve set out a plain terrain with some visual effects, lighting, atmosphere, also put some people who are in the village (Not the real models, had to compensate with skeletons).

ImageShack - Best place for all of your image hosting and image sharing needs

ImageShack - Best place for all of your image hosting and image sharing needs

ImageShack - Best place for all of your image hosting and image sharing needs

The problem I face now is I want them to interact with me. If you looked at the images it says “Press e to interact”. I’ve made a script so whenever I press E near an Object that has a Mesh Renderer I can interact with it. I want it that so whenever I press E it will say something in a text above him or next to him and the text will fade away either in 5 seconds or whenever I move away from him.

using UnityEngine;

using System.Collections;

public class Interact : MonoBehaviour {
public GUIText target;
private bool Selected = false;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
	
	renderer.material.color = Color.white;
	Selected = false;

}

public void OnLookEnter(){
	renderer.material.color = Color.red;
	target.text = "Press E to interact";

}
void OnGUI(){
  Event e = Event.current;
  if(e.isKey && e.character == 'e' && Selected){
		
	}   
}

}

This is the script I am using, I’m just stumped after there.
I’m a few weeks new into Unity and am still getting use to the ropes, is there anyone who can add to the script to help me out? Or are there any sites that can help me do this kind of stuff.

Thank you in advance

Matsudaria, Matty

So here are the steps you’ll need to follow :

  • Learn how to display 2D on the
    screen, GUI (here)
  • Find the
    right position of the text. Look
    those functions (here)
  • You
    should capture the keyboard inside
    Update (once per frame) instead of
    OnGUI (twice) with Input.
  • Toggle
    a boolean, Instantiate a self
    destruct object, start a coroutine,
    there is plenty of ways to display
    for certain time. As for the fading,
    change the alpha channel of
    GUI.color.