Postado Abril 10, 2022 3 anos Não entendi o motivo de (código abaixo) existir, mas mantive. if item.uid == 1995 then doTransformItem(item.uid, item.itemid - 1) end Eu modifiquei o código para o abaixo, mas acredito que não vai funcionar pois lua (compilador online) está iterando de forma crescendo em números e terá problema com as chances. local config = { successMessage = "O monstro foi sumonado com sucesso.", failMessage = "O summon não funcionou.", successEffect = CONST_ME_MAGIC_RED, failEffect = CONST_ME_POFF, failChance = 76, -- chance > x position = { x = 350, y = 1261, z = 9, stackpos = 255 } } local lukyFromItem = { [6548] = { monsterPosition = { x = 324, y = 1268, z = 9 }, chances = { -- chance > x [75] = "Nephthys", [50] = "Dragon Guardian", [25] = "Minotaur Mage", [0] = "Thunder Dragon" } }, [6549] = { monsterPosition = { x = 324, y = 1256, z = 9 }, chances = { -- chance > x [75] = "Guardiao da Montanha", [50] = "Juggernaut", [25] = "Multi", [0] = "Hydra" } }, [6550] = { monsterPosition = { x = 324, y = 1265, z = 9 }, chances = { -- chance > x [75] = "Dourado", [50] = "Hellfire Fighter", [25] = "Fire Elemental", [0] = "Demon" } }, [6551] = { monsterPosition = { x = 324, y = 1259, z = 9 }, chances = { -- chance > x [75] = "Gigante de Gelo", [50] = "Frost Dragon", [25] = "Papao", [0] = "Gigante de Gelo" } } } function onUse(cid, item, frompos, item2, topos) local thing = getThingfromPos(config.position) if not thing then return end local luky = lukyFromItem[thing.itemid] if not luky then return end if item.uid == 1995 then doTransformItem(item.uid, item.itemid - 1) -- menos 1 ou mais 1? end local randomChance = math.random(1, 100) if randomChance > config.failChance then doPlayerSendTextMessage(cid, 22, config.failEffect) -- doTransformItem(item.uid, item.itemid + 1) ??? doRemoveItem(thing.uid, 1) doSendMagicEffect(frompos, config.failEffect) return true end doRemoveItem(thing.uid, 1) for monsterChance, monsterSpawn in pairs(luky.chances) do -- iterando de forma crescente, problema com chance? if randomChance > monsterChance then doSummonCreature(monsterSpawn, luky.monsterPosition) doSendMagicEffect(frompos, config.successEffect) doPlayerSendTextMessage(cid, 22, config.successMessage) return true end end return true end Editado Abril 10, 2022 3 anos por Ramon Bernardo (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.