Ir para conteúdo
  • Cadastre-se

Normal Conflito entre script de refino e mining


Posts Recomendados

Alguém pode me dar uma força? estou utilizando o script de mining do nosso querido xWhiteWolf e o Perfect Upgrade System 2.0.

O problema é que quando o mining system está ativo (action) eu não consigo refinar nenhum item, aparece o seguinte erro na distro: 

-HrpExG.png

 

Vou deixar os 2 scripts em spoiler:

 

MINING SYSTEM

Spoiler

terra = {4471,4475,4485,1304,4473,4478,3339,4474,4508,4472,4476}
 levels = {
[-1] = 2229, ---- skull
[0] = 1294, --- small stone
[10] = 2149, -- Small Emerald
[12] = 2146, -- Small Sapphire
[20] = 2145, -- Small Diamond 
[40] = 2150, -- Small Amethyst
[60] = 2147, -- Small Ruby
[80] = 2144, -- Black Pearls 
[100] = 2143, -- White Pearls
[120] = 7761, -- small enchanted emerald 
[140] = 7759, -- Small Enchanted Sapphiire
[160] = 7762, -- Small Enchanted Amethyst
[180] = 7760, -- Small Enchanted Ruby
[200] = 2157  -- Pepita de Ouro
} 


local config = {
storage = 19333,
chance = 2, --- chance de achar um item ou não
k = 2, --- constante de level.. quanto maior, mais fácil é upar. (a fórmula é level ao quadrado dividido pela constante)
experience = 19334
}


function onUse(cid, item, fromPosition, itemEx, toPosition)


local drops = {}


function getDrops(cid)
for i= -1,getPlayerStorageValue(cid, config.storage) do
if levels[i] then
table.insert(drops, levels[i])
end
end
return true
end


