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

Adding attacked speed to weapon TFS 1.1

strutZ

Australian OT Member {AKA Beastn}
Joined
Nov 16, 2014
Messages
1,391
Solutions
7
Reaction score
550
Hi there otland,

Was just wondering if it is possible to add attack speed to a weapon only? if so how?

Regards,
Beastn.
 
@Evan hey dude i just noticed this error? Its being spammed, However wand still works.

lv97Yqz.png
 
also had the nil value error. i tried to fix it for like 30mins.. but then gave up and remade the entire script.

This works without errors for me [TFS 1.0]
Code:
local combat = {}
local hits = 3 -- default sword attacks per hit is 3
local interval = math.floor(2000 / hits)
for x = 1, hits do
    combat[x] = Combat()
    combat[x]:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

    function damage()
        min = -225
        max = -275
        return min, max
    end
    combat[x]:setCallback(CALLBACK_PARAM_SKILLVALUE, "damage")
end

function onUseWeapon(player, var)
     for x = 1, hits do
         addEvent(function()   combat[x]:execute(player, var) end, x * interval)
     end
     return true
end
 
also had the nil value error. i tried to fix it for like 30mins.. but then gave up and remade the entire script.

This works without errors for me [TFS 1.0]
Code:
local combat = {}
local hits = 3 -- default sword attacks per hit is 3
local interval = math.floor(2000 / hits)
for x = 1, hits do
    combat[x] = Combat()
    combat[x]:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

    function damage()
        min = -225
        max = -275
        return min, max
    end
    combat[x]:setCallback(CALLBACK_PARAM_SKILLVALUE, "damage")
end

function onUseWeapon(player, var)
     for x = 1, hits do
         addEvent(function()   combat[x]:execute(player, var) end, x * interval)
     end
     return true
end
Ahh nice man! thank!! do you know if whilst using this if you "reload items" it crashes the server? its the only problem with the script i'm using. Its just been way down on the priorities list..

Script i use:

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, 1)
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setFormula(COMBAT_FORMULA_SKILL, 0.8, 0, 0.8, 0)

local function addCombat(cid, combat, var)
    local player = Player(cid)
    if not player then
        return false
    end

    if not player:getTarget() then
        return false
    end

    return combat:execute(cid, var)
end

function onUseWeapon(player, var)
    addEvent(addCombat, 1000, player:getId(), combat, var)
    return combat:execute(player, var)
end
 
are you "reload items" while game is online?
i assume reload items is something similar to "reload server"
else i have no idea what are you talking about. i'm quite new for OT slang.

If my assumption is correct, maybe someone had addEvent unfinished and it crashed? [all i could think of]
 
are you "reload items" while game is online?
i assume reload items is something similar to "reload server"
else i have no idea what are you talking about. i'm quite new for OT slang.

If my assumption is correct, maybe someone had addEvent unfinished and it crashed? [all i could think of]

i mean if i type "/reload items" it will reload the items.xml file + scripts so if i make a change to a name or a attribute i can update it without restarting the server. It will be an unfinished event actually.. you answer my question... becuase the "addEvent" in my script is what is making the weapon attack faster.
 
also had the nil value error. i tried to fix it for like 30mins.. but then gave up and remade the entire script.

This works without errors for me [TFS 1.0]
Code:
local combat = {}
local hits = 3 -- default sword attacks per hit is 3
local interval = math.floor(2000 / hits)
for x = 1, hits do
    combat[x] = Combat()
    combat[x]:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

    function damage()
        min = -225
        max = -275
        return min, max
    end
    combat[x]:setCallback(CALLBACK_PARAM_SKILLVALUE, "damage")
end

function onUseWeapon(player, var)
     for x = 1, hits do
         addEvent(function()   combat[x]:execute(player, var) end, x * interval)
     end
     return true
end

Found a problem with my script xD
If you are using melee weapon and you hit the monster, the monster will take the full damage from combat even when you walk away or die in between
It like adds bleed effect.
Its cool and all, but not what i had in mind.
Trying to figure out how to break the loop
 
im working on close range weapons.

EDIT:
I think the answer for me is:
set all the players attack speed 500.
This will be the fastest attack speed person can achieve.
ALL the items will have the Evan's cooldown timer.
Its quite a pickle that it will be checked twice every 1 second and that storage value gona be changing ALL the time for everyone.

But i think it wont even make any difference for game speed (talking about lag)
500ms to think for an answer is more than enough.

And for me it wont be big deal to add that system for all weapons, because well.. i got only 4 weapons in game. lol
 
Last edited:
what error are you getting with the code i posted? that bleed? or the nil?
 
what error are you getting with the code i posted? that bleed? or the nil?
bleed.
Its not an error, its a bug.

You can see for yourself in your own server.
Hit the enemy once and escape from target (You shouldn't be able to hit the second hit, but the combat event has already been set with first hit)
 
bleed.
Its not an error, its a bug.

You can see for yourself in your own server.
Hit the enemy once and escape from target (You shouldn't be able to hit the second hit, but the combat event has already been set with first hit)

ahh!!! i see i didnt even notice that too be honest haha so weird..mmm this is going to annoy me now..
 
Back
Top