Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Couple of AI questions
#1
I am starting to understand the scripting a little but I still don't know a fix for some things.

1. I want to set a dodging move for attacks that cause >= 70 injury (AI will only do it when it has >= 400 MP so it won't be a cheap move). Is there a way to do this? An alternative would be using target.state == 3, perhaps with a target.mp condition.. but it would not have the same effect


2. I want to make my character use DJA+A+A+A.... when the opponent is at a distance. It's a move to charge MP. However, he DOES go to the charging stance (caused by DJA), but he only starts tapping A when I walk. Does anybody know why this might happen?

Code:
int ego(){
//close range:
if (target.y == 0 && abs(target.z-self.z) < 9 && (self.x-target.x)*((self.facing?1:0)*2-1) > 50 && (self.x-target.x)*((self.facing?1:0)*2-1) < 100 && target.state == 16 && self.mp >= 375){
if (abs(self.x-target.x) > 0 && (self.state == 2 || self.state == 0)){
  if (self.x-target.x > 0){DdA();}         //turn back
  else {DuA();}
}
else if (self.x-target.x < 0){left();}  //adjust x for DvA
else {right();}
return 1;
}
//long/mid range:
if (abs(100*(self.z-target.z)/((self.x-target.x)*((self.facing?1:0)*2-1))) <= 3 && abs(self.x-target.x) < 250 && abs(self.x-target.x) > 150 && self.mp >= 100){
  if (self.x-target.x > 0){DlA();}         //D<A
  else if (self.x-target.x < 0){DrA();}   //D>A
}
else if (abs(100*(self.z-target.z)/((self.x-target.x)*((self.facing?1:0)*2-1))) <= 15 && abs(self.x-target.x) < 450 && abs(self.x-target.x) > 250 && self.mp >= 280 && target.state == 0 || target.state == 1 || target.state == 2) {
  if (self.x-target.x > 0){DlJ();}         //D<J
  else if (self.x-target.x < 0){DrJ();}   //D>J
   }
  else if (self.mp <= 400 && (abs(self.z-target.z) > 40) || (abs(self.x-target.x) < 1000 && abs(self.x-target.x) > 320)) {
  if (self.x-target.x > 0){DJA();}         //DJA
  else if (self.x-target.x < 0){DJA();}   //DJA
  
  return 1;
}

//instant attacks
if (self.state == 5){A();}                                               //dash attack
if ((self.frame == 286 && target.state == 11) || (target.state == 16)) {A();} //long combination
if ((self.frame == 353 && (target.state == 11) || (target.state == 16))) {DuJ();} //meteor combination
if ((self.frame == 353 && (target.state == 16) && self.mp >= 220)) {DrJ();} //kamehameha combination
if (self.frame == 365 && target.state == 12){A();}                     //kick up
if (self.frame == 244 && (self.mp >= 85) && (self.x-target.x)*((self.facing?1:0)*2-1) > 50) {DuJ();} //IT Kamehameha
if (self.frame == 166 || self.frame == 20 || self.frame == 172 || self.frame == 22 && (self.mp < 500) && (abs(self.x-target.x) < 1000 && abs(self.x-target.x) > 250)|| self.frame == 166 || self.frame == 20 || self.frame == 172 || self.frame == 22 && (abs(self.z-target.z) > 30)) {A();} //DJA+A+A..
return 0;
}

3. Is there a way to make him avoid picking objects?
Original character edits
Goku2021
LF2 Timelapse (open source mod)

Reply
Thanks given by:
#2
(05-07-2013, 02:32 PM)Neocrypt Wrote:  3. Is there a way to make him avoid picking objects?
If you want to avoid him using any items at all you can solve this without AI.
Make him spawn one of his projectiles on hand like freeze does with his ice sword. (do that in basic attacking actions when he doesn't have an item yet)
Hold this projectile in an invisible frame everywhere.
Make all his basic attacks also available from the basic item actions.
Reply
Thanks given by: A-Man




Users browsing this thread: 1 Guest(s)