if isInArray(terra, itemEx.itemid) then
getDrops(cid)
doPlayerSetStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience)+1)
local experience = getPlayerStorageValue(cid, config.experience)
if experience >= (8+(getPlayerStorageValue(cid, config.storage)^2))/config.k then
doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+1)
doPlayerSendTextMessage(cid, 27, "Congratulations, you have leveled! Your currect level is "..getPlayerStorageValue(cid, config.storage) ..".")
doSendMagicEffect(getCreaturePosition(cid),98)
doSendAnimatedText(getCreaturePosition(cid), 'Mining UP', 100, cid)
if getPlayerStorageValue(cid, config.storage) == 50 then
doPlayerSendTextMessage(cid, 20, "For reaching level "..getPlayerStorageValue(cid, config.storage) .." you have been awarded with Mining Helmet.")
doPlayerAddItem(cid, 7497, 1, true)
end
end
if config.chance >= math.random(1,100) then
if #drops >= 1 then
local item = drops[math.random(1,#drops)]
doPlayerSendTextMessage(cid, 27, "You have found a "..getItemNameById(item)..".")
doPlayerAddItem(cid, item, 1, true)
end
doSendMagicEffect(toPosition, 289)
doSendAnimatedText(toPosition , 'TiickK!', 169)
else
doSendMagicEffect(toPosition, 288)
doSendAnimatedText(toPosition , "Puuff!", 61)
return true
end
elseif itemEx.itemid == item.itemid then
doPlayerSendTextMessage(cid, 27, "You're currenctly level "..getPlayerStorageValue(cid, config.storage)..".")
else
return false
end
return true
end

 

 

UPGRADE SYSTEM

Spoiler

--[[

    PERFECT UPGRADE SYSTEM
                2.0
                
    Criado por Oneshot
    
    É proibido a venda ou a cópia sem os devidos créditos desse script.
    
]]--

UpgradeHandler = {
    levels = {
        [1] = {70, false, false},
        [2] = {50, false, false},
        [3] = {30, false, false},
        [4] = {20, false, false},
        [5] = {10, false, false},
        [6] = {5, false, false},
        [7] = {4, false, false},
        [8] = {3, false, false},
        [9] = {2, false, false},
        [10] = {1, false, false}
    },
    broadcast = 10,
    attributes = {
        ["attack"] = 2,
        ["defense"] = 100,
        ["armor"] = 100
    },
    message = {
        console = "Tentando refinar %s para o nivel +%s com %s%% de chance de sucesso.",
        success = "Voce deu upgrade em %s para o nivel +%s",
        fail = "Voce falhou ao tentar da upgrade em %s para o nivel +%s",
        downgrade = "The upgrade level of %s has downgraded to +%s",
        erase = "The upgrade level of %s has been erased.",
        maxlevel = "A %s ja esta no nivel maximo.",
        notupgradeable = "Este item nao da pra dar upgrade.",
        broadcast = "O jogador %s teve sucesso em dar upgrade no %s ao nivel +%s.\nParabens!!",
        invalidtool = "Essa nao e uma ferramenta valida de upgrade.",
        toolrange = "Essa ferramenta so pode ser usada para dar upgrade do nivel +%s ao +%s"
    },
    tools = {
        [2153] = {range = {0, 10}, info = {chance = 0, removeable = false}},
		[2154] = {range = {0, 10}, info = {chance = 100, removeable = false}}
    },
    
    isEquipment = function(self)
        local weaponType = self:getItemWeaponType()
        return ((weaponType > 0 and weaponType < 7) or self.item.armor ~= 0)
    end,
    
    setItemName = function(self, name)
        return doItemSetAttribute(self.item.uid, "name", name)
    end,
    
    chance = function(self)
        local chances = {}
        chances.upgrade = (self.levels[self.item.level + 1][1] or 100)
        chances.downgrade = (self.item.level * 5)
        chances.erase = (self.item.level * 3)

        return chances
    end
}

function UpgradeHandler:new(item)
    local obj, ret = {}
    obj.item = {}
    
    obj.item.level = 0
    obj.item.uid = item.uid
    for key, value in pairs(getItemInfo(item.itemid)) do
        obj.item[key] = value
    end
    
    ret = setmetatable(obj, {__index = function(self, index)
        if _G[index] then
            return (setmetatable({callback = _G[index]}, {__call = function(self, ...)
                return self.callback(item.uid, ...)
            end}))
        else
            return UpgradeHandler[index]
        end
    end})
    
    if ret:isEquipment() then
        ret:update()
        return ret
    end
    return false
end

function UpgradeHandler:update()
    self.item.level = (tonumber(self:getItemName():match("%+(%d+)")) or 0)
end

function UpgradeHandler:refine(uid, item)
    if not self.item then
        doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_BLUE, self.message.notupgradeable)
        return "miss"
    end    
    
    local tool = self.tools[item.itemid]
    
    if(tool == nil) then
        doPlayerSendTextMessage(uid, MESSAGE_EVENT_DEFAULT, self.message.invalidtool)
        return "miss"
    end
    
    if(self.item.level > #self.levels) then
        doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_RED, self.message.maxlevel:format(self.item.name))
        return "miss"
    end
    
    if(self.item.level < tool.range[1] or self.item.level >= tool.range[2]) then
        doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_RED, self.message.toolrange:format(unpack(tool.range)))
        return "miss"
    end
    
    local chance = (self:chance().upgrade + tool.info.chance)
    doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_BLUE, self.message.console:format(self.item.name, (self.item.level + 1), math.min(100, chance)))
    
    if(tool.info.removeable == false) then
        doRemoveItem(item.uid, 1)
    end
    
    if chance * 100 > math.random(1, 10000) then
        doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_ORANGE, self.message.success:format(self.item.name, (self.item.level + 1)))
        if (self.item.level + 1) >= self.broadcast then
            doBroadcastMessage(self.message.broadcast:format(getCreatureName(uid), self.item.name, (self.item.level + 1)))
        end
        
        self:setItemName((self.item.level > 0 and self:getItemName():gsub("%+(%d+)", "+".. (self.item.level + 1)) or (self:getItemName() .." +1")))
        for key, value in pairs(self.attributes) do
            if getItemAttribute(self.item.uid, key) ~= nil or self.item[key] ~= 0 then
                doItemSetAttribute(self.item.uid, key, (self.item.level > 0 and getItemAttribute(self.item.uid, key) or self.item[key]) + value)
            end
        end
        return "success"
    else
        if(self.levels[self.item.level][3] == true and (self:chance().erase * 100) > math.random(1, 10000)) then
            doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_RED, self.message.erase:format(self.item.name))
            self:setItemName(self.item.name)
            for key, value in pairs(self.attributes) do
                if self.item[key] > 0 then
                    doItemSetAttribute(self.item.uid, key, self.item[key])
                end
            end
        elseif(self.levels[self.item.level][2] == true and (self:chance().downgrade * 100) > math.random(1, 10000)) then
            doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_RED, self.message.downgrade:format(self.item.name, (self.item.level - 1)))
            self:setItemName((self.item.level == 1 and self.item.name or self:getItemName():gsub("%+(%d+)", "+".. (self.item.level - 1))))
            for key, value in pairs(self.attributes) do
                if getItemAttribute(self.item.uid, key) ~= nil or self.item[key] ~= 0 then
                    doItemSetAttribute(self.item.uid, key, (self.item[key] + value * (self.item.level - 1)))
                end
            end
        else
            doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_RED, self.message.fail:format(self.item.name, (self.item.level + 1)))
        end
        return "fail"
    end
