- Home /
How to make horror nps with audisource? (plzs cript)
Hello, I am creating my horror project in Batim style, and I need an NPS script. To detect invisibility, it walked with animation (walk) around the territory. When the player comes into sight, the NPS starts running after the player with the animation (Run) and when nps you need the audio source to play. When nps runs up, it should play to move to the beginning of the level or scene. I know that there are many things, but I will be glad to help
I am from Russia, sorry for my English)))
no worries about your english but... this forum is for questions, discussions and help. I know that "help" can be a broad term but it does not mean that people will write your game for you. Show that you at least tried to do something on your own please. Otherwise how could you say at the end that it is your game? i don't want to be rude or discouraging here. I just think that you will get the most out of it by doing stuff yourself. Providing something like a script that you yourself tried to write will also result in more and better results regarding the help that you receive.
ok, I understand,I am a beginner, this can be problematic for me)))) (sorry)
here is the script
using UnityEngine; using System.Collections; public class AI$$anonymous$$onsteR : $$anonymous$$onoBehaviour {
public float seeDistance = 5f;
public float attackDistance =2f;
public float speed;
private Transform target;
// Use this for initialization
void Start () {
target = GameObject.FindWithTag ("Player").transform;
}
// Update is called once per frame
void Update () {
if (Vector3.Distance (transform.position, target.transform.position) < seeDistance) {
if (Vector3.Distance (transform.position, target.transform.position) > attackDistance) {
transform.LookAt (target.transform);
transform.Translate (new Vector3 (0, 0, speed * Time.deltaTime));
}
} else {
}
}
}