yea, of course.
here is how I did:
first write "ENTITY* position1;" and "var friendcount" on the top of you script.
then in you player code write "ent_create("position1.mdl", nullvector, func_position1);" //it creats position1 model at the vector(0,0,0) and gives it the function "func_position1"
after that, create the function for the position, I did like this:
----------------------------------------
function func_position1()
{
position1 = me; //tells that it is the position1
set(my, PASSABLE); //makes it passable
set(my, INVISIBLE); //makes it invisible
while(1)
{
my.pan = player.pan; //pan as the player pan
my.x = player.x; //be on the same x as the player (if you want the position to be before or after the player, you write +something or -something after the x, like I did with the y.
my.y = player.y+50; //be on the same y+50 as the player
my.z = player.z; //be on the same z as the player
wait(1);
}
}
--------------------------------------------------------
then you go down to you friend code and give it a ID and make it go to its position, like this:
-------------------------------------------------------------------
action friend()
{
var tailnumber = 0;
friendcount = friendcount + 1; //this counts up the friendcount var in the top, when the friend has been created.
tailnumber = friendcount; //gives the friend an ID, by seen what the friendcount was on, when he was created.
while(1)
{
if(tailnumber == 1) //if the friend got the ID 1.
{
vec_set(temp, position1.x) //this will make it look at position1
vec_sub(temp, my.x); //this will make it look at position1
vec_to_angle(my.pan, temp); //this will make it look at position1
my.tilt = 0; //don't tilt, when looking
then you use c_move to make it walk toward its own x-axis. and because its x-axis is turned toward the position1, it will walk that way.
}
}
}
---------------------------------------------------------------------
it isn't the best way to do it, but it worked for me, so I use it.
I hope it was clearly enough. if you don't understand, then ask me and I will try to explain another way.
thanks
- Muhsin Kaymak
EDIT: I might be able to upload an example script later...if you got time to wait?
Last edited by Muhsin; 05/22/10 09:35.