loco: i just use c_move to get to the next position, this is the complete code of the fakeentity at the client. hostplayerposition is the vector iam sending.
Code:
function hostplayerfakefunction()
{
var unit_speed[3];
var dire[3];
var currentposition[3];
my.mode = mode_stand;
while(1)
{
//stand
if(my.mode == mode_stand)
{
my.anim_index += time;
ent_Animate(my,"stand",my.anim_index,anm_cycle);
// new different hostposition incoming -> go move there
if(abs(my.x - hostplayerposition.x) + abs(my.y - hostplayerposition.y) > 15)
{
my.mode = mode_walk;
}
}
// walking to hostplayerposition
if(my.mode == mode_walk)
{
while (my.mode == mode_walk ) // stop near the target
{
// always face next position
vec_set(temp, hostplayerposition);
vec_sub (temp, my.x);
vec_to_angle (dire, temp); // rotate the unit towards the target
my.tilt = 0; // we only need the correct "pan" angle, not tilt
unit_speed.x = 1.5; // unit speed
// turn
if(((my.pan < dire.pan + 5) || (my.pan > dire.pan - 5)) && (abs(my.x - hostplayerposition.x) + abs(my.y - hostplayerposition.y) > 10 ))
{
my.pan = my.pan + ang(dire.pan-my.pan) * 1 * time;//i am turning
}
c_move(my, unit_speed, nullvector, ignore_me + ignore_you + IGNORE_CONTENT + ignore_sprites + ignore_passable );
// trace to geht right height to terrain
vecFrom.x =my.x;
vecFrom.y =my.y;
vecFrom.z = 200;
vec_set(vecTo,VecFrom);
vecTo.z = -200;
c_trace(vecFrom,vecTo, IGNORE_ME|IGNORE_PASSABLE|IGNORE_CONTENT|IGNORE_SPRITES|USE_POLYGON);
vec_set(temp_loc,vecTo);
my.z = target.z + 32;
// animate
my.anim_index += 5 * time;
ent_animate(my,"walk",my.anim_index,anm_cycle);
// are we near the last received hostposition? and z is 1
if (abs(my.x - hostplayerposition.x) + abs(my.y - hostplayerposition.y) < 5 && hostplayerposition.z == 1)
{
my.mode = mode_stand;
hostplayerposition.z = 0;
}
wait(1);
}
}
wait(1);
}
}
william: very very much thanks for your contribution, ill have a look at your method later in the afternoon. i guess setting directly doesnt take that much ressources like c_move also... however i assume you are using c_move for the server player? do you?