• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Compiling [TFS 1.x] Rapid Attack Speed Corrupted

primate

Member
Joined
Apr 14, 2009
Messages
68
Solutions
1
Reaction score
5
Location
Colombia, Medellín.
I wish the attack will not stop when I'm moving.

Example;
https://gfycat.com/RashClearcutGannet

Code:
void Player::doAttacking(uint32_t)
{
    if (lastAttack == 0) {
        lastAttack = OTSYS_TIME() - getAttackSpeed() - 1;
    }

    if (hasCondition(CONDITION_PACIFIED)) {
        return;
    }

    if ((OTSYS_TIME() - lastAttack) >= getAttackSpeed()) {
        bool result = false;

        Item* tool = getWeapon();
        const Weapon* weapon = g_weapons->getWeapon(tool);
        if (weapon) {
            result = weapon->useWeapon(this, tool, attackedCreature);
            SchedulerTask* task = createSchedulerTask(getAttackSpeed(), std::bind(&Game::checkCreatureAttack, &g_game, getID()));
            setNextActionTask(task);
        } else {
            result = Weapon::useFist(this, attackedCreature);
        }

        if (result) {
            lastAttack = OTSYS_TIME();
        }
    }
}

Thank you very much for your valuable time!
 
@MatheusMkalo I tried as you told me but the fast attack only works if I move, In this way it works as if you removed the next 2 lines. https://github.com/otland/forgottenserver/blob/master/src/player.cpp#L1212-L1213

I removed OTSYS_TIME()
Code:
void Player::doAttacking(uint32_t)
{
    if (lastAttack == 0) {
        lastAttack =  - getAttackSpeed() - 1;
    }

    if (hasCondition(CONDITION_PACIFIED)) {
        return;
    }

    if ((getAttackSpeed() - lastAttack) >= getAttackSpeed()) {
        bool result = false;

        Item* tool = getWeapon();
        const Weapon* weapon = g_weapons->getWeapon(tool);
        if (weapon) {
            result = weapon->useWeapon(this, tool, attackedCreature);
            SchedulerTask* task = createSchedulerTask(getAttackSpeed(), std::bind(&Game::checkCreatureAttack, &g_game, getID()));
            setNextActionTask(task);
        } else {
            result = Weapon::useFist(this, attackedCreature);
            SchedulerTask* task = createSchedulerTask(getAttackSpeed(), std::bind(&Game::checkCreatureAttack, &g_game, getID()));
            setNextActionTask(task);
        }

        if (result) {
            lastAttack = getAttackSpeed();
        }
    }
}
But the same thing happens again https://gfycat.com/JampackedPossibleDouglasfirbarkbeetle

If I remove these lines the fast attack does not work
Code:
       SchedulerTask* task = createSchedulerTask(getAttackSpeed(), std::bind(&Game::checkCreatureAttack, &g_game, getID()));
            setNextActionTask(task);

Thanks for your time~
 
Back
Top