Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to: script Artificial Intelligence
#36
(05-07-2013, 12:08 PM)Neocrypt Wrote:  I am starting to understand the scripting a little. I now 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
I don't think a class parent that checks the target's itr injury value is implemented. I don't want to be nosy, but I wouldn't advice being that specific with your AI's. Imagine a scenario where your opponent is about to hit you with a super deadly combo with 10 hits. Each hit causes 30 damage (which means your character won't do the dodging move D: ), and thus 300 of your hp. Checking all that would just be a waste of time.

(05-07-2013, 12:08 PM)Neocrypt Wrote:  Another problem. 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.

Code:
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;
}
Can you please show use the code above the "else if" statement? Namely the original first "if" statement.


(05-07-2013, 12:08 PM)Neocrypt Wrote:  And is there a way to make him avoid picking objects?
Well, if the script you are working isn't an extension for a main AI - a brand new AI where you even control walking and stuff-, it won't pick items by default.

[Image: signature.png]
A-Engine: A new beat em up game engine inspired by LF2. Coming soon

A-Engine Dev Blog - Update #8: Timeout

Reply
Thanks given by:


Messages In This Thread
RE: How to: script Artificial Intelligence - by A-Man - 05-07-2013, 02:54 PM



Users browsing this thread: 1 Guest(s)