Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AI script doesn't work
#1
Well, when I use this function only in AI it works normal.
Quote:int ego(){
if (self.hp < 500){
DdJ();
}
return 0;
}

However when I try to add any other function, it runs in the game and is as without AI
It was just what I wanted to configure :'(

Quote:int ego(){
if (self.hp < 500){
DdJ();
}
return 0;
}




if ((target_y - self_y)*(target_y - self_y) < 81) {
if ((self_x - target_x) > 50) {
if ((self_x - target_x) < 300) {
DdA()
}}}


Can you help me with this?
Note: I just started using this system :(
Visit my blog and download characters made by myself: D

http://yajimods.blogspot.com.br
Reply
Thanks given by:
#2
Quote:int ego(){
if (self.hp < 500){
DdJ();
}

if ((target_y - self_y)*(target_y - self_y) < 81) {
if ((self_x - target_x) > 50) {
if ((self_x - target_x) < 300) {
DdA()
}}}

return 0;
}

Try this. Your code must still be within the "int ego" bracket, you put it outside so it wasn't read anymore. ;)

PS: Would you mind reducing the size of your signature a bit, it should be limited to 150-200 pixels. Some people will easily get annoyed if your signature takes up so much space when they scroll through posts. ;)
Quote of the Day f***ing Year (Click to View)
Reply
Thanks given by:
#3
Unfortunately not worked well: /
As for the signature, was decreased
Visit my blog and download characters made by myself: D

http://yajimods.blogspot.com.br
Reply
Thanks given by:
#4
Well, it really depends. What did you try? The way you built the second function, it will only trigger when the target is LEFT of the AI character (regardless of direction he's facing). If you want it to work on both sides, you need to include an "abs" (absolute) function, which will check the general x distance to your character, not only into one direction.

Also: if ((target_y - self_y)*(target_y - self_y) < 81)

This means, if your y distance to the enemy is maximal 9. It's a bit of a tight condition as well (though disregardable when on ground), so maybe you just didnt quite get it to work due to situational circumstances.

Did you test your script with your enemy standing to the right of you? (Plus he needs to have full HP as well.)
Quote of the Day f***ing Year (Click to View)
Reply
Thanks given by:
#5
    AI-Code:
int ego(){
 if (self.hp < 500){
  DdJ();
 }
 
if ((target_y - self_y)*(target_y - self_y) < 81) {
if ((self_x - target_x) > 50) {
if ((self_x - target_x) < 300) {
    DdA()
}}}
 
 return 0;
}


First things first, have you checked the console? (black window that pops up)
It reports error messages there.
If you don't get one when you start LF2 download and use the Debug version of the DLL.

On top of that I'd just like to point out that target_x is incorrect. The correct syntax is target.x.
The same thing goes for self.
Age ratings for movies and games (and similar) have never been a good idea.
One can learn a lot from reinventing wheels.
An unsound argument is not the same as an invalid one.
volatile in C++ does not mean thread-safe.
Do not make APIs unnecessarily asynchronous.
Make C++ operator > again
Trump is an idiot.
Reply
Thanks given by:
#6
Was using the debugger version of the dll lf, however the dll that I used did not show the black window, now I've changed had been easier to identify the problem. :D
Visit my blog and download characters made by myself: D

http://yajimods.blogspot.com.br
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)