How to choose respawn point depending on player performance

I have this small level with three different respawn points. I want to make the player respawn on a specific respawn point depending on the player performance.
To be more specific… If the player manages to to 5 tricks/double jumps in midair he/she respawns on reSpawnPoint 2, and if the player manages to pull of 15 respawns on point 3 and so on.

How do I implement this into the 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;
            }
        } 
    }

I know I ask a lot of questions on this forum, but I really need all the help I can get.

In advance: thanks!

Do you have a variable somewhere that keeps track of how many tricks (or whatever) the player has accomplished? If so, can’t you just use a series of if-else statements? E.g.:

if (tricks < 5) {
    transform.position = reSpawnPoint1.position;
} else if (tricks < 15) {
    transform.position = reSpawnPoint2.position;
} else {
    transform.position = reSpawnPoint3.position;
}

If you want something more flexible, you could create a container mapping number of tricks to spawn points (this way you wouldn’t be locked into specific threshold values or a specific number of spawn points).

Yes I use a GUITexture script with a static variable to the Character controller script. It animates the GUItexture every time the space button is pressed.

This is my GUItexture 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;
        }
    } 
}

This is the part of the character controller script that animates the GUItexture:

...

  } 
   if (Input.GetButtonDown ("Jump")  jumpCount < 20) 
  { 
    moveDirection.y = jumpSpeed; 
    jumpCount++;
   	SplashScript.SPLASH -= 1;
   		
 } 

	}
...

So does that mean you got it figured out? Or do you still need help with something?

Hehe I have been tinkering with it for a couple of hours now, but still don’t understand to much when it comes to JS. :S All help is much appreciated, though I wish I learned faster. :stuck_out_tongue:

Well, I still can’t quite tell if you need help or not :slight_smile:

Did you try what I suggested earlier? Did it work? Did it not work?