Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Few questioins about AI script
#1
How to use my bot randomly blows skills without conditions? Without spam?
Reply
Thanks given by:
#2
Just make use of the "rand()" function:
    AI-Code:
int randomval = rand(100); //returns an int b/w 0 & 100
if (randomval<=20)
    MoveOne();
if (randomval>20 && randomval<=40)
    MoveTwo();
if (randomval>40 && randomval<=60)
    MoveThree();
if (randomval>60 && randomval<=80)
    MoveThree();
if (randomval>80)
    MoveThree();

Of course you will end up having conditions if you don't want it to work awkwardly. The conditions are the base of the whole AI stuff.
[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:
#3
In this case:


if( dist_between(351,500) && same_z_axis() && ( self.mp > 100 ) && ( target.state != 14 ) )
{
DuJ();
return 0;
}



I need to put int randomval = rand(100) inside or outside this function?

To put other command
Reply
Thanks given by:
#4
It doesn't really matter, but best, outside right after the "int ego(){}". This is what it would look like:
[code=AI]
int ego(){
int randomval = rand(100); //returns an int b/w 0 & 100
//....other code here
if( randomval <10 && (dist_between(351,500) && same_z_axis() && ( self.mp > 100 ) && ( target.state != 14 )) )
{
DuJ();
}
return 0;
//....some code here
return 1;
}
[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:
#5
Does not work :/
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)