Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Fala galera do Tk 

Tenho um syste,ma de Upgrade System Quase perfeito 

So tem um Bug

Todas as armas refinao normal

ate +10

porem a de pally refina +1+2 +3 ate +10 tbm mas nao add mais ataques nas armas 

minha sword é Sword (Atk:2485 physical + 15 fire, Def:40, sword fighting +10).

quando refino fica

Sword +1 (Atk:2490 physical + 15 fire, Def:45, sword fighting +10).

 

ae vem as armas de pally onde esta o bug

a normal é

Bow (Atk:3000).

e quando refica so aparece o +1 mas nao almenta o dano igual as sword

olha

Bow +1 (Atk:3000).

tem como arrumar pra minn

 

segue o script

 


--- Email: <a href="mailto:mock_otnet@hotmail.com">mock_otnet@hotmail.com</a>
-- &a = weapon attack
-- &d = weapon defense
-- &s = shield defense
-- &p = armor defense
-- # = nivel do item
-- @ = max level
local gain = {
gainArmor='&p+(5)',loseArmor='&p-(3)',
gainShield='&s+#',loseShield='&s-(#+3)',
gainAttack='&a+(5*(#))',loseAttack='&a-(3*(#+3))',
gainDefense='&d+(5*(#))',loseDefense='&d-(3*(#+3))',
chance='(100/math.sqrt((((@/4)+(#*2))/@)*#))',
maxlvl = 10,
blocked_ids = {8881}
}
local it = {
--[itemid] = [percent]
[8306] = 7, -- 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.
    local f = getItemInfo(uid.itemid)
    if f.armor ~= 0 and f.wieldPosition ~= CONST_SLOT_NECKLACE then
        return true
    end
    return false
end
local function isWeapon(uid) -- Function by Mock the bear.
    uid = uid or 0
    local f = getItemInfo(uid.itemid)
    if table.find({WEAPON_SWORD, WEAPON_CLUB, WEAPON_AXE}, f.weaponType) then
        return true
    end
    return false
end
local function isShield(uid) -- Function by Mock the bear.
    uid = uid or 0
    local f = getItemInfo(uid.itemid)
    if f.defense ~= 0 and f.weaponType == WEAPON_SHIELD then
        return true
    end
    return false
end
local function isBow(uid) -- Function by Mock the bear.
    local f = getItemInfo(uid.itemid)
    if f.weaponType == WEAPON_DIST and f.ammoType ~= 0 then
        return true
    end
    return false
end
local function isBow2(uid) -- Function by Mock the bear.
    local f = getItemInfo(uid.itemid)
    if f.weaponType == WEAPON_DIST and f.ammoType ~= 0 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, 24,"Voce nao consegue trabalhar neste item.")
                return TRUE
         end
         if isCreature(itemEx.uid) == TRUE then
            return FALSE
         end
        local level = getWeaponLevel(itemEx)
        local chance = doTransform(gain.chance,itemEx)
        local nm = getItemName(itemEx.uid)
        if level == gain.maxlvl then
            doSendMagicEffect(toPosition, 2)
            return doPlayerSendTextMessage(cid, 24,"Voce nao pode mais refinar este objeto, ele ja atingiu o seu maximo!")
        end
        doPlayerSendTextMessage(cid, 24,"Voce tenta refinar um(a) "..nm.." com "..(chance+it[item.itemid] > 100 and 100 or chance+it[item.itemid]).."% de chance de sucesso. ")
        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
            if level==0 then
                setItemName(itemEx.uid, nm..' +'..(level+1)..slot)
            elseif level<=9 then
                setItemName(itemEx.uid, string.match(string.match(string.sub(nm, 1, -3), "%S.*"), ".*%S")..' +'..(level+1)..slot)
            else
                setItemName(itemEx.uid, string.match(string.match(string.sub(nm, 1, -4), "%S.*"), ".*%S")..' +'..(level+1)..slot)
            end
            addEvent(doPlayerSendTextMessage,500,cid, 24,"Voce refina com sucesso o objeto e ele avanca para o nivel "..(level+1)..slot..".")
            doSendMagicEffect(toPosition, 12)
            if isArmor(itemEx) then
                local get = doTransform(gain.gainArmor,itemEx)
                setItemArmor(itemEx.uid,get)
            elseif isBow(itemEx) then
                setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
            elseif isWeapon(itemEx) then
                setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
                setItemDefense(itemEx.uid, doTransform(gain.gainDefense,itemEx))
            elseif isShield(itemEx) then
                setItemDefense(itemEx.uid, doTransform(gain.gainShield,itemEx))
            end
        else
            -- Give it a second chance, if it success, the item stays the same level.
            if chance+it[item.itemid] >= math.random(0,100) then
                addEvent(doPlayerSendTextMessage,500,cid, 24,"O refinamento falha mas seu objeto mantem-se no meso nivel.")
            else
                --if not, we'll give it a 15% change to get destroyed.
                if math.random(0,100) <= 15 then
                    -- And only if the level is above 7.
                    if level > 7 then
                        addEvent(doPlayerSendTextMessage,500,cid, 24,"O objeto nao aguentou a carga do refinamento e acabou sendo destruido no processo.")
                        doRemoveItem(itemEx.uid,1)
                        -- You can set a custom animation for the destruction of the item here if you want. Just change the number to other animation
                        doSendMagicEffect(toPosition, 9)
                    else
                        addEvent(doPlayerSendTextMessage,500,cid, 24,"O refinamento falha mas seu objeto mantem-se no meso nivel.")
                    end
                else
                    if level == 0 then
                        addEvent(doPlayerSendTextMessage,500,cid, 24,"Não surte efeito.")
                        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, 24,"Seu objeto voltou ao normal.")
                        else
                            setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level-1)..slot)
                            addEvent(doPlayerSendTextMessage,500,cid, 24,"O refinamento falha e seu objeto volta para o nivel "..(level-1)..slot..".")
                        end
                        if isArmor(itemEx) then
                            setItemArmor(itemEx.uid,doTransform(gain.loseArmor  ,itemEx))
                        elseif isWeapon(itemEx) then
                            setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
                            setItemDefense(itemEx.uid, doTransform(gain.loseDefense,itemEx))
                        elseif isBow(itemEx) then
                            setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
                        elseif isShield(itemEx) then
                            setItemDefense(itemEx.uid, doTransform(gain.loseShield,itemEx))
                        end
                    end
                    doSendMagicEffect(toPosition, 9)
                end
            end
        end
    doRemoveItem(item.uid,1)
    return true
