nope, wont work. Ok, here is what I did, maybe someone can figure it out.
SCRIPT
//huge cut sceen
int &guard = create_sprite(620, 68, 0, 293, 1);
int &p1 = create_sprite(159, 331, 0, 857, 10);
int &p2 = create_sprite(206, 351, 0, 857, 10);
//stuff here to make them walk and attack
//now, we want to guard to attack every baddy left on the screen
goto attacker;
attacker:
int &attack = get_rand_sprite_with_this_brain(9, ¤t_sprite);
sp_target(&guard, &attack);
wait(5000);
goto attacker;
: attacker:
: int &attack = get_rand_sprite_with_this_brain(9, ¤t_sprite);
: sp_target(&guard, &attack);
: wait(5000);
: goto attacker;
Okay, what brain is the guard? 9 or 10? It looks like you have a problem either way. I'm assuming this script snipet is not attached to the guard, since it refers to him as &guard, not ¤t_sprite. So if he's brain 9 he is not excluded from the get_rand_sprite_with_this_brain command and could end up targeting himself. If he's brain 10, he can't target (at least in the sense of "chase") anyone at all.
Unless what that script is attached to is also brain 9 then you may be able to fix it like this:
int &attack = get_rand_sprite_with_this_brain(9, &guard);
: nope, wont work. Ok, here is what I did, maybe someone can figure it out.
: SCRIPT
: //huge cut sceen
: int &guard = create_sprite(620, 68, 0, 293, 1);
: int &p1 = create_sprite(159, 331, 0, 857, 10);
: int &p2 = create_sprite(206, 351, 0, 857, 10);
: //stuff here to make them walk and attack
: //now, we want to guard to attack every baddy left on the screen
: sp_target(&guard, &p1);
here:
if (&enemy_sprite == 0)
{
sp_target(&guard, &p2);
return;
}
wait(1000);
goto here;
}