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

Action Perfect items upgrade 2.0 -- Slot sytem

I want to... To put the skill "fist", because into my server's sword are ID "0". How can I addict it into the script?

Thank ya.
 
i have the same problem with the shield, the attack of shield go up

fixed version, not by me, found good on tfs 0.4:

Code:
--- Perfect refine system by Mock the bear (MTB).
--- Email: [email][email protected][/email]
-- &a = weapon attack
-- &d = weapon defense
-- &s = shield defense
-- &p = armor defense
-- # = nivel do item
-- @ = max level
local gain = {
gainArmor='&p+(1)',loseArmor='&p-(1)',
gainShield='&s+#',loseShield='&s-(#+1)',
gainAttack='&a+(1*(#))',loseAttack='&a-(1*(#+1))',
gainDefense='&d+(1*(#))',loseDefense='&d-(1*(#+1))',
chance='(100/math.sqrt((((@/4)+(#*2))/@)*#))',
maxlvl = 17,
blocked_ids = {8881}
}
local it = {
--[itemid] = [percent]
[8306] = 0, -- 0% additional
[8305] = 100, -- 50%
}
if not setItemName then
    function setItemName(uid,name)
        return doItemSetAttribute(uid,'name',name)
    end
    function setItemArmor(uid,name)
        return doItemSetAttribute(uid,'armor',name)
    end
    function setItemDefense(uid,name)
        return doItemSetAttribute(uid,'defense',name)
    end
    function setItemAttack(uid,name)
        return doItemSetAttribute(uid,'attack',name)
    end
    function getItemAttack(uid)
        return getItemAttribute(uid,'attack')
    end
    function getItemDefense(uid)
        return getItemAttribute(uid,'defense')
    end
function getItemArmor(uid)
  if type(uid) == 'number' then
      return getItemAttribute(uid,'armor')
  else
      return getItemInfo(uid.itemid).armor
  end
end
end
local function isArmor(uid) -- Function by Mock the bear.
    if (getItemInfo(uid.itemid).armor ~= 0) and (getItemWeaponType(uid.uid) == 0) then
        return true
    end
    return false
end
local function isWeapon(uid) -- Function by Mock the bear.
    uid = uid or 0
    local f = getItemWeaponType(uid)
    if f == 1 or f == 2 or f == 3 then
        return true
    end
    return false
end
local function isShield(uid) -- Function by Mock the bear.
    uid = uid or 0
    if getItemWeaponType(uid) == 4 then
        return true
    end
    return false
end
local function isBow(uid) -- Function by Mock the bear.
    uid = uid or 0
    if getItemWeaponType(uid) == 5 then
        return true
    end
    return false
end
local function getWeaponLevel(uid) -- Function by Mock the bear.
  uid = uid or 0
  local name = getItemName(uid.uid) or getItemInfo(uid.itemid).name or ''
  local lvl = string.match(name,'%s%+(%d+)%s*')
  return tonumber(lvl) or 0
