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

TFS 1.X+ Tfs 1.3 abilities, AttackSpeed

Ovnyx

Member
Joined
Jul 25, 2017
Messages
163
Solutions
2
Reaction score
7
hi, im using Delusion ability system
i recently add the last abilities delusion add like attackspeed, damagemitigation, supporthealing, etc

i was using this script to test the healregeneration:

Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if target.itemid == 2494 then
        local position = player:getPosition()
        target:setAbility(ITEM_ABILITY_REGENERATION, 1)
        target:setAbility(ITEM_ABILITY_HEALTHGAIN, 500)
        target:setAbility(ITEM_ABILITY_HEALTHTICKS, 0.5)
      

        player:sendCancelMessage("Health upgrade! 500 hp per second")
        position:sendMagicEffect(CONST_ME_MAGIC_RED)
        return true
    end
end
working perfect, now i was trying to figure out how to deal with weapon speed attack with this lua script:

Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if target.itemid == 2446 then
        local position = player:getPosition()
        local percentage = player:getSpeed()*0.15
        target:setAbility(ITEM_ABILITY_SPEEDATTACK, 100)
        player:sendCancelMessage("Speed Attack upgrade!")
        position:sendMagicEffect(CONST_ME_MAGIC_RED)
        return true
    end
    return true
end
as it says it works with MS, i try to test it with 100 ms but its not working, dont know if i need to use another ability or some ability need to have 1 as value, to enable that ability? i already added the item 2446 to the movements.xml file.

thanks in advice!:)
 
Solution
Just looked at my code again, ITEM_ABILITY_ATTACKSPEED is a multiplier, a value above 100 is a positive multiplier, a value below 100 is negative (110 = 10% increase, 90% = 10% decrease).
yea my fall, but still not working with ATTACKSPEED instead of SPEEDATTACK
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if target.itemid == 2446 then
        local position = player:getPosition()
        target:setAbility(ITEM_ABILITY_ATTACKSPEED, 100)
        player:sendCancelMessage("Speed Attack upgrade!")
        position:sendMagicEffect(CONST_ME_MAGIC_RED)
        return true
    end
    return true
end
does speed attack ability add something to the description like regeneration? (faster regeneration), because the script run without error but weapon works the same
 
yea my fall, but still not working with ATTACKSPEED instead of SPEEDATTACK
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if target.itemid == 2446 then
        local position = player:getPosition()
        target:setAbility(ITEM_ABILITY_ATTACKSPEED, 100)
        player:sendCancelMessage("Speed Attack upgrade!")
        position:sendMagicEffect(CONST_ME_MAGIC_RED)
        return true
    end
    return true
end
does speed attack ability add something to the description like regeneration? (faster regeneration), because the script run without error but weapon works the same
Did you re-equip the item? Is the weapon also registered in movements.xml? Did you change this in order to use custom attack speeds?
 
yes i re equipped the sword, and yes i registered at movements.xml
Code:
<!-- Weapons -->
    <movevent event="Equip" itemid="2446" slot="hand" level="65" function="onEquipItem">
        <vocation name="Knight" />
        <vocation name="Elite Knight" showInDescription="0" />
    </movevent>
    <movevent event="DeEquip" itemid="2446" slot="hand" function="onDeEquipItem" />
also im pretty sure i did everything that says Here, because i had to do it a lot of times until my sources compile 😅🤣
 
Weapons that are loaded through weapons.xml will not register abilities
I couldn't find a way to work around this without changing a bunch of shit, so I didn't do anything about it.
 
Weapons that are loaded through weapons.xml will not register abilities
I couldn't find a way to work around this without changing a bunch of shit, so I didn't do anything about it.

😕 so i should create like duplicate weapons and register them in items.xml? or use items that are not "weapons" as weapons in order to be able to register abilities ?
or what was the logic u think to give abilities to a weapons?
 
Just looked at my code again, ITEM_ABILITY_ATTACKSPEED is a multiplier, a value above 100 is a positive multiplier, a value below 100 is negative (110 = 10% increase, 90% = 10% decrease).
 
Last edited:
Solution
so 100 is the base? if the values are below 100 item will attack slower than normal, and every value over 100 will make item attack faster than normal?
how did you test this when you code it? with what item? or what kind of test did you do to figure out it was working? 😅
 
so 100 is the base? if the values are below 100 item will attack slower than normal, and every value over 100 will make item attack faster than normal?
how did you test this when you code it? with what item? or what kind of test did you do to figure out it was working? 😅
I don't remember how I tested, I made this a year ago.
All I know is, I did test everything before committing them to make sure I didn't push an ability that didn't work.
 
I don't remember how I tested, I made this a year ago.
All I know is, I did test everything before committing them to make sure I didn't push an ability that didn't work.
ok np thanks a lot!
hmm while a player is in combat what classes are involved in that "event"? combat, player, weapon, monster(pvm) or player(pvp)??
 
What do you mean by involved? That's too vague to give an answer to.
i mean, what classes of the tfs are realted to each other when the player is in a combat, i want to follow that classes to understand a better how tfs manage this and how it works, so i can understand better your code, and future updates i want to add to my sources.
I don't know if i make myself understood :D
 
i mean, what classes of the tfs are realted to each other when the player is in a combat, i want to follow that classes to understand a better how tfs manage this and how it works, so i can understand better your code, and future updates i want to add to my sources.
I don't know if i make myself understood :D
Just go read the sources and you'll figure out for yourself. Trace a specific function back to what calls it, see where it's called in every place, trace those functions, etc.
 
Just go read the sources and you'll figure out for yourself. Trace a specific function back to what calls it, see where it's called in every place, trace those functions, etc.
as vocation manages speedattack if i change vocation speed when using an object it will affect all the players? o just the one who uses the "object"?
 
Vocation is a default attack speed bound to the character's vocation, getAttackSpeed is a player method, the attack speed of the player will result in whatever is returned by that function. Usually, it's always just the vocation's attack speed, but here it will evaluate attack speed abilities or a set attack speed via player:setAttackSpeed and return those if possible, if not, it will return the vocation default attack speed as usual.

I'm not interested in going on answering every single curiosity you have about the engine's inner workings. If you want to learn, then do so by reading the source code and trying things yourself.
 
Last edited:

Similar threads

Back
Top