- Home /
Trigger respawn point through player variables.
Ok... I relly need to make the player respawn on different points depending on the player performance, to be more presice when certain requests are fullfilled.
This is my respawn script
var reSpawnPoint1: Transform; var reSpawnPoint2: Transform; var reSpawnPoint3: Transform; var timer : float = 0.0;
function Update () { if(gameObject.transform.position.y < -3) { timer += Time.deltaTime; if(timer>5) { timer = 0; gameObject.transform.position = reSpawnPoint2.position;
SplashScript.SPLASH = 15;
}
}
}
The last line showing "SplashScript.SPLASH = 15;" is where i change the GUItexture back to normal after each respawn. I have 15 different GUI textures, but I want to respawn to reSpasnPoint 2 if the GUItexure reaches 7 before dying/respawning, and reSpawnPoint 3 if GUItexture reaches 15 before dying.
Currently I only respawn on reSpawnPoint2 every time except for when I load the level. I know this probably should be a simple task, but I am still very inexperienced with scripting.
Answer by Julian-Glenn · Aug 17, 2010 at 03:54 PM
The Lerpz tutorial has multiple respawn locations based upon progress through the level. I'd say take a look at it.
http://unity3d.com/support/resources/tutorials/3d-platform-game
I thought the spawnpoints in that tutorial was triggered when the player stepped on them, and not through how well the player performed.
Yes bit you can easily modify the script to make it use a static variable such as score etc.
Your answer
Follow this Question
Related Questions
How to use a script on multiple gameobjects, then change a variable for one of them, not the other. 3 Answers
How to link this 2 variables from 2 different scripts / gameobjects? 1 Answer
Respawn Script 1 Answer
Script access (without script name) 1 Answer
RTS Style Selection system (How to control one unit and not the others) 2 Answers