The Dink Network

attacking

May 20th 2003, 12:27 AM
spike.gif
Hello, another question as the deadline nears to get the evil hero dmod finished.
With a little bit of luck, Dink can simply win a fight if he stands back and waits for all his enemies to kill eachother (which leaves one enemy to kill for Dink). Now how do I avoid that? Is there a way to have enemies only attack Dink, while they are unable to hurt their friends. (Prophet, you must have had a similar problem for your RTS?)
May 20th 2003, 02:26 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
First of all, make sure there's no :
sp_target(&current_sprite, &enemy_sprite);
in the hit procedure.

Next to that, you could create a system to periodically set the sprite's target to 1.
May 20th 2003, 09:21 AM
wizardg.gif
Paul
Peasant He/Him United States
 
I'd combine those two idea and do this:

void hit( void )
{
sp_target(&current_sprite, 1);
}
May 22nd 2003, 04:08 PM
old.gif
You mean when the enemies attack dink but also hit another one near dink?

Here is a little script to prevent that...

( put it into the creatures script )

void main(void)
{
int &calc;
int &calcb;
//THE REST
}

void hit(void)
{
&calc = sp_strength(&current_sprite, -1);

if (&enemy_sprite == 1) goto skip;

&calcb = sp_hitpoints(&current_sprite, -1);
&calcb += &calc;
sp_hitpoints(&current_sprite, &calcb);

SKIP;
}

When bonca A hits bonca B, then the damage of bonca A is added to bonca B's health. So he is healed....

I use this in "War Planet" when the enemy shoots with mortars and other bombs.
May 22nd 2003, 04:09 PM
old.gif
If the you've got mixed enemies in the screen replace
&calc = sp_strength(&current_sprite, -1);

with

&calc = sp_strength(&enemy_sprite, -1);
May 23rd 2003, 04:56 AM
spike.gif
Thanks guys. Especially for the script that heals instead of damages. I'll give you credit in my evil dmod.