Hey ppl,

I waz wonderin' how to code multiple entities and assign them to one path.
I already have my action code. Made it w/ the help of Kinji's Pathfinding tutorial. (great tut btw

). But when assigning it to more than one entity, only one follows the path and the other one doesn't move/do anything.
Here's my code:
Code:
action truck
{
wait(1);
move_truck();
////////// attach entity to nearest path
result = path_scan(me,my.x,my.pan,vector(360,180,1000));
if (result == 0) { return; }
if(result) { switch = 1; }
///////////////get 1st node on path
path_getnode(my,1,pos_node,null);
vec_to_angle(my.pan,vec_diff(temp,pos_node,my.x));
while(1)
{
wait(1);
distance = vec_dist(my.x,pos_node);
if(distance < 25)
{
switch = off;
node = path_nextnode(my,node,1);
path_getnode(my,node,pos_node, null);
vec_to_angle(my.pan,vec_diff(temp,pos_node,my.x));
wait(1);
switch = 1; // start moving again
}
}
}
/////////////////////////////////
function move_truck()
{
while(1)
{
wait(1);
if(switch == 1)
{
c_move(truck_ent,truck_speed,nullvector,IGNORE_YOU|GLIDE);
}
ent_animate(my,"frame",path_anim_speed,anm_cycle);
path_anim_speed += 3 * time;
path_anim_speed %= 100;
}
}
Any idea how to make multiple entities follow a single path
using this action?
Thanks!