end

 

 

 

Grato desde já por qual quer tipo de ajuda!

Link para o post
Compartilhar em outros sites

tenta a script do MINING desta forma pra ver

Spoiler

terra = {4471,4475,4485,1304,4473,4478,3339,4474,4508,4472,4476}
 terraa = {
[-1] = 2229, ---- skull
[0] = 1294, --- small stone
[10] = 2149, -- Small Emerald
[12] = 2146, -- Small Sapphire
[20] = 2145, -- Small Diamond 
[40] = 2150, -- Small Amethyst
[60] = 2147, -- Small Ruby
[80] = 2144, -- Black Pearls 
[100] = 2143, -- White Pearls
[120] = 7761, -- small enchanted emerald 
[140] = 7759, -- Small Enchanted Sapphiire
[160] = 7762, -- Small Enchanted Amethyst
[180] = 7760, -- Small Enchanted Ruby
[200] = 2157  -- Pepita de Ouro


local config = {
storage = 19333,
chance = 2, --- chance de achar um item ou não
k = 2, --- constante de level.. quanto maior, mais fácil é upar. (a fórmula é level ao quadrado dividido pela constante)
experience = 19334
}


function onUse(cid, item, fromPosition, itemEx, toPosition)


local drops = {}


function getDrops(cid)
for i= -1,getPlayerStorageValue(cid, config.storage) do
if terraa then
table.insert(drops, terraa)
end
end
return true
end


if isInArray(terra, itemEx.itemid) then
getDrops(cid)
doPlayerSetStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience)+1)
local experience = getPlayerStorageValue(cid, config.experience)
if experience >= (8+(getPlayerStorageValue(cid, config.storage)^2))/config.k then
doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+1)
doPlayerSendTextMessage(cid, 27, "Congratulations, you have leveled! Your currect level is "..getPlayerStorageValue(cid, config.storage) ..".")
doSendMagicEffect(getCreaturePosition(cid),98)
doSendAnimatedText(getCreaturePosition(cid), 'Mining UP', 100, cid)
if getPlayerStorageValue(cid, config.storage) == 50 then
doPlayerSendTextMessage(cid, 20, "For reaching level "..getPlayerStorageValue(cid, config.storage) .." you have been awarded with Mining Helmet.")
doPlayerAddItem(cid, 7497, 1, true)
end
end
if config.chance >= math.random(1,100) then
if #drops >= 1 then
local item = drops[math.random(1,#drops)]
doPlayerSendTextMessage(cid, 27, "You have found a "..getItemNameById(item)..".")
doPlayerAddItem(cid, item, 1, true)
end
doSendMagicEffect(toPosition, 289)
doSendAnimatedText(toPosition , 'TiickK!', 169)
else
doSendMagicEffect(toPosition, 288)
doSendAnimatedText(toPosition , "Puuff!", 61)
return true
end
elseif itemEx.itemid == item.itemid then
doPlayerSendTextMessage(cid, 27, "You're currenctly level "..getPlayerStorageValue(cid, config.storage)..".")
else
return false
end
return true
end

 

Editado por Radamanthys Wov
Script errada (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
26 minutos atrás, Radamanthys Wov disse:

tenta a script do MINING desta forma pra ver

  Ocultar conteúdo

terra = {4471,4475,4485,1304,4473,4478,3339,4474,4508,4472,4476}
 terraa = {
[-1] = 2229, ---- skull
[0] = 1294, --- small stone
[10] = 2149, -- Small Emerald
[12] = 2146, -- Small Sapphire
[20] = 2145, -- Small Diamond 
[40] = 2150, -- Small Amethyst
[60] = 2147, -- Small Ruby
[80] = 2144, -- Black Pearls 
[100] = 2143, -- White Pearls
[120] = 7761, -- small enchanted emerald 
[140] = 7759, -- Small Enchanted Sapphiire
[160] = 7762, -- Small Enchanted Amethyst
[180] = 7760, -- Small Enchanted Ruby
[200] = 2157  -- Pepita de Ouro


local config = {
storage = 19333,
chance = 2, --- chance de achar um item ou não
k = 2, --- constante de level.. quanto maior, mais fácil é upar. (a fórmula é level ao quadrado dividido pela constante)
experience = 19334
}


function onUse(cid, item, fromPosition, itemEx, toPosition)


local drops = {}


function getDrops(cid)
for i= -1,getPlayerStorageValue(cid, config.storage) do
if terraa then
table.insert(drops, terraa)
end
end
return true
end


if isInArray(terra, itemEx.itemid) then
getDrops(cid)
doPlayerSetStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience)+1)
local experience = getPlayerStorageValue(cid, config.experience)
if experience >= (8+(getPlayerStorageValue(cid, config.storage)^2))/config.k then
doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+1)
doPlayerSendTextMessage(cid, 27, "Congratulations, you have leveled! Your currect level is "..getPlayerStorageValue(cid, config.storage) ..".")
doSendMagicEffect(getCreaturePosition(cid),98)
doSendAnimatedText(getCreaturePosition(cid), 'Mining UP', 100, cid)
if getPlayerStorageValue(cid, config.storage) == 50 then
doPlayerSendTextMessage(cid, 20, "For reaching level "..getPlayerStorageValue(cid, config.storage) .." you have been awarded with Mining Helmet.")
doPlayerAddItem(cid, 7497, 1, true)
end
end
if config.chance >= math.random(1,100) then
if #drops >= 1 then
local item = drops[math.random(1,#drops)]
doPlayerSendTextMessage(cid, 27, "You have found a "..getItemNameById(item)..".")
doPlayerAddItem(cid, item, 1, true)
end
doSendMagicEffect(toPosition, 289)
doSendAnimatedText(toPosition , 'TiickK!', 169)
else
doSendMagicEffect(toPosition, 288)
doSendAnimatedText(toPosition , "Puuff!", 61)
return true
end
elseif itemEx.itemid == item.itemid then
doPlayerSendTextMessage(cid, 27, "You're currenctly level "..getPlayerStorageValue(cid, config.storage)..".")
else
return false
end
return true
end

 

Funcionou! muito obrigado :)

 

O problema era que os 2 scripts tinha levels = { ?

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 Jaurez
      .
    • Por Cat
      Em alguns casos, o tibia 8.60 comum não abre de jeito nenhum no map editor, mesmo desmarcando check file signatures e configurando o path corretamente.
       
      Este é o client 8.60 adaptado para o Remere's Map Editor. Resolvi postar já que ele foi removido do site oficial do RME. (ficou apenas a versão para linux lá)
      Se estiver tendo problemas para abrir a versão 8.60, tente utilizar este.
                                                                                                                     
      Baixar o Tibia Client 8.60 que funciona no Remere’s Map Editor
      Essa versão do Tibia 8.60 client resolve o erro unsupported client version ou Could not locate tibia.dat and/or tibia.spr, please navigate to your tibia 8.60 installation folder.
       
      Downloads
      https://tibiaking.com/applications/core/interface/file/attachment.php?id=47333

      Scan: https://www.virustotal.com/gui/file/333e172ac49ba2028db9eb5889994509e7d2de28ebccfa428c04e86defbe15cc
       
    • Por danilo belato
      Fala Galera To Com um problema aki 
       
      quero exporta umas sprites de um server para colocar em outro 
       
      eu clico na sprites ai aparece tds a forma delas do lado de la >>
       
      ai eu clico nela e ponho a opiçao de export mais quando salvo a sprite ela n abri 
       
      aparece isso quando tento vê-la 
       
      visualização não disponível ( no formatos png e bitmap)
       
      Agora no formato idc fala que o paint n pode ler 
       
      me ajudem ae...
    • Por Vitor Bicaleto
      Galera to com o script do addon doll aqui, quando eu digito apenas "!addon" ele aparece assim: Digite novamente, algo está errado!"
      quando digito por exemplo: "!addon citizen" ele não funciona e não da nenhum erro
       
      mesma coisa acontece com o mount doll.. 
    • Por Ayron5
      Substitui uma stone no serve, deu tudo certo fora  esse  erro ajudem  Valendo  Rep+  Grato  

      Erro: data/actions/scripts/boost.lua:557: table index is nil
       [Warning - Event::loadScript] Cannot load script (data/actions/scripts/boost.lua)

      Script:
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo