IFF System!
Still feel troubled about how to make soldiers to identify who is enemy and who is friend in a battle? This one will end the trouble forever.
...
&miff = 1 //Let's assume that this is the king's knight,so &miff equals 1.
sp_custom("iff",¤t_sprite,&miff);
...
//This is targeting system.
target:int &enemy_number = &devil+&karl+&others;
if (&enemy_number == 0)
{
goto get_this_position
}
int &mtarget = get_rand_sprite_with_this_brain(9,¤t_sprite);
sp_target(¤t_sprite,&mtarget);
int &tiff = sp_custom("iff",&mtarget,-1);
if (&tiff = &miff)
{
goto target;
}
...
get_this_position
p_brain(¤t_sprite,16); //Peace time,let's wander around.
...
//dead,king's knights have one loss.
void die(void)
{
...
&king -=1;
...
}
...
&miff = 1 //Let's assume that this is the king's knight,so &miff equals 1.
sp_custom("iff",¤t_sprite,&miff);
...
//This is targeting system.
target:int &enemy_number = &devil+&karl+&others;
if (&enemy_number == 0)
{
goto get_this_position
}
int &mtarget = get_rand_sprite_with_this_brain(9,¤t_sprite);
sp_target(¤t_sprite,&mtarget);
int &tiff = sp_custom("iff",&mtarget,-1);
if (&tiff = &miff)
{
goto target;
}
...
get_this_position

...
//dead,king's knights have one loss.
void die(void)
{
...
&king -=1;
...
}