PDA

View Full Version : Enabling new race/class combinations for bots


TylerBarnes
12-16-2013, 03:08 PM
On the server I'm working on I have enabled new race/class combinations for players that I thought always should have existed on live, but when I was testing my bots, they weren't reflected on them. So after some Googling I didn't find much to go on as far as enabling new race/class combinations.
That's when I turned to the code in c:/EQ/Source/zone/bots.cpp.
Just as a warning, don't change anything else. If you accidently delete a chunk then exit without saving and start over. This code tells the bots how to function and one wrong character in it and it could completely break your bots.

I scrolled down to find the following:
case 1: // Human
switch(GetClass()) {
case 1: // Warrior
case 2: // Cleric
case 3: // Paladin
case 4: // Ranger
case 5: // Shadowknight
case 6: // Druid
case 7: // Monk
case 8: // Bard
case 9: // Rogue
case 11: // Necromancer
case 12: // Wizard
case 13: // Magician
case 14: // Enchanter
This is just a piece I copied from the text. It'll have one for each race. This is humans (race 1). The writer of this code was kind enough to label it for us, but if for some weird reason yours isn't labeled then the race/class numbers match the bot race/class numbers (which are actually the same for character race/class id's).
You'll notice shaman, beastlord and berserker aren't listed here. It's because they're not playable by default. To enable them simply add them to each race. On my server humans will be able to be any class, so mine looks like this
case 1: // Human
switch(GetClass()) {
case 1: // Warrior
case 2: // Cleric
case 3: // Paladin
case 4: // Ranger
case 5: // Shadowknight
case 6: // Druid
case 7: // Monk
case 8: // Bard
case 9: // Rogue
case 10: // Shaman
case 11: // Necromancer
case 12: // Wizard
case 13: // Magician
case 14: // Enchanter
case 15: // Beastlord
case 16: // Berserker
Now you see shaman, beastlord and berserker have been added. Don't touch the code around this because this chunk is incomplete without the beginning and closing code it won't know when to stop, thereby breaking the script. You'll need to only add case 10, 15, and 16. I'm not sure if they need to be in order but I did it just to be safe.
Once you've added the classes to each race and feel happy with it you'll need to recompile zone and copy the file over.

If you don't feel comfortable editing code yet, do what I did and just look it over without editing it.

I really have minimal knowledge of this kind of scripting so I don't feel comfortable writing new script, but this process I worked for me.
If anyone has anything to add, maybe with more experience, then please do.

TylerBarnes
12-16-2013, 03:11 PM
You may also want to back up bots.cpp before you go changing it just to be safe.

Uleat
12-16-2013, 03:40 PM
A few things about customizing that you may want to do...

If you make a mistake, you can always revert a file to the base copy. But, doing so will lose any changes that you've made.

Also, if the file that you are making is updated, and if you want to stay up-to-date, you will need to learn how to incorporate those changes.


- Consider putting remarks in your personal code to 'remind' you as to why you did something.
- Either keep a 'diff' of the file(s) that you modify, or keep a unified 'diff' of the modified source code. (This will make updating your server a little easier and keep those 'oops!' moments from happening.)