end

 

 

+Rep ajuem aeee

 

 

Link para o post
Compartilhar em outros sites
  • Respostas 9
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

@mullino   Essa é a linha 177, se você colocou pelo blocos de notas, ta vendo que o começo da frase ta menor ?  se você salvar desse jeito, e depois abrir o arquivo vai ter um "?" ponto de interrogação é só apagar ele !     presta atenção que agora quando você abre o arquivo, deposi da letra a tem um pronto de interrogação, só apagar ele  

Até li o código e não consegui identificar o problema. Mas vai uma dica pra vc: Quando for postar códigos, use a função 'Código' do fórum para facilitar a vida de quem for te ajudar! Assim \/ Na verdade relendo o código agora me ocorreu algo... tente usar esse código pra ver se funciona:   --- Email: <a href="mailto:mock_otnet@hotmail.com">mock_otnet@hotmail.com</a> -- &a = weapon attack -- &d = weapon defense -- &s = shield defense -- &p = armor

Tenta assim então:   --- Email: <a href="mailto:mock_otnet@hotmail.com">mock_otnet@hotmail.com</a> -- &a = weapon attack -- &d = weapon defense -- &s = shield defense -- &p = armor defense -- # = nivel do item -- @ = max level local gain = { gainArmor='&p+(5)',loseArmor='&p-(3)', gainShield='&s+#',loseShield='&s-(#+3)', gainAttack='&a+(5*(#))',loseAttack='&a-(3*(#+3))', gainDefense='&d+(5*(#))',loseDefense='&d-(3*(#+3))', chance='

