Postado Maio 2, 2012 13 anos local conf = {} conf["level"] = { -- [item_level] = {successParcent=PARCENT FOR UPGRADING SUCCESS, downrageLevel = IF UPGRADING FAIL - ITEM WAS DECRASED TO LEVEL HERE} [1] = {successParcent = 100, downrageLevel = 1}, [2] = {successParcent = 50, downrageLevel = 2}, [3] = {successParcent = 40, downrageLevel = 3}, [4] = {successParcent = 35, downrageLevel = 4}, [5] = {successParcent = 30, downrageLevel = 5}, [6] = {successParcent = 25, downrageLevel = 6}, [7] = {successParcent = 20, downrageLevel = 7}, [8] = {successParcent = 15, downrageLevel = 8}, [9] = {successParcent = 10, downrageLevel = 9}, [10] = {successParcent = 5, downrageLevel = 10} } conf["upgrade"] = { -- how many parcent attributes are rised? defense = 5, -- defence % armor = 5, -- armor % } -- // 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.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, "Congratulations! Upgraded was successful, your item has become stronger!") else doSendMagicEffect(toPosition, 2) doPlayerSendTextMessage(cid, 22, "Argh! Upgrading fail... The enchanted stone was broken!") end doItemSetAttribute(itemEx.uid, "name", getItem.name..((nLevel>0) and "+"..nLevel or "")) doItemSetAttribute(itemEx.uid, "defense", upgrading.upValue(getItem.defense,nLevel, conf["upgrade"].defense)) doItemSetAttribute(itemEx.uid, "armor", upgrading.upValue(getItem.armor, nLevel, conf["upgrade"].armor)) 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 Seria que tem como trocar essa % para um numero fixo? eu mesmo só queria que aumentasse 1 ponto ao lugar da %. Conheça agora os planos e preços da TKS Host. Qualidade e Preço Justo! www.tkshost.com
Postado Maio 3, 2012 13 anos Autor Bump, topico tinha sumido no mundo =/ Conheça agora os planos e preços da TKS Host. Qualidade e Preço Justo! www.tkshost.com
Postado Maio 3, 2012 13 anos Amigo para o pessoal saber do que se trata o tópico coloque um titulo melhor ok?, não entendo .lua só postei aqui para deixar o aviso. www.patronum.online
Postado Maio 5, 2012 13 anos Autor Esta certo, com o tempo melhoro, porem alguem pode me ajudar? Pelo que vejo nao é dificil, mais ser leigo é complicado =/ Conheça agora os planos e preços da TKS Host. Qualidade e Preço Justo! www.tkshost.com
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.