Thread: Cleric Mercs
View Single Post
  #1  
Old 07-25-2019, 09:56 PM
dclarkpf
Fire Beetle
 
Join Date: Jul 2005
Location: Grants Pass, Or
Posts: 20
Default Cleric Mercs

Cleric mercs are a bit broken atm. They start healing the second someone takes any damage. I'm posting this here, because I've fixed them on my server. It's really easy. Here's how to do it.

Go in to the attack.cpp file. Find the
Mob::AddToHateList function.

Change the
Code:
    if (other->IsMerc()) {
        if (other->CastToMerc()->GetMercOwner() && other->CastToMerc()->GetMercOwner()->CastToClient()->GetFeigned()) {
            AddFeignMemory(other->CastToMerc()->GetMercOwner()->CastToClient());
        }
        else {
            if (!hate_list.IsEntOnHateList(other->CastToMerc()->GetMercOwner()))
                hate_list.AddEntToHateList(other->CastToMerc()->GetMercOwner(), 0, 0, false, true);
            // if mercs are reworked to include adding 'this' to owner's xtarget list, this should reflect bots code above
        }
    } //MERC
to

Code:
    // if other is a merc, add the merc client to the hate list
    if (other->IsMerc()) {
        if (other->CastToMerc()->GetMercOwner() && other->CastToMerc()->GetMercOwner()->CastToClient()->GetFeigned()) {
            AddFeignMemory(other->CastToMerc()->GetMercOwner()->CastToClient());
        }
        else {
            if (!hate_list.IsEntOnHateList(other->CastToMerc()->GetMercOwner()))
                hate_list.AddEntToHateList(other->CastToMerc()->GetMercOwner(), 0, 0, false, true);
            // if mercs are reworked to include adding 'this' to owner's xtarget list, this should reflect bots code above
        }
        AI_Event_Engaged(other, iYellForHelp);
    } //MERC
You are only adding one line there. The AI_Event_Engaged line. That's all there is to it.

You can also modify when they start healing in the merc.cpp file.
Code:
                                int8 numToHeal = g->GetNumberNeedingHealedInGroup(IsEngaged() ? 50 : 85, true);
                                int8 checkHPR = IsEngaged() ? 50 : 85;
                                int8 checkPetHPR = IsEngaged() ? 50 : 85;
As you can see I've got mine set to heal at 50% if they are in combat, and 85% if the group is out of combat. The first line finds out how many people in the group need heals. The second line sets at what health ratio to heal those people, and the last line sets the ratio to heal pets at. I hope this helps you guys...
Reply With Quote