lepiigor 16 #1 Posted March 17, 2021 (edited) Olá Hoje eu compartilho, seja qual for o sistema de código antigo, a caixa de mistério, Simplesmente peguei linhas de script da direita para a esquerda para finalmente conseguir montar este script, que funciona! REWARD: item obtido JEWEL: 10% de chance de obter um item adicional Ele agita um objeto simples, mas também adiciona cargas locais para dar cargas correspondentes ao anel e amuleto ITEM ACTION: 11401 - Tibiora's box local storeBox = Action() local REWARD = {2471, 2496, 2343, 7902, 18398, 8868, 8867, 15489, 12643, 8887, 8886, 8885, 8877, 8878, 15407, 8884, 8881, 12607, 8889, 8865, 8890, 6132, 11117, 11118, 11240, 9933, 2358, 9777, 18405, 2469} local JEWEL = {2171, 2661, 2168, 2214, 2165, 2213, 2207, 2169, 2122, 2127, 2124, 2121, 7697, 13825, 6300} function storeBox.onUse(cid, item, fromPosition, itemEx, toPosition) local randomChance = math.random(1, #REWARD) doPlayerAddItem(cid, REWARD[randomChance], 1) local randomLoot = math.random(1,20) if randomLoot == 1 then doPlayerSendTextMessage(cid, 19, "You found an extra item!") local randomChance = math.random(1, #REWARD) doPlayerAddItem(cid, REWARD[randomChance], 1) end local randomJewel = math.random(1,10) if randomJewel == 1 then doPlayerSendTextMessage(cid, 19, "You found a jewel!") local charges = math.random(50, 150) local randomChance = math.random(1, #JEWEL) doPlayerAddItem(cid, JEWEL[randomChance], 1) end doSendMagicEffect(getPlayerPosition(cid), 73) doRemoveItem(item.uid, 1) return true end storeBox:id(11401) storeBox:register() se você precisar adicionar um item, por exemplo moedas de ouro com um número aleatório, mude para REWARD O JEWEL, tome cuidado, pois isso dará um número para todos os itens na categoria! procurar: local randomJewel = math.random(1,10) if randomJewel == 1 then doPlayerSendTextMessage(cid, 19, "You found a jewel!") local charges = math.random(50, 150) local randomChance = math.random(1, #JEWEL) doPlayerAddItem(cid, JEWEL[randomChance], 1) end mude: local randomJewel = math.random(1,10) if randomJewel == 1 then doPlayerSendTextMessage(cid, 19, "You found a jewel!") local randomChance = math.random(1, #JEWEL) doPlayerAddItem(cid, JEWEL[randomChance], math.random(5, 100)) end Edited March 17, 2021 by lepiigor 2 NuncaVi and Majesty reacted to this Share this post Link to post
Majesty 1,755 #2 Posted March 17, 2021 Muito obrigado pela sua contribuição, seu conteúdo foi aprovado!Nós do OTServ Brasil agradecemos, seu conteúdo com certeza ajudará a muitos outros. Você recebeu +1 REP! Share this post Link to post