• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

TFS 1.X+ TFS 1.4.2 - Attackspeed change

Mjmackan

Mapper ~ Writer
Joined
Jul 18, 2009
Messages
1,474
Solutions
17
Reaction score
194
Location
Sweden
Hello!

I exchanged my version of an old buggy TFS 1.4 to Gesiors 1.4.2 thinking that attackspeed and stuff would be working in another way.

What i thought/wished for: You can set attackspeed onto any item and the attackspeed you set reduces the players attackspeed when item is worn in main eq.

Example of how i want it to be:
-Player with 1000ms attackspeed puts on sword with 120ms atk-spd reduction & ring with 40ms atk-spd reduction.
-Players attackspeed sets to 840ms.

How it seems to work: The attackspeed you set (only on weapon) is the attackspeed the players recieves, you can set attackspeed onto other items but it wont affect the character.

Example of how it is:
-Player with 1000ms attackspeed puts on sword with 120ms atk-spd reduction & ring with 40ms atk-spd reduction.
-Players attackspeed sets to 120ms.

I guess this is the lines im looking for, but how would I achieve checking for example if a ring has attackspeed and then reduce the vocation attackspeed?
Player.cpp:
C++:
uint32_t Player::getAttackSpeed() const
{
    const Item* weapon = getWeapon(true);
    if (!weapon || weapon->getAttackSpeed() == 0) {
        return vocation->getAttackSpeed();
    }

    return weapon->getAttackSpeed();
}
 
Solution
Hello!

I exchanged my version of an old buggy TFS 1.4 to Gesiors 1.4.2 thinking that attackspeed and stuff would be working in another way.

What i thought/wished for: You can set attackspeed onto any item and the attackspeed you set reduces the players attackspeed when item is worn in main eq.

Example of how i want it to be:
-Player with 1000ms attackspeed puts on sword with 120ms atk-spd reduction & ring with 40ms atk-spd reduction.
-Players attackspeed sets to 840ms.

How it seems to work: The attackspeed you set (only on weapon) is the attackspeed the players recieves, you can set attackspeed onto other items but it wont affect the character.

Example of how it is:
-Player with 1000ms attackspeed puts...
Hello!

I exchanged my version of an old buggy TFS 1.4 to Gesiors 1.4.2 thinking that attackspeed and stuff would be working in another way.

What i thought/wished for: You can set attackspeed onto any item and the attackspeed you set reduces the players attackspeed when item is worn in main eq.

Example of how i want it to be:
-Player with 1000ms attackspeed puts on sword with 120ms atk-spd reduction & ring with 40ms atk-spd reduction.
-Players attackspeed sets to 840ms.

How it seems to work: The attackspeed you set (only on weapon) is the attackspeed the players recieves, you can set attackspeed onto other items but it wont affect the character.

Example of how it is:
-Player with 1000ms attackspeed puts on sword with 120ms atk-spd reduction & ring with 40ms atk-spd reduction.
-Players attackspeed sets to 120ms.

I guess this is the lines im looking for, but how would I achieve checking for example if a ring has attackspeed and then reduce the vocation attackspeed?
Player.cpp:
C++:
uint32_t Player::getAttackSpeed() const
{
    const Item* weapon = getWeapon(true);
    if (!weapon || weapon->getAttackSpeed() == 0) {
        return vocation->getAttackSpeed();
    }

    return weapon->getAttackSpeed();
}
instead return weapon->getAttackSpeed();
Do something like this (send it to gpt if you want a copy paste because this is a mobile written code for your knowledge and understanding.
int totalAttackSpeed = 0;
For (item : inventory) {
If (item->getAttackSpeed())
totalAttackSpeed += item->getAttackSpeed();

}
return vocation->getAttackSpeed() - totalAttackSpeed

That way lets say we got ring 50ms, armor 100ms, weapon 200 ms and vocational value is 1000

New attack speed going to be 1000 - (50+100+200) =650
 
Solution
instead return weapon->getAttackSpeed();
Do something like this (send it to gpt if you want a copy paste because this is a mobile written code for your knowledge and understanding.
int totalAttackSpeed = 0;
For (item : inventory) {
If (item->getAttackSpeed())
totalAttackSpeed += item->getAttackSpeed();

}
return vocation->getAttackSpeed() - totalAttackSpeed

That way lets say we got ring 50ms, armor 100ms, weapon 200 ms and vocational value is 1000

New attack speed going to be 1000 - (50+100+200) =650
Thank you and here's the final if anyone else would need:

C++:
uint32_t Player::getAttackSpeed() const
{
    int32_t attackSpeedTotal = 0;

    static const slots_t armorSlots[] = {CONST_SLOT_HEAD, CONST_SLOT_NECKLACE, CONST_SLOT_ARMOR, CONST_SLOT_LEGS, CONST_SLOT_FEET, CONST_SLOT_RING};
    for (slots_t slot : armorSlots) {
        Item* inventoryItem = inventory[slot];
        if (inventoryItem) {
            attackSpeedTotal += inventoryItem->getAttackSpeed();
        }
    }
    return vocation->getAttackSpeed() - attackSpeedTotal;
}
 
Back
Top