Posted Images

Até li o código e não consegui identificar o problema.
Mas vai uma dica pra vc: Quando for postar códigos, use a função 'Código' do fórum para facilitar a vida de quem for te ajudar!

Assim \/

  Mostrar conteúdo oculto

Na verdade relendo o código agora me ocorreu algo...
tente usar esse código pra ver se funciona:
 

--- Email: <a href="mailto:mock_otnet@hotmail.com">mock_otnet@hotmail.com</a>
-- &a = weapon attack
-- &d = weapon defense
-- &s = shield defense
-- &p = armor defense
-- # = nivel do item
-- @ = max level
local gain = {
gainArmor='&p+(5)',loseArmor='&p-(3)',
gainShield='&s+#',loseShield='&s-(#+3)',
gainAttack='&a+(5*(#))',loseAttack='&a-(3*(#+3))',
gainDefense='&d+(5*(#))',loseDefense='&d-(3*(#+3))',
chance='(100/math.sqrt((((@/4)+(#*2))/@)*#))',
maxlvl = 10,
blocked_ids = {8881}
}
local it = {
--[itemid] = [percent]
[8306] = 7, -- 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.
    local f = getItemInfo(uid.itemid)
    if f.armor ~= 0 and f.wieldPosition ~= CONST_SLOT_NECKLACE then
        return true
    end
    return false
end
local function isWeapon(uid) -- Function by Mock the bear.
    uid = uid or 0
    local f = getItemInfo(uid.itemid)
    if table.find({WEAPON_SWORD, WEAPON_CLUB, WEAPON_AXE}, f.weaponType) then
        return true
    end
    return false
end
local function isShield(uid) -- Function by Mock the bear.
    uid = uid or 0
    local f = getItemInfo(uid.itemid)
    if f.defense ~= 0 and f.weaponType == WEAPON_SHIELD then
        return true
    end
    return false
end
local function isBow(uid) -- Function by Mock the bear.
    local f = getItemInfo(uid.itemid)
    if f.weaponType == WEAPON_DIST and f.ammoType ~= 0 then
        return true
    end
    return false
end
local function isBow2(uid) -- Function by Mock the bear.
    local f = getItemInfo(uid.itemid)
    if f.weaponType == WEAPON_DIST and f.ammoType ~= 0 then
        return false
    end
    return true
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, 24,"Voce nao consegue trabalhar neste item.")
                return TRUE
         end
         if isCreature(itemEx.uid) == TRUE then
            return FALSE
         end
        local level = getWeaponLevel(itemEx)
        local chance = doTransform(gain.chance,itemEx)
        local nm = getItemName(itemEx.uid)
        if level == gain.maxlvl then
            doSendMagicEffect(toPosition, 2)
            return doPlayerSendTextMessage(cid, 24,"Voce nao pode mais refinar este objeto, ele ja atingiu o seu maximo!")
        end
        doPlayerSendTextMessage(cid, 24,"Voce tenta refinar um(a) "..nm.." com "..(chance+it[item.itemid] > 100 and 100 or chance+it[item.itemid]).."% de chance de sucesso. ")
        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
            if level==0 then
                setItemName(itemEx.uid, nm..' +'..(level+1)..slot)
            elseif level<=9 then
                setItemName(itemEx.uid, string.match(string.match(string.sub(nm, 1, -3), "%S.*"), ".*%S")..' +'..(level+1)..slot)
            else
                setItemName(itemEx.uid, string.match(string.match(string.sub(nm, 1, -4), "%S.*"), ".*%S")..' +'..(level+1)..slot)
            end
            addEvent(doPlayerSendTextMessage,500,cid, 24,"Voce refina com sucesso o objeto e ele avanca para o nivel "..(level+1)..slot..".")
            doSendMagicEffect(toPosition, 12)
            if isArmor(itemEx) then
                local get = doTransform(gain.gainArmor,itemEx)
                setItemArmor(itemEx.uid,get)
            elseif isBow(itemEx) then
                setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
            elseif isWeapon(itemEx) then
                setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
                setItemDefense(itemEx.uid, doTransform(gain.gainDefense,itemEx))
            elseif isShield(itemEx) then
                setItemDefense(itemEx.uid, doTransform(gain.gainShield,itemEx))
            end
        else
            -- Give it a second chance, if it success, the item stays the same level.
            if chance+it[item.itemid] >= math.random(0,100) then
                addEvent(doPlayerSendTextMessage,500,cid, 24,"O refinamento falha mas seu objeto mantem-se no meso nivel.")
            else
                --if not, we'll give it a 15% change to get destroyed.
                if math.random(0,100) <= 15 then
                    -- And only if the level is above 7.
                    if level > 7 then
                        addEvent(doPlayerSendTextMessage,500,cid, 24,"O objeto nao aguentou a carga do refinamento e acabou sendo destruido no processo.")
                        doRemoveItem(itemEx.uid,1)
                        -- You can set a custom animation for the destruction of the item here if you want. Just change the number to other animation
                        doSendMagicEffect(toPosition, 9)
                    else
                        addEvent(doPlayerSendTextMessage,500,cid, 24,"O refinamento falha mas seu objeto mantem-se no meso nivel.")
                    end
                else
                    if level == 0 then
                        addEvent(doPlayerSendTextMessage,500,cid, 24,"Não surte efeito.")
                        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, 24,"Seu objeto voltou ao normal.")
                        else
                            setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level-1)..slot)
                            addEvent(doPlayerSendTextMessage,500,cid, 24,"O refinamento falha e seu objeto volta para o nivel "..(level-1)..slot..".")
                        end
                        if isArmor(itemEx) then
                            setItemArmor(itemEx.uid,doTransform(gain.loseArmor  ,itemEx))
                        elseif isWeapon(itemEx) then
                            setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
                            setItemDefense(itemEx.uid, doTransform(gain.loseDefense,itemEx))
                        elseif isBow(itemEx) then
                            setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
                        elseif isShield(itemEx) then
                            setItemDefense(itemEx.uid, doTransform(gain.loseShield,itemEx))
                        end
                    end
                    doSendMagicEffect(toPosition, 9)
                end
            end
        end
    doRemoveItem(item.uid,1)
    return true
