Little Fighter Empire - Forums
me or my teammate - Printable Version

+- Little Fighter Empire - Forums (https://lf-empire.de/forum)
+-- Forum: Little Fighter 2 Zone (https://lf-empire.de/forum/forumdisplay.php?fid=7)
+--- Forum: AI Scripting (https://lf-empire.de/forum/forumdisplay.php?fid=56)
+--- Thread: me or my teammate (/showthread.php?tid=9398)



me or my teammate - pikol - 09-14-2014

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.