If I may jump in here:
I think there are too many pointers and stuff, this could be made more simple.
But I like your code, really, finally some structured code in here! yeah.
However back to your problem.
I see that you create a dot for every actor but then it gets a bit messed up.
For example: I'm not sure if its going to work to store this actor handles in an array and count up the index variable.
One question:
Are your enemies created while running the game or are they placed to the level in WED?
My approach is for the place situation:
I'm going to work with skills here.
Code:
define id, skill20; //used by the actors and dots
var my_actors[50];
var actor_dots[50];
//uses: id
action enemy_dot
{
actor_dots[my.id] = handle(my);
while(1)
{
//to move the dot:
you = ptr_for_handle(my_actors[my.id]);
//now set the dot's position based on the you.x/y/z
}
}
//uses: id
action actor_walk_fight
{
my_actors[my.id] = handle(my);
you = ent_create(enemydot_mdl,my.x,enemey_dot);
you.id = my.id;
.. rest of your code here ..
}
Ok basicly what we are doing:
Placing a model (the enemy model) into wed, assign the actor_walk_fight action to it and setting the skill 20 (id) to a certain number. NOTE: every enemy must have a different id!
Now the actor stores a handle of itself in this array (my_actor) with the index of my.id which we gave him.
Then he creates a dot model and passes its id value to it, so every dot has the same id as his "creator".
Now the dot stores a handle of itself to another array with the id as index.
So now we have to arrays one with the handle of the actors and one with the handle of the dots, this gives us the freedom to access those in both ways.
- The actor can access "his" dot
- The dot can access "his" actor (creator)
Now in the while loop of the dot's action we just get the pointer to the actor and reset the position of the dot.
Hope this was somehow helpful
bye Thunder