First, since we've changed the format of the function in the function declaration in bot.h, we need to change the function definition itself to also match those changes.
So in the bot.cpp, navigate to the "Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage)" function and change the top line to the following...
Code:
void Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage, uint8 textureparam, uint8 helmtextureparam) {
This adds the textureparam and helmtextureparam variable parameters to the function definition itself.
Now we need to modify the function code itself to work with these new parameters and set up the bot the way we want it for additional races. To start with, find the lines that read "this->helmtexture = 0xFF;" and "this->texture = 0xFF;", and comment out both of them. Since we're getting the texture and helmtexture values passed to the function when it's called, we don't need to set them here, and we definitely don't want them to always default to 255 like that.
Next, we need to set the bot object's texture and helmtexture according to the values passed in as parameters from the function call. We also need to make sure that non-standard races have their face entry value set to 0 and their gender value set to 2. So immediately below the two lines you just commented out, and before the "if(this->Save())" line, enter the following (comments are optional)...
Code:
uint16 race = this->GetRace();
if((race > 12) && (race != 128) && (race != 130) && (race != 330) && (race != 522))
{
this->texture = textureparam; // set texture... defaults to 0 if not provided, determined in command process before Spawn was called, else retrieved from active bot that is being respawned
this->helmtexture = textureparam; // for non-standard races, force helmtexture to match texture
this->gender = 2; // for non-standard races, force gender to 2 (neutral/non)
this->luclinface = 0; // for non-standard races, force face to 0
}
else // DrakePhoenix: for standard races, use provided or default textureparam and helmtextureparam, no change to gender or luclinface
{
this->helmtexture = helmtextureparam; // if value was not provided in #bot spawn command, then default is 255, determined in command process before Spawn was called, else retrieved from active bot that is being respawned
this->texture = textureparam; // if value was not provided in #bot spawn command, then default is 255, determined in command process before Spawn was called, else retrieved from active bot that is being respawned
}
Now down a little further you should find a line that reads "entity_list.AddBot(this, true, true);". This is the point at which the bot is actually spawned into the zone and becomes visible to the clients. But for some reason (that I haven't managed to figure out) it refuses to display the correct texture/helmtexture that was used when the Spawn function was called. So we need to force the spawned MOB to update with the correct visual settings. To do this, we make a call to the SendIllusionPacket function. So, after the entity_list update line, and before the LoadPet function call, add in the following (whitespace is optional, but makes it easier to read for later)...
Code:
this->SendIllusionPacket(this->race, this->gender, this->texture, this->helmtexture, this->haircolor, this->beardcolor,
this->eyecolor1, this->eyecolor2, this->hairstyle, this->luclinface, this->beard, 0xFF,
this->drakkin_heritage, this->drakkin_tattoo, this->drakkin_details, this->size);
And that's it! So now save all of your changes (assuming you haven't already, though I hope you've been saving along the way). Then compile the code (right-click on ALL_BUILD, click on Build). Copy the newly changed zone.* files from your build directory to your server directory, and load up your server. If everything went properly, it should be working, and your added races for bots should now be available.
I personally also made changes to the "#bot help" command, and added in a new "#bot help spawn" command with more information about the optional texture and helmtexture parameters, but that isn't necessary, so I'm not going to post how to do that. I also personally made changes to the "#bot hair|face|haircolor|etc..." command to add in options for texture, helmtexture, and size, but that also isn't required, so I will not be posting how to do that.
If you run into any problems, feel free to post a reply asking for help. But please be aware that I am not always active on these forums, and you may not get a very quick response from me. Others might be able to help you as well though, so you still might get some fairly quick help.
Enjoy,
Drake Phoenix