I made my first successful script without baddgering anyone about the answer!!! I was incredably rewarded!! I made a teleport script where i can say which map to teleport to!!!
All in Unityscript
var map : int;
function OnTriggerEnter (other: Collider){
Application.LoadLevel(map);
}
I am very proud of myself!!!
UPDATE
Got it!
Ok what i have found out is that the script is certainly (had a theory from past ânot real scriptingâ engine 001 scripting) that the script is taking the player to 0,0,0 on the map the script is on but not on the new map!
So the last (i hope) questions is, is it possable to enforce it onto the new map, (have it work on the new map or set it so it works globe-aly) if so how?
Oh and incase anyone was hinting that putting a script onto the new map placeing the player at a certain point, problem is the player will enter the map at different locations and needs to be placed at the correct location. Lets say you come out of your bedroom in the morning and you somehow end up outside your house (arkward huh?) yeah i dont want that.
var map : int;
var gridPosition = Vector3(1, 1, 1);
var player : GameObject;
function OnTriggerEnter (other: Collider){
Application.LoadLevel(map);
player.transform.position =(gridPosition);
Debug.Log ("Success!");
}
function Start () {
player =GameObject.Find("3rd Person Controller");
}
OLD
Anyway my next plan was to add another bit onto it describing where exactly along the axis the player will end upâŚ
This is what i got.
var gridPosition = Vector3(1, 1, 1);
var player : GameObject;
function OnTriggerEnter (other: Collider){
Application.LoadLevel(map);
player.transform.position = Vector3(gridPosition);
}
//player.transform.position = Vector3(25, 25, 25);
//Debug.Log ("Success!");
//gridPosition
//Transform.position(gridPosition)
//function Update () if (Input.GetKeyDown("e")
//var player =GameObject.Find("3rd Person Controller");
I bet the answer is in one of the notes.
And i bet this is itâŚbut when the script is done the gameplay goes abit funny. Iâll explain later.
var player =GameObject.Find("3rd Person Controller");
//For some reason i have to shorten the var to...
var player =GameObject;
âŚbecause the console says something about âFind can only be called from the main thread.â I didnt understand what the console was saying, something to do with contructor and arguments, looked it up in script ref, nothing that suits it. So in variables i have to drag the 3rd person controller manualy.
player.transform.position = Vector3(gridPosition);
//and thats the rest of the script...
When the scripy finishes the gameplay goes funny.Like the cammra becomes detached and other stuff i dont understnad. Iâll explain futher later on.
Tackle one problem at a time eh?[/PHP]