Thanks again everyone for the help so far. My bots are now attacking, but I have a new an interesting defect - They are indestructible!
Their HP is way too high, based on the code. Here is an example:
1. According to GenerateBaseStats in bot.cpp, an Ogre Warrior adds 97 STA to base
1. According to client_mods.cpp, the class level factor for a level 20 warrior is 220.
2. According to the bots table, the STA of the character in question is 75 (no equipment at all)
3. According to the fixed bots.cpp GenerateBaseHitPoints method, the base HP should be:
Code:
int32 Bot::GenerateBaseHitPoints()
{
// Calc Base Hit Points
int new_base_hp = 0;
uint32 lm = GetClassLevelFactor();
uint32 Post255;
if ((GetSTA() - 255) / 2 > 0)
Post255 = (GetSTA() - 255) / 2;
else
Post255 = 0;
new_base_hp = (5) + (GetLevel()*lm / 10) + (((GetSTA() - Post255)*GetLevel()*lm / 3000)) + ((Post255*GetLevel())*lm / 6000);
this->base_hp = new_base_hp;
return new_base_hp;
}
4. In our case, the formula ends up being:
5 + (20 * 220 / 10) + (97 * 20 * 220 / 3000) + (0 * 20 * 220 / 6000)
Which is:
5 + 440 + 142 + 0
So I would expect this naked, level 20, ogre warrior to have 587 HP.
But when my level 20 character does a "#bot create Name 1 10 male" to create a naked, level 20, ogre warrior, the bots table shows a HP value of 716588 for that bot.
In fact every bot I create has HP in the 710000 order of magnitude. Because there is some variation between bots, I'm guessing that the above calculations are being considered, but I'm also guessing that something outside of the code I'm seeing is affecting the final value (or I'm mis-reading the calculation above).
I've walked through about as much as the code as I can easily see (including everything off of the #bot create constructor), but I don't see anything else that should modify the HP value. Since the value is wrong in the DB before spawning, I didn't look at anything except the create constructor and its related code.
Any ideas?
Thanks for any help!