Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Linux Servers

Support::Linux Servers Support forum for Linux EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 02-15-2015, 08:20 PM
vacare
Fire Beetle
 
Join Date: Jan 2015
Posts: 20
Default Bots won't melee attack

Hello again,

So I am loving the bots. I have saved a variety of bots to form parties with my PC character, and they are very smart. The casters work perfectly, buffing and healing and casting spells in combat.

However, none of the physical attackers seem to work. Warrior, rogue, et cetera, never attack. I have given them weapons, and they have equipped those weapons. I have tried every stance available. I have tried using the group attack command as well as just initiating the combat myself (either with an attack or via aggro). But no matter what, the melee folks don't attack.

I'm sure I'm just missing something. Any ideas?

Thanks for any help!
Reply With Quote
  #2  
Old 02-15-2015, 08:58 PM
Nibiuno
Hill Giant
 
Join Date: Mar 2010
Posts: 101
Default

This is due to the hitpoint bug issue/stat issue. You can edit the bot code to hard set their HP based on level, and hard set their stats. I made that change to fix this - I can post the code tomorrow.
Reply With Quote
  #3  
Old 02-15-2015, 09:43 PM
vacare
Fire Beetle
 
Join Date: Jan 2015
Posts: 20
Default

Ahhh, that makes sense. I had noticed when performing a #bot update that the HP were these very large negative numbers.

Yeah! If you don't mind posting the code, that would be awesome! Thanks! It goes in bot.cpp I'm guessing?
Reply With Quote
  #4  
Old 02-16-2015, 05:05 AM
dagulus2
Hill Giant
 
Join Date: Feb 2013
Posts: 220
Default

I have been using the fix in this thread here: http://www.eqemulator.org/forums/showthread.php?t=39013

Not sure if there is a better solution.
Reply With Quote
  #5  
Old 02-16-2015, 08:11 AM
Nibiuno
Hill Giant
 
Join Date: Mar 2010
Posts: 101
Default

Here is what I replaced the entire base hp function with - it makes all bots have the same HP, and the base HP is close to what PCs get. With gear, the base HP doesnt really matter much anyways.
Quote:
int32 Bot::GenerateBaseHitPoints()
{
// MOD - Just make hp level*33 + 5 for bots
// Calc Base Hit Points
int new_base_hp = 0;

new_base_hp =(5)+(GetLevel()*33);

return new_base_hp;
// END MOD
}
Reply With Quote
  #6  
Old 02-16-2015, 06:16 PM
vacare
Fire Beetle
 
Join Date: Jan 2015
Posts: 20
Default

Awesome, thanks, everyone! I'll give this a shot tonight.
Reply With Quote
  #7  
Old 02-16-2015, 07:01 PM
vacare
Fire Beetle
 
Join Date: Jan 2015
Posts: 20
Default

Fantastic. The base hp fix worked like a charm. Thanks so much everyone!
Reply With Quote
  #8  
Old 02-18-2015, 03:05 PM
vacare
Fire Beetle
 
Join Date: Jan 2015
Posts: 20
Default

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!
Reply With Quote
  #9  
Old 02-18-2015, 03:55 PM
dagulus2
Hill Giant
 
Join Date: Feb 2013
Posts: 220
Default

That is the exact same code I am using, and I am not having that issue.

Just created a level 51 ogre warrior to test, and it has 2171 hit points.
Reply With Quote
  #10  
Old 02-18-2015, 03:59 PM
dagulus2
Hill Giant
 
Join Date: Feb 2013
Posts: 220
Default

Having looked further, interestingly, I do have 5 level 1 bots that someone created on the 25th of the 1st that all have 715861 hit points.

Are you upto date with the rest of the code?
Reply With Quote
  #11  
Old 02-18-2015, 04:33 PM
vacare
Fire Beetle
 
Join Date: Jan 2015
Posts: 20
Default

I wasn't! Looks like there there were a couple commits in early February I was missing. I'll integrate those first.

Out of curiosity, I haven't done a database update to a live install yet. I'm guessing the utils/SQL/ stuff is pretty self explanatory - they probably just transform the database in ways necessary to support the commit.

But I also notice that the PEQ files had an update recently. I haven't opened those to see what the SQL looks like, but are those safe to transform a live DB, or do you need to start with a fresh DB for the PEQ SQL to work?

Thanks again!
Reply With Quote
  #12  
Old 02-19-2015, 04:37 PM
vacare
Fire Beetle
 
Join Date: Jan 2015
Posts: 20
Default

Hmm, I compiled the latest source and did all the required DB updates, but brand new bots are still being created with the large HP value.

Failing anything else, I can probably find where that value is getting initialized and correct it myself - but the fact that you're not seeing the issue makes me think my environment is missing something!

Thanks again for the help!
Reply With Quote
  #13  
Old 02-20-2015, 01:47 AM
vacare
Fire Beetle
 
Join Date: Jan 2015
Posts: 20
Default

OK, it's fixed. Don't know if it was the original code, or my faulty transcription, but something about the unsigned ints and bad bounding was causing the number to flip to the high end. I modified the code to the below, and the HP generate correctly:

Code:
int32 Bot::GenerateBaseHitPoints()
{
  int new_base_hp = 0;
  uint32 lm = GetClassLevelFactor();
  uint32 Post255 = 0;
  if (GetSTA() > 255) Post255 = (GetSTA() - 255) / 2;
  new_base_hp = 5 + (GetLevel() * lm / 10) + ((GetSTA() - Post255) * GetLevel() * lm / 3000) + (GetLevel() * lm / 6000);
  return new_base_hp;
}
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:52 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3