Postado Novembro 2, 2014 10 anos Olá, gostaria de pedir ajuda de alguém para tentar solucionar um problema do script de refine do meu ot, já tentei mas não conseguir ajeitar! Ele refina todos os itens, porém, não refina os shields, se alguém puder ajuda eu agradeço muito! local vocations = {11, 16, 21} local ids_bloqueados = {2160, 5706, 7893, 7892, 7894, 7895, 7896, 7897, 7898, 7899, 7901, 7902, 2640, 6132, 2195, 9932, 9933, 11350, 11297, 3982, 8857, 8855, 8856, 7438, 8858, 8854, 2456, 7366, 5907, 3965, 7378, 2389, 7367, 7368, 2425, 9932} local controle = { {level = 0, quantOre = 1, chance = 48}, {level = 1, quantOre = 2, chance = 33}, {level = 2, quantOre = 3, chance = 28}, {level = 3, quantOre = 4, chance = 27}, {level = 4, quantOre = 5, chance = 24}, {level = 5, quantOre = 6, chance = 20}, {level = 6, quantOre = 7, chance = 10}, {level = 7, quantOre = 8, chance = 8}, {level = 8, quantOre = 9, chance = 5}, {level = 9, quantOre = 10, chance = 2} } function getItemLevel(uid) if uid > 0 then return getItemAttribute(uid, "lvl") or 0 end return false end function doItemAddLevel(uid, count) if uid > 0 and tonumber(count) > 0 then return doItemSetAttribute(uid, "lvl", getItemLevel(uid) + count) end return false end function onUse(cid, item, fromPosition, itemEx, toPosition) if not isInArray(vocations, getPlayerVocation(cid)) then return doPlayerSendCancel(cid, "Apenas blacksmiths podem refinar.") elseif isInArray(ids_bloqueados, itemEx.uid) then return doPlayerSendCancel(cid, "Este item nao pode ser refinado.") end if getItemInfo(itemEx.itemid).attack > 0 or getItemInfo(itemEx.itemid).defense > 0 or getItemInfo(itemEx.itemid).armor > 0 then for _, upgrade in pairs(controle) do local atk = getItemAttribute(itemEx.uid, "attack") or getItemInfo(itemEx.itemid).attack local def = getItemAttribute(itemEx.uid, "defense") or getItemInfo(itemEx.itemid).defense local arm = getItemAttribute(itemEx.uid, "armor") or getItemInfo(itemEx.itemid).armor local chance = math.random(1, 100) if getItemLevel(itemEx.uid) == upgrade.level then if doPlayerRemoveItem(cid, 5880, upgrade.quantOre) then doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_CRAPS) if chance <= upgrade.chance then if getItemLevel(itemEx.uid) == 0 then doItemSetAttribute(itemEx.uid, "description", "Esse item foi refinado por " ..getCreatureName(cid)) end doItemAddLevel(itemEx.uid, 1) doItemSetAttribute(itemEx.uid, "name", getItemNameById(itemEx.itemid).. " + " ..getItemLevel(itemEx.uid)) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce refinou com sucesso!") if getItemInfo(itemEx.itemid).attack > 0 then doItemSetAttribute(itemEx.uid, "attack", atk + 1) return true elseif getItemInfo(itemEx.itemid).armor > 0 then doItemSetAttribute(itemEx.uid, "armor", arm + 1) return true elseif getItemInfo(itemEx.itemid).defense > 0 and getItemInfo(itemEx.itemid).attack <= 0 then doItemSetAttribute(itemEx.uid, "defense", def + 1) return true end else doTransformItem(itemEx.uid, 2256) doItemSetAttribute(itemEx.uid, 'name', "metal trash") doItemSetAttribute(itemEx.uid, 'attack', 0) doItemSetAttribute(itemEx.uid, 'armor', 0) doItemSetAttribute(itemEx.uid, 'defense', 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce falhou.") return true end else doPlayerSendCancel(cid, "Voce nao tem iron ores o suficiente. Voce precisa de "..upgrade.quantOre.." iron ores.") end end end else doPlayerSendCancel(cid, "Esse item nao pode ser refinado.") end return true end Editado Novembro 2, 2014 10 anos por Kluivert (veja o histórico de edições)
Postado Novembro 3, 2014 10 anos testa assim e me diz se resolve local vocations = {11, 16, 21} local ids_bloqueados = {2160, 5706, 7893, 7892, 7894, 7895, 7896, 7897, 7898, 7899, 7901, 7902, 2640, 6132, 2195, 9932, 9933, 11350, 11297, 3982, 8857, 8855, 8856, 7438, 8858, 8854, 2456, 7366, 5907, 3965, 7378, 2389, 7367, 7368, 2425, 9932} local controle = { {level = 0, quantOre = 1, chance = 48}, {level = 1, quantOre = 2, chance = 33}, {level = 2, quantOre = 3, chance = 28}, {level = 3, quantOre = 4, chance = 27}, {level = 4, quantOre = 5, chance = 24}, {level = 5, quantOre = 6, chance = 20}, {level = 6, quantOre = 7, chance = 10}, {level = 7, quantOre = 8, chance = 8}, {level = 8, quantOre = 9, chance = 5}, {level = 9, quantOre = 10, chance = 2} } function getItemLevel(uid) if uid > 0 then return getItemAttribute(uid, "lvl") or 0 end return false end function doItemAddLevel(uid, count) if uid > 0 and tonumber(count) > 0 then return doItemSetAttribute(uid, "lvl", getItemLevel(uid) + count) end return false end function onUse(cid, item, fromPosition, itemEx, toPosition) if not isInArray(vocations, getPlayerVocation(cid)) then return doPlayerSendCancel(cid, "Apenas blacksmiths podem refinar.") elseif isInArray(ids_bloqueados, itemEx.uid) then return doPlayerSendCancel(cid, "Este item nao pode ser refinado.") end if getItemInfo(itemEx.itemid).attack > 0 or getItemInfo(itemEx.itemid).defense > 0 or getItemInfo(itemEx.itemid).armor > 0 then for _, upgrade in pairs(controle) do local atk = getItemAttribute(itemEx.uid, "attack") or getItemInfo(itemEx.itemid).attack local def = getItemAttribute(itemEx.uid, "defense") or getItemInfo(itemEx.itemid).defense local arm = getItemAttribute(itemEx.uid, "armor") or getItemInfo(itemEx.itemid).armor local chance = math.random(1, 100) if getItemLevel(itemEx.uid) == upgrade.level then if doPlayerRemoveItem(cid, 5880, upgrade.quantOre) then doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_CRAPS) if chance <= upgrade.chance then if getItemLevel(itemEx.uid) == 0 then doItemSetAttribute(itemEx.uid, "description", "Esse item foi refinado por " ..getCreatureName(cid)) end doItemAddLevel(itemEx.uid, 1) doItemSetAttribute(itemEx.uid, "name", getItemNameById(itemEx.itemid).. " + " ..getItemLevel(itemEx.uid)) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce refinou com sucesso!") if atk > 0 then doItemSetAttribute(itemEx.uid, "attack", atk + 1) return true elseif arm > 0 then doItemSetAttribute(itemEx.uid, "armor", arm + 1) return true elseif def > 0 then doItemSetAttribute(itemEx.uid, "defense", def + 1) return true end else doTransformItem(itemEx.uid, 2256) doItemSetAttribute(itemEx.uid, 'name', "metal trash") doItemSetAttribute(itemEx.uid, 'attack', 0) doItemSetAttribute(itemEx.uid, 'armor', 0) doItemSetAttribute(itemEx.uid, 'defense', 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce falhou.") return true end else doPlayerSendCancel(cid, "Voce nao tem iron ores o suficiente. Voce precisa de "..upgrade.quantOre.." iron ores.") end end end else doPlayerSendCancel(cid, "Esse item nao pode ser refinado.") end return true end
Postado Novembro 22, 2014 10 anos Autor Em 03/11/2014 em 07:31, xWhiteWolf disse: testa assim e me diz se resolve local vocations = {11, 16, 21} local ids_bloqueados = {2160, 5706, 7893, 7892, 7894, 7895, 7896, 7897, 7898, 7899, 7901, 7902, 2640, 6132, 2195, 9932, 9933, 11350, 11297, 3982, 8857, 8855, 8856, 7438, 8858, 8854, 2456, 7366, 5907, 3965, 7378, 2389, 7367, 7368, 2425, 9932} local controle = { {level = 0, quantOre = 1, chance = 48}, {level = 1, quantOre = 2, chance = 33}, {level = 2, quantOre = 3, chance = 28}, {level = 3, quantOre = 4, chance = 27}, {level = 4, quantOre = 5, chance = 24}, {level = 5, quantOre = 6, chance = 20}, {level = 6, quantOre = 7, chance = 10}, {level = 7, quantOre = 8, chance = 8}, {level = 8, quantOre = 9, chance = 5}, {level = 9, quantOre = 10, chance = 2} } function getItemLevel(uid) if uid > 0 then return getItemAttribute(uid, "lvl") or 0 end return false end function doItemAddLevel(uid, count) if uid > 0 and tonumber(count) > 0 then return doItemSetAttribute(uid, "lvl", getItemLevel(uid) + count) end return false end function onUse(cid, item, fromPosition, itemEx, toPosition) if not isInArray(vocations, getPlayerVocation(cid)) then return doPlayerSendCancel(cid, "Apenas blacksmiths podem refinar.") elseif isInArray(ids_bloqueados, itemEx.uid) then return doPlayerSendCancel(cid, "Este item nao pode ser refinado.") end if getItemInfo(itemEx.itemid).attack > 0 or getItemInfo(itemEx.itemid).defense > 0 or getItemInfo(itemEx.itemid).armor > 0 then for _, upgrade in pairs(controle) do local atk = getItemAttribute(itemEx.uid, "attack") or getItemInfo(itemEx.itemid).attack local def = getItemAttribute(itemEx.uid, "defense") or getItemInfo(itemEx.itemid).defense local arm = getItemAttribute(itemEx.uid, "armor") or getItemInfo(itemEx.itemid).armor local chance = math.random(1, 100) if getItemLevel(itemEx.uid) == upgrade.level then if doPlayerRemoveItem(cid, 5880, upgrade.quantOre) then doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_CRAPS) if chance <= upgrade.chance then if getItemLevel(itemEx.uid) == 0 then doItemSetAttribute(itemEx.uid, "description", "Esse item foi refinado por " ..getCreatureName(cid)) end doItemAddLevel(itemEx.uid, 1) doItemSetAttribute(itemEx.uid, "name", getItemNameById(itemEx.itemid).. " + " ..getItemLevel(itemEx.uid)) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce refinou com sucesso!") if atk > 0 then doItemSetAttribute(itemEx.uid, "attack", atk + 1) return true elseif arm > 0 then doItemSetAttribute(itemEx.uid, "armor", arm + 1) return true elseif def > 0 then doItemSetAttribute(itemEx.uid, "defense", def + 1) return true end else doTransformItem(itemEx.uid, 2256) doItemSetAttribute(itemEx.uid, 'name', "metal trash") doItemSetAttribute(itemEx.uid, 'attack', 0) doItemSetAttribute(itemEx.uid, 'armor', 0) doItemSetAttribute(itemEx.uid, 'defense', 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce falhou.") return true end else doPlayerSendCancel(cid, "Voce nao tem iron ores o suficiente. Voce precisa de "..upgrade.quantOre.." iron ores.") end end end else doPlayerSendCancel(cid, "Esse item nao pode ser refinado.") end return true end Funcionou nos shield´s, porém, ele não ta obedecendo aos itens de id bloqueados e as vezes o nome naum fica no metal trash de quem quebrou ! Obrigado! Editado Novembro 22, 2014 10 anos por Kluivert (veja o histórico de edições)
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.