1. Do not assign the pointers in the while loop, just put it in begin of the action:

Code:


entity* p1;
entity* p2;

action play1
{
p1 = my;
while(p2==null){wait(1);}
while(1)
{
my.x += 2 * key_force.x * time;
if (my.x > p2.x)
{
my.z += 5 * time;
}
wait(1);
}
}

action play2
{
p2 = my;
while(1)
{
my.x += 2 * joy_force.x * time;
wait(1);
}
}




This should work. Dont forget you need to move p1 to a point where its x is superior do p2, otherwise it wont work.