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

Fast attack

Slafesko

New Member
Joined
Jan 6, 2016
Messages
101
Reaction score
2
I've got problem with attack speed, when someone click on a creature with 2nd,3rd promotions (new promotions) the speed increase to be fast as fuck for example if you are attacking a dragon and you hit every 1 second with auto clicking you will hit every 0.1 sec.
TFS 0.4
 
Check your vocations.xml..
attackspeed="2000"
attackspeed="100"
 
Well i've changed attack speed at my vocations.xml and every promotion got higher attack speed like 1st promo 600, 2nd 400 and 3rd 200 so i think the problem is with source not with vocations.xml ~.~
@Xikini @TibiaFX, so how can i edit my source?
 
You won't understand until i show you what i mean >.<, what i mean is if i attack every 1 second 1 hit by moving or auto attack by elfbot like auto 1 attack target the speed will be fast as hell as i said before and i know what you mean @EvilSkillz, :S so please help me.
TFS 0.4
Client 8.60
 
<?xml version="1.0" encoding="UTF-8"?>
<vocations>
<vocation id="0" name="None" description="none" needpremium="0" gaincap="5" gainhp="5" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="1" manamultiplier="4.0" attackspeed="100" soulmax="100" fromvoc="0" attackable="no">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="1" name="Sorcerer" description="a sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="6" gainhpamount="5" gainmanaticks="3" gainmanaamount="5" manamultiplier="1.1" attackspeed="2000" soulmax="100" fromvoc="1">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="2" name="Druid" description="a druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="6" gainhpamount="5" gainmanaticks="3" gainmanaamount="5" manamultiplier="1.1" attackspeed="2000" soulmax="100" fromvoc="2">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="3" name="Paladin" description="a paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="4" gainhpamount="5" gainmanaticks="4" gainmanaamount="5" manamultiplier="1.4" attackspeed="2000" soulmax="100" fromvoc="3">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="4" name="Knight" description="a knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="3" gainhpamount="5" gainmanaticks="6" gainmanaamount="5" manamultiplier="3.0" attackspeed="2000" soulmax="100" fromvoc="4">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="5" name="Master Sorcerer" description="a master sorcerer" needpremium="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="4" gainhpamount="10" gainmanaticks="2" gainmanaamount="10" manamultiplier="1.1" attackspeed="500" soulmax="200" fromvoc="1" lessloss="30">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="6" name="Elder Druid" description="an elder druid" needpremium="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="4" gainhpamount="10" gainmanaticks="2" gainmanaamount="10" manamultiplier="1.1" attackspeed="500" soulmax="200" fromvoc="2" lessloss="30">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="7" name="Royal Paladin" description="a royal paladin" needpremium="1" gaincap="20" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="10" gainmanaticks="3" gainmanaamount="10" manamultiplier="1.4" attackspeed="600" soulmax="200" fromvoc="3" lessloss="30">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="8" name="Elite Knight" description="an elite knight" needpremium="1" gaincap="25" gainhp="15" gainmana="5" gainhpticks="2" gainhpamount="10" gainmanaticks="4" gainmanaamount="10" manamultiplier="3.0" attackspeed="600" soulmax="200" fromvoc="4" lessloss="30">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="9" name="Higher Magician" description="a higher magician" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="4" gainhpamount="10" gainmanaticks="2" gainmanaamount="10" manamultiplier="1.1" attackspeed="350" soulmax="250" fromvoc="5" lessloss="30">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="10" name="Nature Priest" description="a nature priest" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="4" gainhpamount="10" gainmanaticks="2" gainmanaamount="10" manamultiplier="1.1" attackspeed="350" soulmax="250" fromvoc="6" lessloss="30">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="11" name="Holy Archer" description="a holy archer" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="10" gainmanaticks="3" gainmanaamount="10" manamultiplier="1.4" attackspeed="400" soulmax="250" fromvoc="7" lessloss="30">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="12" name="Bloody Barbarian" description="a bloody barbarian" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="8" gainhpamount="10" gainmanaticks="4" gainmanaamount="10" manamultiplier="3.0" attackspeed="450" soulmax="250" fromvoc="8" lessloss="30">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="13" name="Necromancer" description="a necromancer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="4" gainhpamount="10" gainmanaticks="2" gainmanaamount="10" manamultiplier="1.1" attackspeed="200" soulmax="250" fromvoc="9" lessloss="25">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="14" name="Priest" description="a priest" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="4" gainhpamount="10" gainmanaticks="2" gainmanaamount="10" manamultiplier="1.1" attackspeed="200" soulmax="250" fromvoc="10" lessloss="25">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="15" name="Sharp Shooter" description="a sharp shooter" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="10" gainmanaticks="3" gainmanaamount="10" manamultiplier="1.4" attackspeed="275" soulmax="250" fromvoc="11" lessloss="25">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="16" name="Berserker" description="a berserker" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="8" gainhpamount="10" gainmanaticks="4" gainmanaamount="10" manamultiplier="3.0" attackspeed="325" soulmax="250" fromvoc="12" lessloss="25">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
</vocation>
</vocations>
 
