• 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!

[OTHire 7.72] Attack Speed problem during movement/runes

Roni123

Hardstyle Never Die < 3 !!!
Joined
Aug 31, 2010
Messages
152
Solutions
1
Reaction score
18
Good Morning,

Dears,

I have problem with OTHire distro TwistedScorpio/OTHire (https://github.com/TwistedScorpio/OTHire).

When I move or use runes during attack by distance weapons then my attack stopping.


Thanks in advance !
Post automatically merged:

Ok for move I have found the solution,

in player.cpp need to change This line
Lua:
setNextAction(OTSYS_TIME() + getStepDuration(dir));
on
Code:
//setNextAction(OTSYS_TIME() + getStepDuration(dir));

But still not working with runes.

OK with runes got it, need to delete some lines in player.cpp and looking as below,

Lua:
void Player::onAttacking(uint32_t interval)
{
    Creature::onAttacking(interval);
}

void Player::doAttacking(uint32_t interval)
{
    if(lastAttack == 0){
        // - 1 to compensate for timer resolution etc.
        lastAttack = OTSYS_TIME() - getAttackSpeed() - 1;
    }

    // Can't attack while pacified
    if(hasCondition(CONDITION_PACIFIED))
    {
        return;
    }

    if((OTSYS_TIME() - lastAttack) >= getAttackSpeed() ){
        Item* tool = getWeapon();
        bool result = false;
        const Weapon* weapon = g_weapons->getWeapon(tool);
        if(weapon){
            result = weapon->useWeapon(this, tool, attackedCreature);
        } else{
            result = Weapon::useFist(this, attackedCreature);
        }

        if(result){
            lastAttack = OTSYS_TIME();
        }
    }
}
 
Last edited:
Do you have a before and after shot of the code you edited to fix runes? or can you be more clear on what exactly you changed in player.cpp
 
Yes, I have. As below :)

Before,

Lua:
void Player::doAttacking(uint32_t interval)
{
    if(lastAttack == 0){
        // - 1 to compensate for timer resolution etc.
        lastAttack = OTSYS_TIME() - getAttackSpeed() - 1;
    }

    // Can't attack while pacified
    if(hasCondition(CONDITION_PACIFIED))
    {
        return;
    }

    if((OTSYS_TIME() - lastAttack) >= getAttackSpeed() ){
        Item* tool = getWeapon();
        bool result = false;
        const Weapon* weapon = g_weapons->getWeapon(tool);
        if(weapon){
            if(!weapon->interruptSwing()){
                result = weapon->useWeapon(this, tool, attackedCreature);
            }
            else if(!canDoAction()){
                uint32_t delay = getNextActionTime();
                SchedulerTask* task = createSchedulerTask(delay, boost::bind(&Game::checkCreatureAttack,       
                    &g_game, getID()));       
                setNextActionTask(task);
            }
            else {
                // If the player is not exhausted OR if the player's weapon
                // does not have hasExhaust, use the weapon.
                if(!hasCondition(CONDITION_EXHAUST_COMBAT))
                {
                    result = weapon->useWeapon(this, tool, attackedCreature);
                }
            }
        }
        else{
            result = Weapon::useFist(this, attackedCreature);
        }

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

After,

Lua:
void Player::doAttacking(uint32_t interval)
{
    if(lastAttack == 0){
        // - 1 to compensate for timer resolution etc.
        lastAttack = OTSYS_TIME() - getAttackSpeed() - 1;
    }

    // Can't attack while pacified
    if(hasCondition(CONDITION_PACIFIED))
    {
        return;
    }

    if((OTSYS_TIME() - lastAttack) >= getAttackSpeed() ){
        Item* tool = getWeapon();
        bool result = false;
        const Weapon* weapon = g_weapons->getWeapon(tool);
        if(weapon){
            result = weapon->useWeapon(this, tool, attackedCreature);
        } else{
            result = Weapon::useFist(this, attackedCreature);
        }

        if(result){
            lastAttack = OTSYS_TIME();
        }
    }
}
 
But you have an option in the config.lua to disable that i think.


This one:

Lua:
-- Distance weapon configuration
-- Should exhaustion and action time be checked for using a distance weapon?
distance_weapon_interrupt_swing = true


-- Wands configuration exhaustion
-- Should exhaustion and action time be checked for using wands?
wands_interrupt_swing = true
 
But you have an option in the config.lua to disable that i think.


This one:

Lua:
-- Distance weapon configuration
-- Should exhaustion and action time be checked for using a distance weapon?
distance_weapon_interrupt_swing = true


-- Wands configuration exhaustion
-- Should exhaustion and action time be checked for using wands?
wands_interrupt_swing = true
I stopped using othire but if i recall correctly then these config options are only suitable for normal attack speeds.
 
Other than the fact that was a feature - OTHire is a mess, you'll be way better off sticking to 1.X and updating it/downgrading the newest branch.
 
Back
Top