Page 1 of 1

Lowering the engage time after mob's death

Posted: Wed Apr 20, 2016 11:27 am
by nidhogg
Hello!
Is there a way to lower the time needed to engage a new target after killing one?

Re: Lowering the engage time after mob's death

Posted: Fri Apr 22, 2016 9:27 pm
by whasf
Isn't that client side enforced? I'm not finding anything in the project about any delay..

Re: Lowering the engage time after mob's death

Posted: Sat Apr 23, 2016 2:21 am
by Avatarati
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);
        }