end
local function doTransform(s,i) -- Function by Mock the bear.
    local c = string.gsub(s,'@',gain.maxlvl)
    local c = string.gsub(c,'&a',(getItemAttack(i.uid) ~= 0 and getItemAttack(i.uid) or getItemInfo(i.itemid).attack))
    local c = string.gsub(c,'&d',(getItemDefense(i.uid) ~= 0 and getItemDefense(i.uid) or getItemInfo(i.itemid).defense))
    local c = string.gsub(c,'&s',(getItemDefense(i.uid) ~= 0 and getItemDefense(i.uid) or getItemInfo(i.itemid).defense))
    local c = string.gsub(c,'&p',(getItemArmor(i.uid) ~= 0 and getItemArmor(i.uid) or getItemInfo(i.itemid).armor))
    local c = string.gsub(c,'#',getWeaponLevel(i))
    local q = assert(loadstring('return '..c))
    return math.floor(assert(q()))
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if item.uid == 0 or item.itemid == 0 then return false end
        toPosition.stackpos = 255
        if isInArray(gain.blocked_ids, itemEx.itemid)
          or (not getItemWeaponType(itemEx.uid) or getItemWeaponType(itemEx.uid) > 5)
          or (getItemWeaponType(itemEx.uid) == 0 and not isArmor(itemEx))
            or itemEx.itemid == 0 or itemEx.type > 1 or isItemStackable(itemEx.uid) then
                doPlayerSendTextMessage(cid,22,"You cant refine this item.")
                return TRUE
        end
        if isCreature(itemEx.uid) == TRUE then
            return FALSE
        end
        local level = getWeaponLevel(itemEx)
        local chance = doTransform(gain.chance,itemEx)
        if level == gain.maxlvl then
            doSendMagicEffect(toPosition, 2)
            return doPlayerSendTextMessage(cid,22,"Your item is on max level, you can't upgrade it.")
        end
        doPlayerSendTextMessage(cid,22,"Trying refine with "..(chance+it[item.itemid] > 100 and 100 or chance+it[item.itemid]).."% of sucess!")
        if chance+it[item.itemid] >= math.random(0,100) then
            local nm = getItemName(itemEx.uid)
            local slot = nm:match('(%[.+%])') or '' ---If you server use slot system dont change it ^^
            slot = slot~='' and ' '..slot or slot
            setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level+1)..slot)
            addEvent(doPlayerSendTextMessage,500,cid,22,"Your item has been upgrated to +"..(level+1)..slot..".")
            doSendMagicEffect(toPosition, 12)
            if isArmor(itemEx) then
                local get = doTransform(gain.gainArmor,itemEx)
                setItemArmor(itemEx.uid,get)
            elseif isBow(itemEx.uid) then
                setItemDefense(itemEx.uid, doTransform(gain.gainDefense,itemEx))
            elseif isWeapon(itemEx.uid) then
                setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
                setItemDefense(itemEx.uid, doTransform(gain.gainDefense,itemEx))
            elseif isShield(itemEx.uid) then
                setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
            end
        else
            if level == 0 then
                addEvent(doPlayerSendTextMessage,500,cid,22,"No effect.")
                doSendMagicEffect(toPosition, 2)
            elseif level > 0 then
            local nm = getItemName(itemEx.uid)
            local slot = nm:match('(%[.+%])') or '' ---If you server use slot system dont change it ^^
                slot = slot~='' and ' '..slot or slot
                if level == 1 then
                    setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..slot)
                    addEvent(doPlayerSendTextMessage,500,cid,22,"Your item back to normal.")
                else
                    setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level-1)..slot)
                    addEvent(doPlayerSendTextMessage,500,cid,22,"Your item back to +"..(level-1)..slot..".")
                end
                if isArmor(itemEx) then
                    setItemArmor(itemEx.uid,doTransform(gain.loseArmor  ,itemEx))
                elseif isWeapon(itemEx.uid) then
                    setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
                    setItemDefense(itemEx.uid, doTransform(gain.loseDefense,itemEx))
                elseif isBow(itemEx.uid) then
                    setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
                elseif isShield(itemEx.uid) then
                    setItemDefense(itemEx.uid, doTransform(gain.loseShield,itemEx))
                end
            end
            doSendMagicEffect(toPosition, 9)
        end
    doRemoveItem(item.uid,1)
    return true
end
 
Last edited:
Hue hue br
How can I addict a fist in the locate of sword? I don't want sword, into my server sword is fist.
 
Its possible to do this with item descriptions, the only thing that would be impossible to replicate would be the armor value. Adding % of the weapon skill could be used to the same extent with alittle abit of tinkering. I'm using this myself as a knight spell to enchant weapons.

dYnYj1A.jpg
 
I'm considering developing an enchantment script similar to this, however i need to finalize the functionality concept. If i just can get a good enought concept i can start writing the script.
 
I'm considering developing an enchantment script similar to this, however i need to finalize the functionality concept. If i just can get a good enought concept i can start writing the script.
doesn't it keep values when weapon with slots is enchanted?
 
I'm not following on what you mean, but the item could hold values with both actionid and descriptions
 
When loading the script:

[30/04/2014 10:42:53] [Error - LuaScriptInterface::loadFile] data/actions/scripts/upgrade.lua:1: unexpected symbol near '['
[30/04/2014 10:42:53] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/upgrade.lua)
[30/04/2014 10:42:53] data/actions/scripts/upgrade.lua:1: unexpected symbol near '['
 
It is possible that each object of a certain attribute?
Example: Legs - HP and MP -- After +10.
Helmet: Skills -- After +10.
Boots: Regeneration per Level -- After +10.
Armor: Experience -- After +10.
so on..
 
Mock...thanks bro awesome scripts, so im new here and i need a script to upgrade unlimited...i only can get +5 so i want get +9999, can you help me bro? for tibia 8.60 !! very thanks!!
 
Back
Top