• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Item's upgrading by jewels ver. 3 [FOR TFS 0.3.6]

hey how to make if want to upgrade item and it faild it will destroy when cant go downgread ?
becous
Code:
 [1] = {successParcent = 60, downrageLevel = 0},
 [2] = {successParcent = 50, downrageLevel = 1},
 [3] = {successParcent = 45, downrageLevel = 2},
 [4] = {successParcent = 40, downrageLevel = 2},
 [5] = {successParcent = 35, downrageLevel = 3},
 [6] = {successParcent = 30, downrageLevel = 3},
 [7] = {successParcent = 25, downrageLevel = 3},
 [8] = {successParcent = 20, downrageLevel = 4},
 [9] = {successParcent = 15, downrageLevel = 4},
 [10] = {successParcent = 10, downrageLevel = 4},
 [11] = {successParcent = 9, downrageLevel = 5},
 [12] = {successParcent = 8, downrageLevel = 5},
 [13] = {successParcent = 7, downrageLevel = 5},
 [14] = {successParcent = 6, downrageLevel = 0},
 [15] = {successParcent = 5, downrageLevel = 0}, 
 [16] = {successParcent = 4, downrageLevel = 0},
 [17] = {successParcent = 3, downrageLevel = 0},
 [18] = {successParcent = 2, downrageLevel = 0},
 [19] = {successParcent = 1, downrageLevel = 0}
when i do it first time and it failed i got error in console and nothing happen.
 
Code:
local conf = {}

conf["level"] = {
-- [item_level] = {successParcent=PARCENT FOR UPGRADING SUCCESS, downrageLevel = IF UPGRADING FAIL - ITEM WAS DECRASED TO LEVEL HERE}
 [1] = {successParcent = 60, downrageLevel = 0},
 [2] = {successParcent = 50, downrageLevel = 1},
 [3] = {successParcent = 45, downrageLevel = 2},
 [4] = {successParcent = 40, downrageLevel = 2},
 [5] = {successParcent = 35, downrageLevel = 3},
 [6] = {successParcent = 30, downrageLevel = 3},
 [7] = {successParcent = 25, downrageLevel = 3},
 [8] = {successParcent = 20, downrageLevel = 4},
 [9] = {successParcent = 15, downrageLevel = 4},
 [10] = {successParcent = 10, downrageLevel = 4},
 [11] = {successParcent = 9, downrageLevel = 5},
 [12] = {successParcent = 8, downrageLevel = 5},
 [13] = {successParcent = 7, downrageLevel = 5},
 [14] = {successParcent = 6, downrageLevel = 0},
 [15] = {successParcent = 5, downrageLevel = 0}, 
 [16] = {successParcent = 4, downrageLevel = 0},
 [17] = {successParcent = 3, downrageLevel = 0},
 [18] = {successParcent = 2, downrageLevel = 0},
 [19] = {successParcent = 1, downrageLevel = 0}

}
conf["upgrade"] = { -- how many parcent attributes are rised?
    attack = 1, -- attack %
    extraAttack = 2, -- extra Attack %
    defense = 1, -- defence %
    extraDefense = 2, -- extra defence %
    armor = 1, -- armor %
    hitChance = 1, -- hit chance %
}

-- // do not touch // -- 
-- Upgrading system v.3.1 by Azi [Ersiu] --
local upgrading = {
    upValue = function (value, level, parcent)
        if(not(value>0))then return 0 end 
        for i=1,level do
            value = math.ceil(((value/100)*parcent)+value)+1
        end
        return (value > 0) and value or 0
    end,

    getLevel = function (item)
        local name = string.explode(getItemName(item), '+')
        return (#name == 1) and 0 or math.abs(name[2])
    end,
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local getItem = getItemInfo(itemEx.itemid)
    if((getItem.weaponType > 0 or getItem.armor > 0) and not isItemStackable(itemEx.itemid))then
        local level = upgrading.getLevel(itemEx.uid)
        if(level < #conf["level"])then
            local nLevel = (conf["level"][(level+1)].successParcent >= math.random(1,100)) and (level+1) or conf["level"][level].downrageLevel
            if(nLevel > level)then
                doSendMagicEffect(toPosition, 30)
                doPlayerSendTextMessage(cid, 22, "Congratz! Upgraded was successful, your item has become stronger!")
            else
                doSendMagicEffect(toPosition, 2)
                doPlayerSendTextMessage(cid, 22, "Argh! Upgrading fail... you item lost some of strong!")
            end
            doItemSetAttribute(itemEx.uid, "name", getItem.name..((nLevel>0) and "+"..nLevel or "")) 
            doItemSetAttribute(itemEx.uid, "attack",  upgrading.upValue(getItem.attack, nLevel, conf["upgrade"].attack))
            doItemSetAttribute(itemEx.uid, "extraattack", upgrading.upValue(getItem.extraAttack, nLevel, conf["upgrade"].extraAttack))
            doItemSetAttribute(itemEx.uid, "defense", upgrading.upValue(getItem.defense,nLevel, conf["upgrade"].defense))
            doItemSetAttribute(itemEx.uid, "extradefense", upgrading.upValue(getItem.extraDefense, nLevel, conf["upgrade"].extraDefense))
            doItemSetAttribute(itemEx.uid, "armor", upgrading.upValue(getItem.armor, nLevel, conf["upgrade"].armor))
            doItemSetAttribute(itemEx.uid, "hitChance", upgrading.upValue(getItem.hitChance,nLevel, conf["upgrade"].hitChance))
            doRemoveItem(item.uid, 1)
        else
            doPlayerSendTextMessage(cid, 19, "Sorry this item is on max level.")
        end
    else
        doPlayerSendTextMessage(cid, 19, "You cannot upgrade this item.")
    end
end
 
I love you, you love me :D Mock system is better but anyways its good script :D a peapol who visit here and no rep you should be idiot :D
 
Hello, i have an error when i use upgrade item on items (magic sword, demon armor etc.). This is error from TFS:

[24/07/2010 13:35:31] [Error - Action Interface]
[24/07/2010 13:35:31] data/actions/scripts/upgrading.lua:eek:nUse
[24/07/2010 13:35:31] Description:
[24/07/2010 13:35:31] data/actions/scripts/upgrading.lua:13: attempt to call global 'getItemArmor' (a nil value)
[24/07/2010 13:35:31] stack traceback:
[24/07/2010 13:35:31] data/actions/scripts/upgrading.lua:13: in function <data/actions/scripts/upgrading.lua:11>
 
Hey i added this it works but How can i edit it to make it so it does like.
If weapon is attack 60
+1 makes it 61
+2 makes it 63
+3 makes it 66
Instead everytime it upgrades it just gives 6 more attack can it be staged? if so could you let me know how Pleasee
get back to me thanks.
 
Last edited:
#up
nothing, because if you stack with starts/restarck it's lose special attrs. : )
 
#up
nothing, because if you stack with starts/restarck it's lose special attrs. : )
 
it is posible if i upgrade example: Golden Helmet arm 12 and protection physical +4% this increased to 14 arm, +6% physical protection? please xD?
 
Back
Top