The game I'm making needs a Monster like slender man, in the sense that he will stalk/ teleport to the player. is there a script for this? thanks in advance!
This is a give me a script post. Just a warning - probably best to not post threads like this. People aren't fans of give me script posts. We don't work for free, right? Try learning some scripting then try and write the script yourself. When you find problems, ask about them here. To get you started, how are your characters and enemies moving? Are you using Unitys navigation system or moving them with your own pathfinding?
Well, to be fair, he didn't say "give me a script"... he said "is there a script" (presumably meaning, something publicly available that he can just download and use). In which case, the simple answer is: no, there probably is not.
just an FYI m8, I already know python programming, but the fact unity doesn't use this is why i asked, i wasn't asking for a give me, just to see of someone had tips
Ah OK My misunderstanding. Didnt mean to come over as rude, but there are a lot of give me scripts posts on this forum. Anyways, as for advice - It depends on how you are moving the bady guy - if you are using the Navigation stuff built into unity it will be very simple to follow the player - as the path finding is handled for you. Are you doing it in 3d?
If your going to be rude Korno, better not post at all.. .. Legosdoctor asking a pretty straightforward question.
Lego: Unity uses transform like many other programming language. For teleport you use : ThisLocation.transform.position = new Vector3(xvalue,yvalue,zvalue); TargetLocation.transform.position = new Vector3(xvalue,yvalue,zvalue); Then ThisLocation.transfrom.position = TargetLocation.transform.position; Let me know if you need deeper explanation on this, i be happy to help for free for so little..
Yes there are... http://docs.unity3d.com/ScriptReference/Transform-position.html you also find allot under http://unity3d.com/learn/tutorials/topics/scripting
@Ironmax, I dig that you're trying to help — I am too, but I really don't think that pointing out Transform.position explains how to make a stalker-style AI. He's asking for a car, and you're showing him where to find some tools and parts bins... things he will eventually need to build his own car, yes, but they're not a car. But anyway, I think we're all on the same page here: there is no ready-to-go "stalker enemy AI" script you can just drop in and use, but you can write it yourself, and the tutorials Ironmax pointed out are a great place to start. On the grand scale of things, it's not even very hard, so just dive in, do some tutorials, try to write your own AI, and if you get stuck, post back with some specific questions and we'll try to help!
Again, really easy script demand. Does anyone needs some difficult script? Well basically slender is just a model looking at player and finding a suitable place to teleport.. so basically it goes something like this : Code (CSharp): //Script written by Pratyush Priyadarshi. //Simple script to teleport Slender. This script is made to be used in an open and plain area like a forest. //Don't use this script if working with irregular terrain as slender may spawn between terrains. using UnityEngine; using System.Collections; using UnityEngine.SceneManagement; using UnityEngine.AI; public class MoveSlender: MonoBehaviour { [Header("Player Settings")] GameObject Player; // gameobject player Transform player; // the Object the player is controlling [Header("Enemy Location Settings")] public GameObject Cube; // gameobject cube Transform cube; // the cube transform Vector3 spawnOrgin; // this will be the transform of the cube Vector3 maximum; // max distance in the x, y, and z direction the enemy can spawn [Header("Enemy Calculations Settings")] public float spawnRate = 80.0f; // how often the enemy will respawn float distanceToPlayer = 12.5f; // how close the enemy has to be to the player to play music public float facePlayerfactor = 20f; // angle of facing player [Header("Booleans")] private bool nearPlayer = false; // use this to stop the teleporting if near the player private float nextTeleport = 10.0f; // will keep track of when we to teleport next void Start() { Player = GameObject.FindWithTag("Player"); // find the gameobject with the tag of Player. player = Player.GetComponent<Transform>(); // from the gameobject of player get the transform cube = Cube.GetComponent<Transform>(); // get the transform from the gameobject Cube nextTeleport = spawnRate; } void Update() { bool inView = Vector3.Dot(Vector3.forward, player.InverseTransformPoint(transform.position)) > 0; // player is in view maximum.Set(5, 3.31f, 5f); // max distance in the x, y, and z direction the enemy can spawn is 5, 3.31, 5 spawnOrgin.Set(cube.position.x, 3.31f, cube.position.z); // slender's spawn origin FacePlayer(); // face player no matter what if (!(nearPlayer || inView)) // only teleport if we are not close to the player and not in it's view { if (Time.time > nextTeleport) // only teleport if enough time has passed { transform.position = new Vector3 (Random.Range(spawnOrgin.x, maximum.x), Random.Range(spawnOrgin.y, maximum.y), Random.Range(spawnOrgin.z, maximum.z)); // teleport nextTeleport += spawnRate; // update the next time to teleport } } // The breathing sfx if (Vector3.Distance(transform.position, player.position) <= distanceToPlayer) // if near player { if (GetComponent<AudioSource>() && GetComponent<AudioSource>().clip && !GetComponent<AudioSource>().isPlaying && inView) // play the audio if it isn't playing and slender is in view { GetComponent<AudioSource>().Play(); nearPlayer = true; } } else { if (GetComponent<AudioSource>()) // stop the audio if it is playing and slender isn't in view { GetComponent<AudioSource>().Stop(); nearPlayer = false; } } } // The function to make slender face player void FacePlayer() { Vector3 direction = (player.position - transform.position).normalized; Quaternion lookRotation = Quaternion.LookRotation(new Vector3(direction.x, 0, direction.z)); transform.rotation = Quaternion.Slerp(transform.rotation, lookRotation, Time.deltaTime * facePlayerfactor); } } I hope this helps! I know.. this won't work with irregular terrain.. but you can edit it I have just put a slender kit on itch.io check it out.. it's called Advanced Slender Kit