PDA

View Full Version : Number of bots spawnable by level?


Trackye
09-18-2015, 12:09 AM
First off Sorry I initially posted this in the features section.
I misunderstood it as a feature I would like :( not sure how to delete the thread now.

My request was this.

Could someone point me in the right direction for making something like this work.

Level 1 can spawn 1 bot.
level 10 can spawn 2 bots
level 20 can spawn 3 bots
level 30 can spawn 4 bots
level 40 can spawn 5 bots.
level 65 can spawn a full raid worth of bots.


If jumping to a raid isnt possible thats not an issue 5 is fine.

I am just unsure how to go about making this work. I am assuming it has something to do with quest globals but am at a loss.

Thanks in advance.

Kingly_Krab
09-18-2015, 12:48 AM
You can do this based on a custom method. Add this at the bottom of bot.cpp: uint8 Bot::GetMaxBots(uint8 level) {
if (level >= 1 && level <= 9)
return 1;
else if (level >= 10 && level <= 19)
return 2;
else if (level >= 20 && level <= 29)
return 3;
else if (level >= 30 && level <= 39)
return 4;
else if (level >= 40 && level <= 64)
return 5;
else if (level >= 65)
return 71;
}

Add this in bot.h: uint8 GetMaxBots(uint8 level);

And change this line: if(spawnedBotCount >= RuleI(Bots, SpawnBotCount) && !c->GetGM())

To this: if(spawnedBotCount >= GetMaxBots(c->GetLevel()) && !c->GetGM())

Trackye
09-18-2015, 01:31 AM
Thank you for the expedited reply!

Adding those to the files gave me this on compile?

Error 481 error C2352: 'Bot::GetMaxBots' : illegal call of non-static member function C:\PATH\zone\bot.cpp 9157 1 zone

I added it at the end of Bot.cpp so it shows like this.

auto say_link = linker.GenerateLink();
return say_link;
}
uint8 Bot::GetMaxBots(uint8 level) {
if (level >= 1 && level <= 9)
return 1;
else if (level >= 10 && level <= 19)
return 2;
else if (level >= 20 && level <= 29)
return 3;
else if (level >= 30 && level <= 39)
return 4;
else if (level >= 40 && level <= 64)
return 5;
else if (level >= 65)
return 71;
}
#endif

Kingly_Krab
09-18-2015, 02:11 AM
Try changing it to this in the bot.h: static uint8 GetMaxBots(uint8 level);

Edit: Just so you're aware, the code I'm giving you is untested, meaning I haven't tried it myself, just wrote it from my head as you requested.

Trackye
09-18-2015, 08:16 AM
So after making that second change.


It seems to be working!

Ill repost here after some more testing. leveling and such.

Thank you very much for the assistance Kingly.

Kingly_Krab
09-18-2015, 11:52 AM
You're welcome.