Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ai for any char
#2
Heya, welcome to LFE!

Something to keep in mind is that this is just a snippet, you'll have to manually load a target first, otherwise this will not work at all. I have felt so free to add that:
    AI-Code:
int ego(){
 
for (int i = 0; i < 400; i++) {
 if (loadTarget(i) == 0 && target.team != self.team) {
//DODGE ENEMY ATTACK
if (target.state == 3 && abs(target.z-self.z) < 19
&& (self.x-target.x)*((self.facing?1:0)*2-1) > 0
&& (self.x-target.x)*((self.facing?1:0)*2-1) < 70){
print("Dodge down!\n");
down(1,1);return 1;
}
if (target.state == 3 && abs(target.z-self.z) > 19
&& (self.x-target.x)*((self.facing?1:0)*2-1) > 0
&& (self.x-target.x)*((self.facing?1:0)*2-1) < 70){
print("Dodge up!\n");
up(1,1);return 1;
}
}}
 
return 0;
}



This will just try to avoid close-combat-situations; projectiles are completely ignored (as those frequently run on states 3xxx, 2xxx, or 1xxx). Overall, this caught me off-guard a few times due to the AI not blindly walking into random punches but it's not fast enough to react to dash attacks and the like. Still a good way to go until it's a truly evasive AI! :wobble:
Silverthorn / Blue Phoenix
~ Breaking LFE since 2008 ~

"Freeze, you're under vrest!" - Mark, probably.

» Gallery | » Sprites | » DeviantArt
Reply
Thanks given by:


Messages In This Thread
ai for any char - by open source nature - 11-11-2018, 03:19 AM
RE: ai for any char - by Silverthorn - 11-11-2018, 08:23 AM
RE: ai for any char - by open source nature - 11-11-2018, 03:24 PM
RE: ai for any char - by Uri - 11-11-2018, 03:51 PM
RE: ai for any char - by open source nature - 11-11-2018, 06:32 PM
RE: ai for any char - by Uri - 11-11-2018, 07:56 PM
RE: ai for any char - by open source nature - 11-12-2018, 12:09 AM
RE: ai for any char - by Uri - 11-12-2018, 12:42 AM
RE: ai for any char - by open source nature - 11-18-2018, 07:11 AM



Users browsing this thread: 2 Guest(s)