So with the recent changes to the AI, it's possible to rewrite the basic AI for characters as well. I present to you, the annoying henry AI. All it does is kite you around
Try beating it with template/bandit. It's easy to beat with characters with projectiles because it doesn't bother defending etc.
Code:
void id(){
// reset all inputs
left(0,0);
right(0,0);
J(0,0);
up(0,0);
down(0,0);
A(0,0);
D(0,0);
for (int i = 0; i < 400; i++)
{
if (loadTarget(i) == 0 && target.num != self.num)
break;
}
int distance = abs(target.x - self.x);
int zdistance = abs(target.z - self.z);
bool jump = false;
if(distance < 300 || self.state == 2 || (target.state == 2 && distance < 350))
{
jump = true;
if (bg_width - self.x < 100)
{
left();
}
else if (self.x < 100)
{
right();
}
else if (target.x > self.x)
{
left();
}
else
{
right();
}
if(self.state == 2 && jump){J();}
}
else{
if (target.x > self.x && self.facing)
{
right(1,1);
}
else if (target.x < self.x && !self.facing)
{
left(1,1);
}
if (target.blink == 0 && target.state != 6 && target.state != 12 && target.state != 14)
{
if (target.z > self.z && zdistance > 10)
{
down();
}
else if(target.z < self.z)
{
up();
}
if (distance < 473)
{
if (zdistance < 10)
{
A();
}
else if (zdistance > 15 && zdistance < 40)
{
if (target.z > self.z)
{
down(1,0);
}
else
{
up();
}
A();
}
}
}
}
}
Try beating it with template/bandit. It's easy to beat with characters with projectiles because it doesn't bother defending etc.
10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.