11-11-2018, 08:23 AM
(This post was last modified: 11-11-2018, 08:23 AM by Silverthorn.)
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:
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:
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
~ Breaking LFE since 2008 ~
"Freeze, you're under vrest!" - Mark, probably.
» Gallery | » Sprites | » DeviantArt