PDA

View Full Version : Bot problem or something else ?


provocating
12-09-2011, 11:57 PM
Not sure if this is a BOT problem or something else, with the latest compile of r2086 I noticed that at level 53 I died in Chardok. My necro bot could never seem to pull my corpse. I looked through the code and cast the exact same spell, (ID3) and was immediately able to do it as GM. I even stopped the server, restarted it. I am not sure, it seemed like the necro was showing the casting text, I could see the spell effect....

Here is the BOT code.

else if((summonerlevel > 34) && (summonerlevel < 71)) {
g->members[i]->Say("Attempting to summon %s\'s corpse.", t->GetCleanName());
g->members[i]->CastSpell(3, t->GetID(), 1, -1, -1);
return;
}

lockjaws
12-10-2011, 01:34 PM
out of curiosity could this be related to issues with the bot not being able to get group members via views/functions or bot tables in the database?

have a look check to see if your bot is getting assigned to the correct parts.

only thing i can think of right now.

provocating
12-10-2011, 01:36 PM
When there are no players on, I am going to try to add some diagnostic stuff to the BOT code and see if I can get a little more information.

bad_captain
12-10-2011, 01:55 PM
I did a debug of this, and had the same issue. The problem is that when the spell is cast, it ends up calling Bot::SpellEffect, which calls Mob::SpellEffect


case SE_SummonCorpse:
{
#ifdef SPELL_EFFECT_SPAM
snprintf(effect_desc, _EDLEN, "Summon Corpse: %d", effect_value);
#endif
// can only summon corpses of clients
if(IsClient()) {
Client* TargetClient = 0;
if(this->GetTarget())
TargetClient = this->GetTarget()->CastToClient();
else
TargetClient = this->CastToClient();

// We now have a valid target for this spell. Either the caster himself or a targetted player. Lets see if the target is in the group.
Group* group = entity_list.GetGroupByClient(TargetClient);
if(group) {
if(!group->IsGroupMember(TargetClient)) {
Message(13, "Your target must be a group member for this spell.");
break;
}
}
else {
if(TargetClient != this->CastToClient()) {
Message(13, "Your target must be a group member for this spell.");
break;
}
}

// Now we should either be casting this on self or its being cast on a valid group member
if(TargetClient) {
Corpse *corpse = entity_list.GetCorpseByOwner(TargetClient);
if(corpse) {
if(TargetClient == this->CastToClient())
Message_StringID(4, SUMMONING_CORPSE, TargetClient->CastToMob()->GetCleanName());
else
Message_StringID(4, SUMMONING_CORPSE_OTHER, TargetClient->CastToMob()->GetCleanName());

corpse->Summon(CastToClient(), true, true);
}
else {
// No corpse found in the zone
Message_StringID(4, CORPSE_CANT_SENSE);
}
}
else {
Message_StringID(4, TARGET_NOT_FOUND);
LogFile->write(EQEMuLog::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id);
}
}

break;
}

where it basically just checks to see if the caster is a client and if the target is a client, and if so, does what it is supposed to do. How this worked before for bots is beyond me. I don't see any change to this code that would have caused it to not work correctly.

I'd have to dig a bit deeper, but if anyone else has any ideas, please let me know.

provocating
12-10-2011, 01:58 PM
I had problems getting them to rez like 2 years ago, someone fixed it...now not working again. I can see if I can pull my last source and see what changed.

bad_captain
12-10-2011, 02:06 PM
I imagine just removing the initial IsClient() check would eliminate the issue, as I don't see many NPCs having the summon corpse spell, or at least replace it with a !IsNPC().

But that doesn't answer how it broke in the first place. It's been a long time since I've used #bot corpse summon, so I wouldn't know when would be a good revision to go back and check.

provocating
12-10-2011, 02:10 PM
II loaded up both in Beyond Compare.....there is no difference where that code is, a ton of changes in the file itself, but none there.

provocating
12-10-2011, 02:22 PM
I can confirm it also does not work at level 65.

At level 70, he cast a different spell, I see the different effect. But still no joy. I am baffled now, it possibly is not in the bot code ? If I cast 10042 or cast 3, I get back my corpse.

provocating
01-10-2012, 12:54 AM
I did a debug of this, and had the same issue. The problem is that when the spell is cast, it ends up calling Bot::SpellEffect, which calls Mob::SpellEffect


case SE_SummonCorpse:
{
#ifdef SPELL_EFFECT_SPAM
snprintf(effect_desc, _EDLEN, "Summon Corpse: %d", effect_value);
#endif
// can only summon corpses of clients
if(IsClient()) {
Client* TargetClient = 0;
if(this->GetTarget())
TargetClient = this->GetTarget()->CastToClient();
else
TargetClient = this->CastToClient();

// We now have a valid target for this spell. Either the caster himself or a targetted player. Lets see if the target is in the group.
Group* group = entity_list.GetGroupByClient(TargetClient);
if(group) {
if(!group->IsGroupMember(TargetClient)) {
Message(13, "Your target must be a group member for this spell.");
break;
}
}
else {
if(TargetClient != this->CastToClient()) {
Message(13, "Your target must be a group member for this spell.");
break;
}
}

// Now we should either be casting this on self or its being cast on a valid group member
if(TargetClient) {
Corpse *corpse = entity_list.GetCorpseByOwner(TargetClient);
if(corpse) {
if(TargetClient == this->CastToClient())
Message_StringID(4, SUMMONING_CORPSE, TargetClient->CastToMob()->GetCleanName());
else
Message_StringID(4, SUMMONING_CORPSE_OTHER, TargetClient->CastToMob()->GetCleanName());

corpse->Summon(CastToClient(), true, true);
}
else {
// No corpse found in the zone
Message_StringID(4, CORPSE_CANT_SENSE);
}
}
else {
Message_StringID(4, TARGET_NOT_FOUND);
LogFile->write(EQEMuLog::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id);
}
}

break;
}

where it basically just checks to see if the caster is a client and if the target is a client, and if so, does what it is supposed to do. How this worked before for bots is beyond me. I don't see any change to this code that would have caused it to not work correctly.

I'd have to dig a bit deeper, but if anyone else has any ideas, please let me know.

But the bot is the caster, and the player is in the group with the bot, so the code would work I would think. I am seriously hoping I have time to look at this tomorrow.

bad_captain
01-10-2012, 12:39 PM
I forgot I did a little more testing on this. The part where it actually gets the corpse to summon fails. It just didn't find one even though I was looking at it. I'm in the process of moving my office to the basement so I'm without my server to look further into this right now. Maybe by this weekend if I can get my ethernet rewired by then.

provocating
01-10-2012, 12:41 PM
So what is your best guess on the cause ?

You can actually see the spell cast, so I would not think it would be anywhere in the code for the EqEmulator itself. It would be in the bot code correct ??

bad_captain
01-10-2012, 04:24 PM
GetCorpseByOwner was returning null for no corpse, even though there was one. I never got to step into the code to see where the problem was. I've been pretty busy since before the holidays and forgot about this.

provocating
01-10-2012, 05:39 PM
Is it even slightly possible it is like the corpse summoners in Guild Lobby and the corpse has to be buried ?

bad_captain
01-21-2012, 01:33 AM
I figured out the problem. I will submit a fix this weekend. Basically, it was checking the spell caster's target for corpses, but the caster (necro) had themselves as their target. Since it didn't find a corpse for themselves, nothing happened.

provocating
01-21-2012, 08:50 AM
But from what I saw before, the code in bot.cpp had not changed in months for that code.

Had it changed somewhere else ?