Little Fighter Empire - Forums
Question About Target(I Think) - 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: Question About Target(I Think) (/showthread.php?tid=8399)



Question About Target(I Think) - samael - 12-02-2012

So. I'm doing basic AI for NTSDII. For now this AI can:

Decide when is better use melee/Long range style of battle
Look for a friend that can cure the char
Look for a friend that need cure and cure this char
Basic things like: recharge in right time, defend, dodge...

what i wanna know is:

Is possible to make a char notice that him is fighting against more than one char?

And/or

Know how much HP the other TEAM(not only one target) have?


Thanks for help :)


RE: Question About Target(I Think) - YinYin - 12-02-2012

yes - create a for loop
cycle through all objects (i = 0 to 399) with loadTarget
and check their state
if an object is a character whos not on your team, add his hp to a variable

once the loop is done you have a variable with the sum of all opponents hp


RE: Question About Target(I Think) - samael - 12-02-2012

Wow.. Thanks Bro!! REALLY thanks!!!

Btw for who don't understand:

PHP Code:
//get_enemies_data 
    
int TTGT 0;
    
int TTHP 0;      
    
int m 0;    
    for (
int i 0400i++)
    
  {if (
loadTarget(i) == && target.num != self.num && target.team != self.team && target.hp 0){
   
i;TTHP target.hp+TTHP;TTGT = (target.hp/target.hp)+TTGT;
  }} 



Were TTHP will be the sum of all enemies hp and TTGT will be the amount of enemies. Correct if i'm wrong YinYin...