I want to jan can follow teammate
and if teammate is in range
she will loadtarget for enemy
this is my program but isn't work
How can i correct it?
and if teammate is in range
she will loadtarget for enemy
this is my program but isn't work
How can i correct it?
Code:
void id()
{
D(0,0);
A(0,0);
J(0,0);
right(0,0);
down(0,0);
left(0,0);
up(0,0);
for (int i = 0; i < 400; i++){ //target
if (loadTarget(i) == 0 && target.num != self.num && target.team==self.team){
break;
}
}
int VARxdst = self.x-target.x;
int VARydst = self.y-target.y;
int VARzdst = self.z-target.z;
int VARzbgu = self.z-bg_zwidth1;
int VARzbgb = bg_zwidth2-self.z;
int VARxbgr = bg_width-self.x;
int VARxabs = abs(VARxdst);
int VARyabs = abs(VARydst);
int VARzabs = abs(VARzdst);
int VARsf; //self facing
int VARtf; //target facing
int VARDirToTargetH; //lawannya di kiri atau kanan
int VARDirToTargetV; //lawannya di atas atau bawah
int VARholdinglgtweapon = 0;
if(self.facing == true){VARsf = -1;}
if(self.facing == false){VARsf = 1;}
if(target.facing == true){VARtf = -1;}
if(target.facing == false){VARtf = 1;}
if(VARxdst < 0){VARDirToTargetH = 1;}
if(VARxdst > 0){VARDirToTargetH = -1;}
if(VARzdst < 0){VARDirToTargetV = 1;}
if(VARzdst > 0){VARDirToTargetV = -1;}
if(target.hp>0)
{
if(VARzdst<-30)
down(1,1);
else if(VARzdst>30)
up(1,1);
else if(VARxdst<-200)
right(1,1);
else if(VARxdst>200)
left(1,1);
}
if(VARzdst>-30 && VARzdst<30 && VARxdst>-200 && VARxdst<200)
{
for (int i = 0; i < 400; i++){ //target
if (loadTarget(i) == 0 && target.num != self.num && target.team!=self.team){
break;
}
}
}
if(target.hp>0 && VARzabs<= 20 && target.team!=self.team)
{
if(VARxdst>-75 && VARxdst<0 )
{
if(VARsf==-1)
right(1,1);
A();
}
else if(VARxdst<75 && VARxdst>=0)
{
if(VARsf==1)
left(1,1);
A();
}
else
{
left(0,0);
right(0,0);
A(0,0);
}
}
}