Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
me or my teammate
#1
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.
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)