TFS checks for an attack on 3 occasions:
  1. When you select a target.
  2. Every 500 ms
  3. When you move
This means, if your attackspeed is below 500 ms. You can only get the full attackspeed by moving or re-selecting target over and over again (like hold target)

You can change the sources to fix this if you want.
It would be something like this:

Basically all you need to do is the following (I have not tested this, so let me know if it works 100% or if there are bugs)

Update the following function:
Code:
void Player::doAttacking(uint32_t)
{
    if(!lastAttack)
        lastAttack = OTSYS_TIME() - getAttackSpeed() - 1;
    else if((OTSYS_TIME() - lastAttack) < getAttackSpeed())
        return;

    if(hasCondition(CONDITION_PACIFIED) && !hasCustomFlag(PlayerCustomFlag_IgnorePacification))
    {
        lastAttack = OTSYS_TIME();
        return;
    }

    Item* item = getWeapon(false);
    if(const Weapon* _weapon = g_weapons->getWeapon(item))
    {
        if(_weapon->interruptSwing() && !canDoAction())
        {
            SchedulerTask* task = createSchedulerTask(getNextActionTime(),
                boost::bind(&Game::checkCreatureAttack, &g_game, getID()));
            setNextActionTask(task);
        }
        else
        {
            if(!_weapon->hasExhaustion() /* || !hasCondition(CONDITION_EXHAUST, EXHAUST_COMBAT))*/ && _weapon->useWeapon(this, item, attackedCreature))
                lastAttack = OTSYS_TIME();

            updateWeapon();
        }
    }
    else if(Weapon::useFist(this, attackedCreature))
        lastAttack = OTSYS_TIME();
}

To the following:
Code:
void Player::doAttacking(uint32_t)
{
  if(!lastAttack)
  lastAttack = OTSYS_TIME() - getAttackSpeed() - 1;
  else if((OTSYS_TIME() - lastAttack) < getAttackSpeed())
  return;

  if(hasCondition(CONDITION_PACIFIED) && !hasCustomFlag(PlayerCustomFlag_IgnorePacification))
  {
  lastAttack = OTSYS_TIME();
  return;
  }

  Item* item = getWeapon(false);
  if(const Weapon* _weapon = g_weapons->getWeapon(item))
  {
  if(_weapon->interruptSwing() && !canDoAction())
  {
  SchedulerTask* task = createSchedulerTask(getAttackSpeed(),
  boost::bind(&Game::checkCreatureAttack, &g_game, getID()));
  setNextActionTask(task);
  }
  else
  {
  if(!_weapon->hasExhaustion() /* || !hasCondition(CONDITION_EXHAUST, EXHAUST_COMBAT))*/ && _weapon->useWeapon(this, item, attackedCreature))
  {
  lastAttack = OTSYS_TIME();
  SchedulerTask* task = createSchedulerTask(getAttackSpeed(),
  boost::bind(&Game::checkCreatureAttack, &g_game, getID()));
  }

  updateWeapon();
  }
  }
  else if(Weapon::useFist(this, attackedCreature))
  {
  lastAttack = OTSYS_TIME();
  SchedulerTask* task = createSchedulerTask(getAttackSpeed(),
  boost::bind(&Game::checkCreatureAttack, &g_game, getID()));
  }
}

(Basically, I added a SchedulerTask that will check if you can attack your target again when your attackspeed cooldown is over.

So if your attackspeed is 300, it will check if you can attack again in 300ms.
(This will only update players, so if you want creatures to have fast attackspeeds or spellcasts this does not work for that)
 
TFS checks for an attack on 3 occasions:
  1. When you select a target.
  2. Every 500 ms
  3. When you move
This means, if your attackspeed is below 500 ms. You can only get the full attackspeed by moving or re-selecting target over and over again (like hold target)

You can change the sources to fix this if you want.
It would be something like this:

Basically all you need to do is the following (I have not tested this, so let me know if it works 100% or if there are bugs)

Update the following function:
Code:
void Player::doAttacking(uint32_t)
{
    if(!lastAttack)
        lastAttack = OTSYS_TIME() - getAttackSpeed() - 1;
    else if((OTSYS_TIME() - lastAttack) < getAttackSpeed())
        return;

    if(hasCondition(CONDITION_PACIFIED) && !hasCustomFlag(PlayerCustomFlag_IgnorePacification))
    {
        lastAttack = OTSYS_TIME();
        return;
    }

    Item* item = getWeapon(false);
    if(const Weapon* _weapon = g_weapons->getWeapon(item))
    {
        if(_weapon->interruptSwing() && !canDoAction())
        {
            SchedulerTask* task = createSchedulerTask(getNextActionTime(),
                boost::bind(&Game::checkCreatureAttack, &g_game, getID()));
            setNextActionTask(task);
        }
        else
        {
            if(!_weapon->hasExhaustion() /* || !hasCondition(CONDITION_EXHAUST, EXHAUST_COMBAT))*/ && _weapon->useWeapon(this, item, attackedCreature))
                lastAttack = OTSYS_TIME();

            updateWeapon();
        }
    }
    else if(Weapon::useFist(this, attackedCreature))
        lastAttack = OTSYS_TIME();
}

To the following:
Code:
void Player::doAttacking(uint32_t)
{
  if(!lastAttack)
  lastAttack = OTSYS_TIME() - getAttackSpeed() - 1;
  else if((OTSYS_TIME() - lastAttack) < getAttackSpeed())
  return;

  if(hasCondition(CONDITION_PACIFIED) && !hasCustomFlag(PlayerCustomFlag_IgnorePacification))
  {
  lastAttack = OTSYS_TIME();
  return;
  }

  Item* item = getWeapon(false);
  if(const Weapon* _weapon = g_weapons->getWeapon(item))
  {
  if(_weapon->interruptSwing() && !canDoAction())
  {
  SchedulerTask* task = createSchedulerTask(getAttackSpeed(),
  boost::bind(&Game::checkCreatureAttack, &g_game, getID()));
  setNextActionTask(task);
  }
  else
  {
  if(!_weapon->hasExhaustion() /* || !hasCondition(CONDITION_EXHAUST, EXHAUST_COMBAT))*/ && _weapon->useWeapon(this, item, attackedCreature))
  {
  lastAttack = OTSYS_TIME();
  SchedulerTask* task = createSchedulerTask(getAttackSpeed(),
  boost::bind(&Game::checkCreatureAttack, &g_game, getID()));
  }

  updateWeapon();
  }
  }
  else if(Weapon::useFist(this, attackedCreature))
  {
  lastAttack = OTSYS_TIME();
  SchedulerTask* task = createSchedulerTask(getAttackSpeed(),
  boost::bind(&Game::checkCreatureAttack, &g_game, getID()));
  }
}

(Basically, I added a SchedulerTask that will check if you can attack your target again when your attackspeed cooldown is over.

So if your attackspeed is 300, it will check if you can attack again in 300ms.
(This will only update players, so if you want creatures to have fast attackspeeds or spellcasts this does not work for that)
I'll try it, so this one will work with any attack speed ? i mean if i do it 100, does it will work every 100 ms ? btw about monsters i can't understand it

EDIT: Unfortunately same attack speed.
 
Last edited:
I'll try it, so this one will work with any attack speed ? i mean if i do it 100, does it will work every 100 ms ? btw about monsters i can't understand it

EDIT: Unfortunately same attack speed.

I'll have to test it myself later.

I know 500 ms is currently the fastest "true" attackspeed you can have.
 
@Flatlander Okey thanks, waiting for your reply.
Edit: One more thing, how can i remove gaining soul from monsters? i just need to gain soul by using Token, i already removed gaining soul from XML but still getting soul.
 
Last edited:
Back
Top