• 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+ Weapon that skills Attack Speed (club fighting)

Lopaskurwa

Active Member
Joined
Oct 6, 2017
Messages
877
Solutions
2
Reaction score
49
I'm not sure how to make weapon like this. Maybe there is some attribute which i dont know :D
 
Who told u that i'm starting project where did i mentioned it? I'm just editing tfs for fun without any desires to start project. Or i'm not allowed to make something that i like?
You gave not enough information how to make .lua so with your explanation it should look like this not sure but still its something, didn't tried because it looks like big nonsense
Code:
function onEquip(cid, item, slot)
    local slots = getPlayerSlotItem(cid, slot)
    if slots.itemid ~= item.itemid then
   if isInArray(items, slots.itemid) then
       player:setAttackSpeed
   end
   return true
end

function onDeEquip(cid, item, slot)
   local slots = getPlayerSlotItem(cid, slot)
   if next(slots) then
       if isInArray(items, slots.itemid) then
          player:setAttackSpeed
       end
   end
    return true
end
It's not nosense. Its a pretty close code.
Lua:
function onEquip(cid, item, slot)
       var player = Player(cid)
       player:setAttackSpeed(player:getVocation():getAttackSpeed() - <Value to decrease>)
   return true
end

function onDeEquip(cid, item, slot)
       var player = Player(cid)
     player:setAttackSpeed(player:getVocation():getAttackSpeed())
    return true
end

And about project, even if its for fun, its a project.
 
seems like you're having a hard time grasping what to do and how to use lua, you should read this Programming in Lua (first edition)
your code should look like this
Lua:
local modifier = 100 -- 100 ms attack speed increase
function onEquip(player, item, slot)
    local slotItem = player:getSlotItem(slot)
    -- workaround for a bug in tfs, onEquip gets executed twice
    if slotItem and slotItem.itemid == item.itemid then
        return true
    end
    player:setAttackSpeed(player:getAttackSpeed() - modifier)
    return true
end

function onDeEquip(player, item, slot)
    player:setAttackSpeed(player:getAttackSpeed() + modifier)
    return true
end
 
It's not nosense. Its a pretty close code.
Lua:
function onEquip(cid, item, slot)
       var player = Player(cid)
       player:setAttackSpeed(player:getVocation():getAttackSpeed() - <Value to decrease>)
   return true
end

function onDeEquip(cid, item, slot)
       var player = Player(cid)
     player:setAttackSpeed(player:getVocation():getAttackSpeed())
    return true
end

And about project, even if its for fun, its a project.
seems like you're having a hard time grasping what to do and how to use lua, you should read this Programming in Lua (first edition)
your code should look like this
Lua:
local modifier = 100 -- 100 ms attack speed increase
function onEquip(player, item, slot)
    local slotItem = player:getSlotItem(slot)
    -- workaround for a bug in tfs, onEquip gets executed twice
    if slotItem and slotItem.itemid == item.itemid then
        return true
    end
    player:setAttackSpeed(player:getAttackSpeed() - modifier)
    return true
end

function onDeEquip(player, item, slot)
    player:setAttackSpeed(player:getAttackSpeed() + modifier)
    return true
end
It gives error in console something about player:setAttackSpeed. But probably there is way easer way to skill attack speed, without making lua scrip. So i was looking around other solution and i noticed that items.xml has <attribute key="weaponType" value="club" /> so which is attack speed so if i make item with club attribute it will skill my club (attack speed) so in this situation everything is perfect how i wanted, but there is problem about slot type. So where in source i can change slot type of club weapon. So if i manage to change slot type we can close this thread and everyone will be happy
 
Mmmmmh i think what you are asking now is completely different from above
Yea kinda but its still related with attack speed i just found better way to create weapon that skills attack speed. So i thinking it doesnt worth to create new thread because of this. But yea sorry about that.
 
Code:
local modifier = 1000 -- 100 ms attack speed increase

function onEquip(player, item, slot)
local as = player:getAttackSpeed()
if player:getStorageValue(17000) == -1 then
    local slotItem = player:getSlotItem(slot)
    -- workaround for a bug in tfs, onEquip gets executed twice
    if slotItem and slotItem.itemid == item.itemid then
        return true
    end
    player:setStorageValue(17000, 1)
    player:setAttackSpeed(player:getAttackSpeed() - modifier)
        print(""..as.."")
end
    return true
end

function onDeEquip(player, item, slot)
if player:getStorageValue(17000) == 1 then
    player:setStorageValue(17000, -1)
    player:setAttackSpeed(player:getAttackSpeed() + modifier)
 end
    return true
end
I add storage and now is good with this bug TWICE add
 
Back
Top