end

 

Editado por luangop (veja o histórico de edições)

Te ajudei? Clique em  Gostei ! 

²²²d¬¬b²²²

 

 

"She's got a smile that it seems to me...."  ♪♪

Link para o post
Compartilhar em outros sites
  Em 13/05/2018 em 01:47, luangop disse:

Até li o código e não consegui identificar o problema.
Mas vai uma dica pra vc: Quando for postar códigos, use a função 'Código' do fórum para facilitar a vida de quem for te ajudar!

Assim \/

  Mostrar conteúdo oculto

Na verdade relendo o código agora me ocorreu algo...
tente usar esse código pra ver se funciona:
 

--- Email: <a href="mailto:mock_otnet@hotmail.com">mock_otnet@hotmail.com</a>
-- &a = weapon attack
-- &d = weapon defense
-- &s = shield defense
-- &p = armor defense
-- # = nivel do item
-- @ = max level
local gain = {
gainArmor='&p+(5)',loseArmor='&p-(3)',
gainShield='&s+#',loseShield='&s-(#+3)',
gainAttack='&a+(5*(#))',loseAttack='&a-(3*(#+3))',
gainDefense='&d+(5*(#))',loseDefense='&d-(3*(#+3))',
chance='(100/math.sqrt((((@/4)+(#*2))/@)*#))',
maxlvl = 10,
blocked_ids = {8881}
}
local it = {
--[itemid] = [percent]
[8306] = 7, -- 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.
    local f = getItemInfo(uid.itemid)
    if f.armor ~= 0 and f.wieldPosition ~= CONST_SLOT_NECKLACE then
        return true
    end
    return false
end
local function isWeapon(uid) -- Function by Mock the bear.
    uid = uid or 0
    local f = getItemInfo(uid.itemid)
    if table.find({WEAPON_SWORD, WEAPON_CLUB, WEAPON_AXE}, f.weaponType) then
        return true
    end
    return false
end
local function isShield(uid) -- Function by Mock the bear.
    uid = uid or 0
    local f = getItemInfo(uid.itemid)
    if f.defense ~= 0 and f.weaponType == WEAPON_SHIELD then
        return true
    end
    return false
end
local function isBow(uid) -- Function by Mock the bear.
    local f = getItemInfo(uid.itemid)
    if f.weaponType == WEAPON_DIST and f.ammoType ~= 0 then
        return true
    end
    return false
end
local function isBow2(uid) -- Function by Mock the bear.
    local f = getItemInfo(uid.itemid)
    if f.weaponType == WEAPON_DIST and f.ammoType ~= 0 then
        return false
    end
    return true
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, 24,"Voce nao consegue trabalhar neste item.")
                return TRUE
         end
         if isCreature(itemEx.uid) == TRUE then
            return FALSE
         end
        local level = getWeaponLevel(itemEx)
        local chance = doTransform(gain.chance,itemEx)
        local nm = getItemName(itemEx.uid)
        if level == gain.maxlvl then
            doSendMagicEffect(toPosition, 2)
            return doPlayerSendTextMessage(cid, 24,"Voce nao pode mais refinar este objeto, ele ja atingiu o seu maximo!")
        end
        doPlayerSendTextMessage(cid, 24,"Voce tenta refinar um(a) "..nm.." com "..(chance+it[item.itemid] > 100 and 100 or chance+it[item.itemid]).."% de chance de sucesso. ")
        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
            if level==0 then
                setItemName(itemEx.uid, nm..' +'..(level+1)..slot)
            elseif level<=9 then
                setItemName(itemEx.uid, string.match(string.match(string.sub(nm, 1, -3), "%S.*"), ".*%S")..' +'..(level+1)..slot)
            else
                setItemName(itemEx.uid, string.match(string.match(string.sub(nm, 1, -4), "%S.*"), ".*%S")..' +'..(level+1)..slot)
            end
            addEvent(doPlayerSendTextMessage,500,cid, 24,"Voce refina com sucesso o objeto e ele avanca para o nivel "..(level+1)..slot..".")
            doSendMagicEffect(toPosition, 12)
            if isArmor(itemEx) then
                local get = doTransform(gain.gainArmor,itemEx)
                setItemArmor(itemEx.uid,get)
            elseif isBow(itemEx) then
                setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
            elseif isWeapon(itemEx) then
                setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
                setItemDefense(itemEx.uid, doTransform(gain.gainDefense,itemEx))
            elseif isShield(itemEx) then
                setItemDefense(itemEx.uid, doTransform(gain.gainShield,itemEx))
            end
        else
            -- Give it a second chance, if it success, the item stays the same level.
            if chance+it[item.itemid] >= math.random(0,100) then
                addEvent(doPlayerSendTextMessage,500,cid, 24,"O refinamento falha mas seu objeto mantem-se no meso nivel.")
            else
                --if not, we'll give it a 15% change to get destroyed.
                if math.random(0,100) <= 15 then
                    -- And only if the level is above 7.
                    if level > 7 then
                        addEvent(doPlayerSendTextMessage,500,cid, 24,"O objeto nao aguentou a carga do refinamento e acabou sendo destruido no processo.")
                        doRemoveItem(itemEx.uid,1)
                        -- You can set a custom animation for the destruction of the item here if you want. Just change the number to other animation
                        doSendMagicEffect(toPosition, 9)
                    else
                        addEvent(doPlayerSendTextMessage,500,cid, 24,"O refinamento falha mas seu objeto mantem-se no meso nivel.")
                    end
                else
                    if level == 0 then
                        addEvent(doPlayerSendTextMessage,500,cid, 24,"Não surte efeito.")
                        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, 24,"Seu objeto voltou ao normal.")
                        else
                            setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level-1)..slot)
                            addEvent(doPlayerSendTextMessage,500,cid, 24,"O refinamento falha e seu objeto volta para o nivel "..(level-1)..slot..".")
                        end
                        if isArmor(itemEx) then
                            setItemArmor(itemEx.uid,doTransform(gain.loseArmor  ,itemEx))
                        elseif isWeapon(itemEx) then
                            setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
                            setItemDefense(itemEx.uid, doTransform(gain.loseDefense,itemEx))
                        elseif isBow(itemEx) then
                            setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
                        elseif isShield(itemEx) then
                            setItemDefense(itemEx.uid, doTransform(gain.loseShield,itemEx))
                        end
                    end
                    doSendMagicEffect(toPosition, 9)
                end
            end
        end
    doRemoveItem(item.uid,1)
    return true
