EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Bots (https://www.eqemulator.org/forums/forumdisplay.php?f=676)
-   -   Newb fix for #bot healrotation (https://www.eqemulator.org/forums/showthread.php?t=39914)

kilst87 08-07-2015 03:37 AM

Newb fix for #bot healrotation
 
I've spent a bit of time looking over the healrotation code (admittedly, I don't actually know C++ at all), and I think I've come up with a fix (or at least a partial one).

Replace (bot.cpp):
(in the function Bot::AddHealRotationMember())
Code:

for(int i = 0; i < 3; i++){
at line 12903

with:

Code:

int count = 0;
for (int i = 0; i < MaxHealRotationTargets; i++)
{
    if (_healRotationTargets[i] != 0)
    count++;
}
for(int i = 0; i < count; i++){


The tank/s weren't being set properly after calling AddHealRotationMember(). I'm assuming it's due to trying to set tanks that aren't actually there since the newly added healers would get stuck in the function Bot::AddHealRotationTarget().

I haven't thoroughly tested it, but with 1 tank and 3 healers, I was able to get a chain going, add a new healer, and stop the chain perfectly fine.

kilst87 08-08-2015 10:23 PM

Edit: Actually that doesn't work after lots more testing.

Instead, replace the whole loop:

Code:

for(int i = 0; i < 3; i++){
    healer->ClearHealRotationMembers();
    healer->ClearHealRotationTargets();
    healer->AddHealRotationTarget(entity_list.GetMob(_healRotationTargets[i]));
}

starting at line at line 12903

with:

Code:

for (int i = 0; i < MaxHealRotationTargets; i++)
{
    if (_healRotationTargets[i] != 0)
        healer->AddHealRotationTarget(entity_list.GetMob(_healRotationTargets[i]));
}

Only problem now is that healers only switch tanks on feign deaths that fail

Re-Edit:

Code:

Mob* Bot::GetHealRotationTarget( ) {
    Mob* tank = nullptr;
    Mob* first = nullptr;
    Mob* target = nullptr;
    int removeIndex = 0;
    for(int i = 0; i < MaxHealRotationTargets; i++) {
            if(_healRotationTargets[i] != 0) {
                    target = entity_list.GetMob(_healRotationTargets[i]);
                    if(target) {
                            if(target->GetZoneID() == GetZoneID() && (!(target->GetAppearance() == eaDead) && !(target->IsClient() && target->CastToClient()->GetFeigned()))) {
                                    if(!first)
                                            first = target;

                                              Etc, etc.......
}

Bolded line is the line in question.

And that should fix the feign death bug. Tested, but not very thoroughly.


All times are GMT -4. The time now is 02:55 AM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.