Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Few questioins about AI script
#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:


Messages In This Thread
Few questioins about AI script - by TheRoot - 05-06-2014, 02:35 PM
RE: Few questioins about AI script - by A-Man - 05-06-2014, 04:34 PM
RE: Few questioins about AI script - by TheRoot - 05-06-2014, 05:05 PM
RE: Few questioins about AI script - by A-Man - 05-06-2014, 05:40 PM
RE: Few questioins about AI script - by TheRoot - 05-07-2014, 10:49 PM



Users browsing this thread: 1 Guest(s)