View Single Post
  #23  
Old 10-23-2009, 12:46 PM
WildcardX
Developer
 
Join Date: Apr 2003
Posts: 589
Default

Aside from checking your SQL, which sounds like you already have, the only thing I can offer is the following method that actually does the bot zoning:

Code:
// Load and spawn all zoned bots by bot owner character
void Bot::LoadAndSpawnAllZonedBots(Client* botOwner) {
	if(botOwner) {
		if(botOwner->HasGroup()) {
			Group* g = botOwner->GetGroup();
			if(g) {
				uint32 TempGroupId = g->GetID();
				std::string errorMessage;
				std::list<uint32> ActiveBots = Bot::GetGroupedBotsByGroupId(botOwner->GetGroup()->GetID(), &errorMessage);

				if(errorMessage.empty() && !ActiveBots.empty()) {
					for(list<uint32>::iterator itr = ActiveBots.begin(); itr != ActiveBots.end(); itr++) {
						Bot* activeBot = Bot::LoadBot(*itr, &errorMessage);

						if(!errorMessage.empty()) {
							safe_delete(activeBot);
							break;
						}

						if(activeBot) {
							activeBot->Spawn(botOwner, &errorMessage);

							g->UpdatePlayer(activeBot);
							
							if(g->GetLeader())
								activeBot->SetFollowID(g->GetLeader()->GetID());
						}

						if(activeBot && !botOwner->HasGroup())
							database.SetGroupID(activeBot->GetCleanName(), 0, activeBot->GetBotID());
					}
				}

				// Catch all condition for error messages destined for the zone error log
				if(!errorMessage.empty()) {
					// TODO: Log this error message to zone error log
				}
			}
		}
	}
}
The fact that you can see your bot after it zones with you and it has spawned tells me you have gotten to this part of the code...

Code:
if(activeBot) {
							activeBot->Spawn(botOwner, &errorMessage);
so i think for you, its just a matter of something not coming together as expected for the next two statements:

Code:
g->UpdatePlayer(activeBot);
							
							if(g->GetLeader())
								activeBot->SetFollowID(g->GetLeader()->GetID());
If you know how to debug this, then I'd recommend making sure that GetLeader() isn't returning a null value. if it is not, then I'd make sure that the same object returned by GetLeader() isn't returning a value from GetID() that is 0 .

I'll keep thinking on this for you.
__________________
Read my developer notes at my blog.

Quote:
If it's not on IRC, it ain't l33t!
Reply With Quote