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.

1 Answer

1

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.

–