Help!!!
This script was supposed to assign a specific distance when clicking an npc to start a connversation.
If “dist” is less than “fixdist”, the character can click to the npc.
This code works fine in my other event, I copy pasted it from there.
Here is the code:
private var trgtObjct : Transform;
function Start(){
trgtObjct = GameObject.FindGameObjectWithTag("Player").transform;
}
function npcTalk(){
var fixdist = 100.3872;
if (trgtObjct!= null)
{
var dist : float = Vector3.Distance(trgtObjct.position, this.transform.position);
if (dist <= fixdist)
{
OnMouseDown();
}
else
print("Lumapit ka");
}
sorry for the bad english.