I have some problem: I wnat my character to make an action when his or his ally's health is low
I also separated this into two:
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:
after the "for" loop to sometimes set the target to his teammate.
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();
}
}
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();
}
Ok, I think I've got this... It needed something like:
Code:
loadTarget(i);