How do I make a zone gate?
In other words, I want to have a location in Scene 1 that players can move into to open up and move them to Scene 2, as in the normal MMORPG Zoning ala LOTRO or Everquest etc.
How do I do this?
How do I make a zone gate?
In other words, I want to have a location in Scene 1 that players can move into to open up and move them to Scene 2, as in the normal MMORPG Zoning ala LOTRO or Everquest etc.
How do I do this?
Just an object with a collider - and when there is collision with your player run Application.LoadLevel(“Scene2”);
Is that a script thing? How does that write out in script?
Very very new to all this.
OnTriggerEnter or OnTriggerStay
http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=OnTrigger
Here’s another example using distance from the “gate” instead of collision.
var Target:Transform; //this is the "gate" you'll be entering. set it in the inspector
var Range:float = 5; //this is the range from which you will be able to enter the gate
function Update()
{
if ( Vector3.Distance(transform.position, Target.position) < Range ) //if the distance between your position and the gates position is lower than the set range, load the new scene
{
Application.LoadLevel("Scene2"); //load the new scene
}
}
Excellent thanks!
Hmm says compiler errors when I try to run with that as a javascript. Won’t compile when I try to save it as a C#. Is there something more than that I need to include?
Okay I figured it out, I had renamed the Range variable in one spot but forgot to do it in the other (wanted to say Range to what in name). Works now.
BUT after adding Scene2 to the build I am getting this error when I try to run scene1
There are 2 audio listeners in the scene. Please ensure there is always exactly one audio listener in the scene.
What does this mean? Only audio listeners are the Firstpersoncontrollers, one in Scene1 and one in Scene2? Dont I need to have the FPC in both scenes so it knows where to load to if you zone to Scene2? Or is there another way to do it?
Okay I deleted the FPC in scene2 and audio error message went away BUT I still am spawning not into Scene1 when I run it in Scene1 but into a void scene falling into space.
Am I supposed to do something when I add two Scenes to tell it which Scene to start in? Or what?
I was thinking in the car, is it possible that my problem is that in the Build Settings screen I have Scene2 listed first and Scene1 next? Will hitting Run in Scene1 start me in Scene2 then?
Okay switched order of Scene1 and Scene2 in build setting and when I run play it starts in Scene2 anyway. How to fix?
For the record, I figured it out. I was putting the script on the gate, not the first person. And had it targeted at the gate so it turned the scene change on at start up. Works well now, thanks much!