attacking
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?)
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?)
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.
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.
I'd combine those two idea and do this:
void hit( void )
{
sp_target(&current_sprite, 1);
}
void hit( void )
{
sp_target(&current_sprite, 1);
}
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.
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.
If the you've got mixed enemies in the screen replace
&calc = sp_strength(&current_sprite, -1);
with
&calc = sp_strength(&enemy_sprite, -1);
&calc = sp_strength(&current_sprite, -1);
with
&calc = sp_strength(&enemy_sprite, -1);