- Home /
Only In Range
First of all, I'm using javascript so please try posting only javascript. I'm creating a quest script for my rpg game and have a great quest script but I would like it if you could only see it in a certain range or area. I have many variables in this script so just realize that I have no errors at the moment:
function OnGUI () {
GUI.contentColor = Color.red;
GUI.Box(Rect(10,10,500,420), questTitle);
GUI.Label(Rect(15,30,500,420), questText);
GUI.Label(Rect(11,410,100,50), npcName);
GUI.Box(Rect(15,100,490,100), "Reward");
GUI.Label(Rect(20,120,490,100), reward);
GUI.contentColor = Color.red;
if (GUI.Button(Rect(400,450,100,30), "Accept")){
questItem.active = true;
if(autoAccept == false){
autoAccept = true;
}
else{
autoAccept = false;
}
}
if(autoAccept == true){
GUI.Box(Rect(540,10,150,50), questItems);
GUI.Label(Rect(590,30,100,30), "" + points + "/" + questItemsNeeded);
if (GUI.Button(Rect(300,450,100,30), "Decline")){
questItem.active = false;
autoAccept = false;
}
}
}
Thanks!
Answer by Razacx · Oct 16, 2012 at 01:05 AM
Your question isn't very clear. Do you want to see the quests you have only within a certain area?
Then I suggest you take a look at triggers:
http://docs.unity3d.com/Documentation/Components/class-BoxCollider.html
(scroll down on the page, there is a section about triggers).
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Attach object as child using code 1 Answer
Cursor Lock to Center of screen script doesnt work please help. 2 Answers
Need Help Understanding Script! (Javascript) 1 Answer
Space Invaders movement? 1 Answer