Hi Robert, I looked at your code and wrote a script for you that is close to what you are trying to do. I haven't tested the code, so I am not sure how it will react when the target is within 10 quants. Basically what you have is 2 actions, ent_target() is for the objects in the game you want as targets, and ent_to_target() is for the entity you want to move to the targets. Let me know if you have any questions.

Code:

//////////////////////////////
// Target Ents
//////////////////////////////

define max_ents, 5; // change this if you would like more target entities

var ent_array[max_ents];
var ent_ctr;
var ent_timer = 0; // start with 0 because we need to set a target first

entity* target_ent;

action ent_target()
{
ent_array[ent_ctr] = handle(my);
}

action ent_to_target()
{
var move_dist[3];
var move_speed;
move_speed = 6; // change this to move faster or slower

while(ent_ctr < (max_ents - 1)) { wait(1); } // wait for all entities to be stored
ent_ctr = 0; // reset for further use

while(1)
{
move_dist.x = move_speed * time_step;

if(target_ent != null)
{
if(vec_dist(target_ent.x,my.x) > 10)
{
vec_to_angle(my.pan,vec_diff(temp,you.x,my.x));
c_move(me,move_dist,nullvector,use_aabb | ignore_passable | glide);
}
}
else
{
while(ent_timer > 0) { ent_timer -= time_step / 16; }
target_ent = ptr_for_handle[ent_array[ent_ctr]];
ent_timer = 20; // change every 20 seconds
ent_ctr += 1; // change to the next target
if(ent_ctr == max_ents) { ent_ctr = 0; }
}
wait(1);
}
}



-raiden


"It doesn't matter if we win or lose, it's how we make the game."
--------------------
Links: 3DGS for Dummies