: : : If you still can't make it work, post the whole script or email it to me. Sometimes, the problem came from other places that were not so obvious.
: : Mabey. The script is kinda huge (one script applied to about 9 sprites around the game, so I put a lot into it.) right now the "stop attack" proc. is in the attack proc. for convenience, but I think I'll move it into a loop already in main. I'll get it to work, but I'd like to know how Dink uses "&enemy_sprite" internaly.
: sp_target(¤t_sprite, 0); seemed to work just fine when I tried it. Since you say this is a complicated script, I expect there's a glitch somewhere else in there effecting things in subtle ways. Are you be any chance calling procedures from inside the script?
: (like this)
: void main ( void )
: {
: attack();
: }
: Because it really doesn't work well, I think it creates a copy of the script which might not even be attached to a sprite.
I got it to work. For a while I tried it in a main loop but it didn't seem to use it (main not running while attacking?) So I added it to the attack proc.
void attack()
{
if (&invis == 1)
{
goto dis;
}
int &mcounter = random(4000,0);
sp_attack_wait(¤t_sprite,&mcounter);
}
and further down....
void dis ()
{
dis:
freeze(¤t_sprite);
sp_speed(¤t_sprite,1);
&enemy_sprite = 0;
sp_target(¤t_sprite,&enemy_sprite);
say("'$ hey?",¤t_sprite);
sp_dir(¤t_sprite,3);
wait(800);
sp_dir(¤t_sprite,1);
wait(800);
unfreeze(¤t_sprite);
}
Turns out to look pretty good, even though the guard ( a knight actually ) has to get close before loosing Dink. :o