The Dink Network

sp_target

January 6th 2006, 05:39 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
I noticed that this command (present in many monsterscripts) is automaticly executed, whether you have it in your script or not:
sp_target(&current_sprite,&enemy_sprite);

Now the problem is that I let Dink fight alongside with a friend, so for the friend's script I want:
if (&enemy_sprite != 1)
{
sp_target(&current_sprite,&enemy_sprite);
}
That doesn't work because of what I just said, I could fix it by do this:
if (&enemy_sprite == 1)
{
sp_target(&current_sprite,1000);
}
but that's a pretty ugly fix, the only other thing I can think of is setting the target to be an random enemy. Or does any of you know a better fix?
January 6th 2006, 06:45 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
void main(void)
{
int &last_target = 1000;
}

void hit(void)
{
if (&enemy_sprite != 1)
{
&last_target = &enemy_sprite;
}
sp_target(&current_sprite, &last_target);
}
January 6th 2006, 11:27 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Thanks! It works a lot better then my ideas. It isn't perfect (the sprite first tries to hit me once, then goes back fighting the enemy), but it's still a pretty good fix.
January 6th 2006, 03:57 PM
knightg.gif
cypry
Peasant He/Him Romania
Chop your own wood, and it will warm you twice. 
SimonK used an allied in pq. He should tell us how he did.
January 7th 2006, 03:04 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Thanks, I'll look into the PQ sourcecode first...