Thread: Bot Fixes
View Single Post
  #17  
Old 11-28-2010, 01:42 AM
bad_captain
Developer
 
Join Date: Feb 2009
Location: Cincinnati, OH
Posts: 512
Default

Of course, I'm 45 minutes late. Oh, well.

There was a problem with the preexisting code, where when a buff damages the bot, and there's no caster (it is null), it crashes the zone because the null caster was not checked for in the code. This is when it tries to add the caster to the bot's group members' hate list..

Code:
// Aggro the bot's group members
	if(IsGrouped()) {
		Group *g = GetGroup();
		if(g) {
			for(int i=0; i<MAX_GROUP_MEMBERS; i++) {
				if(g->members[i] && g->members[i]->IsBot() && !g->members[i]->CheckAggro(from)) {
					g->members[i]->AddToHateList(from, 1);
				}
			}
		}
	}
the line should be changed to:
Code:
if(g->members[i] && g->members[i]->IsBot() && from && !g->members[i]->CheckAggro(from)) {

I may not get to it tomorrow, but I'll try to repost the fix with your changes Caryatis soon. Sorry you had to revert the changes.

Interestingly, it brought up another issue I keep forgetting about that was present before any of these changes, but I never got around to looking into it, is that bots sometimes don't go through their complete spell lists when casting buffs. I actually DID have the HP -> Mana spell on my necro bots, but they were not casting them (and I don't think I've ever seen them cast them). I think how the bots iterate through their spells and decide what to cast and on whom needs to be looked at and probably rewritten..
Reply With Quote