Little Fighter Empire - Forums

Full Version: me or my teammate
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have some problem: I wnat my character to make an action when his or his ally's health is low
Code:
for (int i=0; i<16; ++i)
{
    if ( ((self.hp<=300 || abs(self.hp-self.dark_hp)>200) && target.team==self.team && target.id==42 && loadTarget(i)==0) ||
        ((target.hp<=300 || abs(target.hp-target.dark_hp)>200) && target.team==self.team && target.id==42 && loadTarget(i)==0))
    {
    DdJ();
    }
}
I also separated this into two:
Code:
if (target.id==42 && (target.hp<=300 || abs(target.hp-target.dark_hp)>200) && target.team==self.team &&
          loadTarget(j)==0)
    {
    //print(1+" " +target.id+"   ");
    DdJ();
    }


    else
    {

       if (target.id==42 && (self.hp<=300 || abs(self.hp-self.dark_hp)>200) && target.team==self.team &&
             loadTarget(j)==0)
       {
       //print(2+" " +target.id+"   ");
       DdJ();
       }
but it doesn't work either and instead of target.id it displays self.id in the print part


Ok, I think I've got this... It needed something like:
Code:
loadTarget(i);
after the "for" loop to sometimes set the target to his teammate.