• 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 !!!
Premium User
Joined
Aug 31, 2010
Messages
142
Reaction score
9
Location
Gorzów Wielkopolski
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:

Silba

7.6+ is not oldschool
Premium User
Joined
Aug 22, 2013
Messages
226
Solutions
1
Reaction score
151
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
 
OP
Roni123

Roni123

Hardstyle Never Die < 3 !!!
Premium User
Joined
Aug 31, 2010
Messages
142
Reaction score
9
Location
Gorzów Wielkopolski
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();
        }
    }
}
 

Terotrificy

Active Member
Joined
Oct 18, 2020
Messages
146
Solutions
5
Reaction score
44
Location
Santiago, Chile.
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
 

Silba

7.6+ is not oldschool
Premium User
Joined
Aug 22, 2013
Messages
226
Solutions
1
Reaction score
151
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.
 

4Nathu4

valoria.online
Joined
Oct 27, 2009
Messages
225
Solutions
8
Reaction score
126
GitHub
4mrcn4
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.
 
Top