end

 

Expand   Mostrar mais  

oi ainda nao da attacks ne armas de pally

Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por Under
      Apresentando o Tibia-IA: A IA para Desenvolvimento de Servidores Tibia! 
       O que é o Tibia-IA?
      Um modelo de IA especializado para Tibia! Ele está atualmente em teste gratuito, e eu adoraria que vocês o experimentassem. Basta acessar https://ai.tibiaking.com, criar uma conta e começar a usar totalmente de graça! 
       Versão Experimental Fechada
      Atualmente, algumas funcionalidades ainda estão em desenvolvimento. No momento, apenas a geração de scripts está disponível para o público.
      Se encontrarem qualquer problema nos scripts gerados, me avisem! Vamos juntos construir a IA mais poderosa para ajudar no desenvolvimento de servidores Tibia!  
      Contato direto discord : underewar
       Acesse agora: https://ai.tibiaking.com
       Como funciona?
       Geração automática de scripts LUA para TFS  Suporte a diferentes eventos, criaturas, NPCs, magias, etc.  Ferramenta em constante evolução para aprimorar o desenvolvimento Novidades em breve confira no site. O acesso ao Tibia-IA está disponível para testes GRATUITOS! 
      Basta criar uma conta em: https://ai.tibiaking.com
      Utilize a IA para gerar seus scripts de forma simples e rápida
      Envie feedbacks para ajudarmos a tornar a ferramenta ainda melhor!

      Problemas relatar diretamente no meu discord pessoal : underewar
       
       
    • Por cloudrun2023
      CloudRun - Sua Melhor Escolha para Hospedagem de OTServer!
      Você está procurando a solução definitiva para hospedar seu OTServer com desempenho imbatível e segurança inigualável? Não procure mais! Apresentamos a CloudRun, sua parceira confiável em serviços de hospedagem na nuvem.
       
      Recursos Exclusivos - Proteção DDoS Avançada:
      Mantenha seu OTServer online e seguro com nossa robusta proteção DDoS, garantindo uma experiência de jogo ininterrupta para seus jogadores.
       
      Servidores Ryzen 7 Poderosos: Desfrute do poder de processamento superior dos servidores Ryzen 7 para garantir um desempenho excepcional do seu OTServer. Velocidade e estabilidade garantidas!
       
      Armazenamento NVMe de Alta Velocidade:
      Reduza o tempo de carregamento do jogo com nosso armazenamento NVMe ultrarrápido. Seus jogadores vão adorar a rapidez com que podem explorar o mundo do seu OTServer.
       
      Uplink de até 1GB:
      Oferecemos uma conexão de alta velocidade com até 1GB de largura de banda, garantindo uma experiência de jogo suave e livre de lag para todos os seus jogadores, mesmo nos momentos de pico.
       
      Suporte 24 Horas:
      Estamos sempre aqui para você! Nossa equipe de suporte está disponível 24 horas por dia, 7 dias por semana, para resolver qualquer problema ou responder a qualquer pergunta que você possa ter. Sua satisfação é a nossa prioridade.
       
      Fácil e Rápido de Começar:
      Configurar seu OTServer na CloudRun é simples e rápido. Concentre-se no desenvolvimento do seu jogo enquanto cuidamos da hospedagem.
       
      Entre em Contato Agora!
      Website: https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
      Email: contato@cloudrun.com.br
      Telefone: (47) 99902-5147

      Não comprometa a qualidade da hospedagem do seu OTServer. Escolha a CloudRun e ofereça aos seus jogadores a melhor experiência de jogo possível. Visite nosso site hoje mesmo para conhecer nossos planos e começar!
       
      https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
       
      CloudRun - Onde a Velocidade Encontra a Confiabilidade!
       

    • Por FeeTads
      SALVE rapaziada do TK, esses dias vim pensando em novos scripts pro meu OT, e em um deles eu precisava que determinada area não contasse frag pro player que matasse outros, PORÉM eu precisava que os players que morressem nessa area ainda assim tivessem as penalidades da sua morte, procurei por ai, achei alguns scripts que apenas tiravam o SKULL e não realmente o FRAG do player.

      **script atualizado 22/10/2023** - melhorado e otimizado, levei o script pra puxar as infos por .lua / creatureScripts

      vou disponibilizar o code aqui, e o que fazer pra determinada area não contar frag.

      SOURCE OTX 2 / TFS 0.x, Funciona em TFS 1.x mudando as tags e ajeitando as sintaxes.

      vá em creatureevent.cpp

      procure por:
      else if(type == "preparedeath") _type = CREATURE_EVENT_PREPAREDEATH;
      Adiciona abaixo:
      else if(type == "nocountfrag") _type = CREATURE_EVENT_NOCOUNTFRAG;

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "onPrepareDeath";  
      Adicione abaixo: 
      case CREATURE_EVENT_NOCOUNTFRAG: return "noCountFragArea";

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "cid, deathList";
      Adicione abaixo:
      case CREATURE_EVENT_NOCOUNTFRAG: return "cid, target";

      agora no mesmo arquivo, vá até o final do arquivo e adicione essa função:
      uint32_t CreatureEvent::executeNoCountFragArea(Creature* creature, Creature* target) { //noCountFragArea(cid, target) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::ostringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; if(m_scriptData) scriptstream << *m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::ostringstream desc; desc << creature->getName(); env->setEvent(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::noCountFragArea] Call stack overflow." << std::endl; return 0; } }

      agora vá em creatureevent.h

      procure por:
      CREATURE_EVENT_PREPAREDEATH
      adicione abaixo:
      CREATURE_EVENT_NOCOUNTFRAG

      procure por:
      uint32_t executePrepareDeath(Creature* creature, DeathList deathList);
      Adicione abaixo:
      uint32_t executeNoCountFragArea(Creature* creature, Creature* target);

      agora vá em player.cpp

      procure por:
      bool Player::onKilledCreature(Creature* target, DeathEntry& entry)
      abaixo de:
      War_t enemy; if(targetPlayer->getEnemy(this, enemy)) { if(entry.isLast()) IOGuild::getInstance()->updateWar(enemy); entry.setWar(enemy); }
      Adicione o seguinte código:
      if (targetPlayer){ CreatureEventList killEvents = getCreatureEvents(CREATURE_EVENT_NOCOUNTFRAG); for (const auto &event : killEvents) { if (!event->executeNoCountFragArea(this, target)) { return true; } } }

      //

      Feito isso, tudo completo na sua source, agora é necessário adicionar o creaturescript dentro do servidor

      vá até creaturescripts/scripts
      crie um arquivo chamado, "noCountFragInArea.lua"
      e dentro dele cole o código:
       
      --[[ script feito por feetads / TibiaKing ]]-- --[[ discord: feetads / FeeTads#0246 ]]-- -- Add positions here for which you do not want to count frags local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, -- from = area superior esquerda / to = area inferior direita (formando um quadrado) } local onlyKillerInArea = false -- only killer need to be in area? function noCountFragArea(cid, target) if not isCreature(cid) or not isCreature(target) then return true end local posKiller = getPlayerPosition(cid) local posTarget = getPlayerPosition(target) for i = 1, #areas do local area = areas[i] if isInArea(posKiller, area.from, area.to) then if onlyKillerInArea then return false elseif isInArea(posTarget, area.from, area.to) then return false end end end return true end
      agora em creaturescripts.xml
      <event type="nocountfrag" name="fragarea" event="script" value="noCountFragInArea.lua"/>
      agora em creaturescripts/scripts/login.lua
       procure por OU semelhante a esse:
      registerCreatureEvent(cid, "AdvanceSave")
      e abaixo adicione:
      registerCreatureEvent(cid, "fragarea")

      //


      Agora tudo certo, quando quiser adiciona uma area que não pega frag, vá até o script e apenas coloque a area, igual o demonstrado no script

      Exemplo:
      local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, [2] = {from = {x = 1000, y = 1000, z = 7}, to = {x = 1100, y = 1100, z = 7}}, }
      assim somente colocando a area no script e abrindo o server ou dando /reload, já funcionará a area como não pegar frag.
      Esse sistema pode ser bom pra areas de pvp ativo, onde você ainda quer que o player que morrer perca os atributos, como se fosse uma morte normal, porém não conta frag pra quem matar.
      Bom pra sistemas tipo castle 48h (guild war), onde há diversas mortes e risco de pegar red, atrapalhando a war.

      Façam bom proveito dos scripts, e deixem os créditos no script rsrs

      **Eu fiz as alterações e o simples código por isso vim disponibilizar, créditos meus**
    • Por Muvuka
      Abri canal a força creaturescript acho que funcione no creaturescript cria script creaturescript
       
      <channel id="9" name="HELP" logged="yes"/>
      <channel id="12" name="Report Bugs" logged="yes"/>
      <channel id="13" name="Loot" logged="yes"/>
      <channel id="14" name="Report Character Rules Tibia Rules" logged="yes"/>
      <channel id="15" name="Death Channel"/>
      <channel id="6548" name="DexSoft" level="1"/>
      <channel id="7" name="Reports" logged="yes"/>
       
      antes de 
              if(lastLogin > 0) then adicione isso:
                      doPlayerOpenChannel(cid, CHANNEL_HELP) doPlayerOpenChannel(cid, 1,  2, 3) = 1,2 ,3 Channels, entendeu? NÃO FUNCIONA EU QUERO UM MEIO DE ABRI SEM USA A SOURCE
       
      EU NÃO CONSEGUI ABRI EU NÃO TENHO SOURCE
       
       
    • Por bolachapancao
      Rapaziada seguinte preciso de um script que ao utilizar uma alavanca para até 4 jogadores.
      Os jogadores serão teleportados para hunt durante uma hora e depois de uma hora os jogadores serão teleportados de volta para o templo.
       
      Observação: caso o jogador morra ou saia da hunt o evento hunt é cancelado.

      Estou a base canary
      GitHub - opentibiabr/canary: Canary Server 13.x for OpenTibia community.
       
  • Estatísticas dos Fóruns

    96844
    Tópicos
    519597
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo