The Dink Network

they attack eachother to

July 22nd 2006, 04:32 AM
milder.gif
I have two enemies in one screen with the same script. But when they attack Dink. The attack eachother to.

How can I make sure that they won't attack eachother only Dink?

I am using this script.

void main( void )
{
int &mcounter;

//change blood sequence
sp_blood_seq(&current_sprite, 470);
sp_blood_num(&current_sprite, 3);

sp_flying(&current_sprite, 1);
sp_brain(&current_sprite, 9);
sp_speed(&current_sprite, 3);
sp_sound(&current_sprite, 56);
sp_distance(&current_sprite, 30);
sp_timing(&current_sprite, 25);
sp_exp(&current_sprite, 30);
sp_base_walk(&current_sprite, 950);
sp_base_death(&current_sprite, 970);
sp_base_attack(&current_sprite, 960);
sp_defense(&current_sprite, 3);
sp_strength(&current_sprite, 9);
sp_touch_damage(&current_sprite, 4);
sp_hitpoints(&current_sprite, 20);
//fly
preload_seq(951);
preload_seq(953);
preload_seq(957);
preload_seq(959);
//death
preload_seq(971);
preload_seq(973);
preload_seq(977);
preload_seq(979);
//attack
preload_seq(962);
preload_seq(964);
preload_seq(966);
preload_seq(968);

if (random(2,1) == 1)
{
sp_target(&current_sprite, 1);
}
}

void hit( void )
{
playsound(58, 22050,0,&current_sprite, 0);

sp_target(&current_sprite, &enemy_sprite);
//lock on to the guy who just hit us
//playsound

}

void die( void )
{
int &hold = sp_editor_num(&current_sprite);
if (&hold != 0)
editor_type(&hold, 6);

&save_x = sp_x(&current_sprite, -1);
&save_y = sp_y(&current_sprite, -1);
external("emake","medium");
}

void attack( void )
{
playsound(57, 22050,0,&current_sprite, 0);
&mcounter = random(2000,0);
sp_attack_wait(&current_sprite, &mcounter);
}
July 22nd 2006, 07:09 AM
custom_fish.png
SabreTrout
Noble He/Him United Kingdom
Tigertigertiger. 
Delete the sp_target line. This causes the sprite the script is attached to (&current_sprite) to target whatever has attacked it (&enemy_sprite).

void hit( void )
{
playsound(58, 22050,0,&current_sprite, 0);

sp_target(&current_sprite, &enemy_sprite);
//lock on to the guy who just hit us
//playsound

}


July 22nd 2006, 08:23 AM
spike.gif
Unless it was changed in 1.08, that won't work... The monsters will still attack each other. I got really pissed off by this when trying to make a group fight with goblins and guards. ><

So yeah, you'll have to change &enemy_sprite into 1.

sp_target(&current_sprite, 1);
July 22nd 2006, 09:39 AM
custom_fish.png
SabreTrout
Noble He/Him United Kingdom
Tigertigertiger. 
Truly? Ah well, I've always been a crappy scripter.
July 22nd 2006, 09:49 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
I didn't change it, and I think I remember that bug too.
July 22nd 2006, 11:28 AM
knightg.gif
cypry
Peasant He/Him Romania
Chop your own wood, and it will warm you twice. 
Some consider this a bug, some others a fighting technique
July 22nd 2006, 02:23 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
If it gives a bug, why not try

sp_target(&current_sprite, 1);

?
July 22nd 2006, 02:51 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
That's what scratcher said?
July 22nd 2006, 09:16 PM
duck.gif
Tal
Noble He/Him United States
Super Sexy Tal Pal 
It helps me out when idiot modders decide to put 50 boncas onscreen when Dink has about 3 attack and defense.

Then again, there is Ultimate Cheat...
July 23rd 2006, 05:18 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
@ReDink1: woops, so he did.