[SOLVED]Time Players

Hello guys

i want to make a game with a system like that :

-You have a player that moves in FPSWalker but that is in third
-He starts in Vector3(0, 7, 0) for example
-when you push a button, he come back in start position, and another player is created, which makes the same movements as the last (bad English, im french )

but here is the problem, i tried with an Array, but it doesnâ€™t work, can you help me plz ?

Can you post the code you are using and describe what it is supposed to be doing?

``````var Coo = 0;
var CooLst = new Array();
var Register = false;
var InstPlayer : Transform;
var Player : Transform;
function Start (){
Camera.main.SendMessage("SetTarget", transform);
}
function Update () {
if(Register == false){
Coo = transform.position.x;
}else{
for(var Apply in CooLst){
transform.position.x = Apply;
}
}
if(Input.GetButtonDown("Fire2")){
if(Register == false){
Camera.main.SendMessage("SetTarget", null);
}
}
}
``````

it issupposed to enter z in array, and when Fire2 is pushed, to create another player, and to make that this player always have the succesive z coor again and again

I think what heâ€™s describing is something like Time Donkey; either have a deterministic simulation and store the inputs for replay later or store actual positions per unit time, say at 1 second intervals and replay that later, interpolating between coordinates.

Yes, the same system as Time donkey
i didnâ€™t know you know that

noone knows ???

Have you tried this?, It looks to me a good way to solve your problem.

thx for trick, i did it !!
but i have another problem yet :

``````var Registered = false;
private var CooZ = new Array();
private var CooX = new Array();
private var CooY = new Array();
private var RotX = new Array();
var CaseEnter = 0;
var Player : Transform;
var IntervalTime = 0.0;
var OldPlayer : Transform;

function Start (){
var PlayerToFind = GameObject.Find("Player");
Player = PlayerToFind.transform;
}

function Update () {
if(Registered == false){
CooZ[CaseEnter] = Player.transform.position.z;
CooX[CaseEnter] = Player.transform.position.x;
CooY[CaseEnter] = Player.transform.position.y;
RotX[CaseEnter] = Player.transform.rotation.y;
CaseEnter += 1;
IntervalTime = Time.time;
}
if(Input.GetButtonDown("Fire2")){
if(Registered == false){
IntervalTime = Time.time-IntervalTime;
ResPositionPlayer.Restart = true;
Instantiate(OldPlayer, Vector3(1000, 1000, 1000), Quaternion(0, 0, 0, 0));
}
Registered = true;
RePos();
}
}

function RePos (){
for(var i=0; i < CooZ.length;i++){
transform.position.z = CooZ[i];
transform.position.x = CooX[i];
transform.position.y = CooY[i];
transform.rotation.y = RotX[i];
yield WaitForSeconds(IntervalTime);
}
}
``````

the problem is that the first player works good, but the Instantiated players doesnâ€™t want to change their position. it says :

NullReferenceException: Object reference not set to an instance of an object

at this line :

``````transform.position.z = CooZ[i];
``````

can you help me ?

up !

donâ€™t search anymore, i found a solution
my works very good thx to all