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

Upgrade weapon, cant upgrade distance weapons

SixNine

Active Member
Joined
Dec 12, 2018
Messages
442
Reaction score
40
tfs 1.2
Hello so im using stones that upgrades your weapon by adding some attack. But for some reason it doesnt allow to upgrade distanced weapons and not sure how to edit the code, but i know that its this code part

Lua:
    local itemAttack = targetItem:getAttack()
    local itemDefense = targetItem:getDefense()
    if ((upgradeItem.addAttack and upgradeItem.addAttack > 0) and itemAttack <= 0) or ((upgradeItem.addDefense and upgradeItem.addDefense > 0) and itemDefense <= 0) then
        player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("Item %s upgrades only weapons.", item:getName()))
        return true
    end
 
Show full script so we can help you
Cant really send the full script but i can try to send all parts that might be related
Lua:
    local upgradeItem = config.items[item.itemid]
    if not upgradeItem then
        return true
    end
Lua:
   local itemAttack = targetItem:getAttack()
    local itemDefense = targetItem:getDefense()
    if ((upgradeItem.addAttack and upgradeItem.addAttack > 0) and itemAttack <= 0) or ((upgradeItem.addDefense and upgradeItem.addDefense > 0) and itemDefense <= 0) then
        player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("Item %s upgrades only weapons.", item:getName()))
        return true
    end
Lua:
    if itemAttack > 0 then target:setAttribute(ITEM_ATTRIBUTE_ATTACK, itemAttack + (newLevel * upgradeItem.addAttack)) end
if itemDefense > 0 then target:setAttribute(ITEM_ATTRIBUTE_DEFENSE, itemDefense + (newLevel * upgradeItem.addDefense)) end
 
Back
Top