Lowering the engage time after mob's death

Post Reply
nidhogg
Posts: 4
Joined: Wed Sep 03, 2014 6:59 pm

Lowering the engage time after mob's death

Post by nidhogg » Wed Apr 20, 2016 11:27 am

Hello!
Is there a way to lower the time needed to engage a new target after killing one?

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: Lowering the engage time after mob's death

Post by whasf » Fri Apr 22, 2016 9:27 pm

Isn't that client side enforced? I'm not finding anything in the project about any delay..
-- Whasf

Avatarati
Posts: 53
Joined: Mon Jun 30, 2014 2:51 pm

Re: Lowering the engage time after mob's death

Post by Avatarati » Sat Apr 23, 2016 2:21 am

Look in src->map->ai->controllers->player_controller.cpp


Find this:

Code: Select all

        if (distance(PChar->loc.p, PTarget->loc.p) < 30)
        {
            if (m_LastAttackTime + std::chrono::milliseconds(PChar->GetWeaponDelay(false)) < server_clock::now())
            {
                if (CController::Engage(targid))
                {
                    PChar->PLatentEffectContainer->CheckLatentsWeaponDraw(true);
                    PChar->pushPacket(new CLockOnPacket(PChar, PTarget));
                    return true;
                }
            }
            else
            {
                errMsg = std::make_unique<CMessageBasicPacket>(PChar, PTarget, 0, 0, MSGBASIC_WAIT_LONGER);
            }
        }
And alter it to take away the delay:

Code: Select all

        if (distance(PChar->loc.p, PTarget->loc.p) < 30)
        {
            if (m_LastAttackTime < server_clock::now()) //TAKE AWAY THE + std::chrono::milliseconds(PChar->GetWeaponDelay(false))
            {
                if (CController::Engage(targid))
                {
                    PChar->PLatentEffectContainer->CheckLatentsWeaponDraw(true);
                    PChar->pushPacket(new CLockOnPacket(PChar, PTarget));
                    return true;
                }
            }
            else
            {
                errMsg = std::make_unique<CMessageBasicPacket>(PChar, PTarget, 0, 0, MSGBASIC_WAIT_LONGER);
            }
        }
        else
        {
            errMsg = std::make_unique<CMessageBasicPacket>(PChar, PTarget, 0, 0, MSGBASIC_TOO_FAR_AWAY);
        }

Post Reply