Postado Fevereiro 15, 2018 7 anos Sistema simples de abrir uma box com algum objeto (No caso uma chave) e ter chance de ganhar outfits, items , montarias ou perder a chave. key_loot_crate.lua (Actions) local config = { key_break = 30, -- Porcentagem de chave quebrar crate_itemid = 1739, -- ItemID da Crate rewards = { [1] = { item = "addon", chance = 10, lookType = { [0] = 142, -- lookType Female [1] = 134, -- lookType Male }, addon = 2, name = "Warrior Sword", }, [2] = { item = "mount", chance = 20, mountId = 40, name = "Noble Lion", }, [3] = { item = {2160, 2}, chance = 30, }, [4] = { item = {2390, 1}, chance = 40, }, [5] = { item = {2195, 1}, chance = 50, }, [6] = { item = {2471, 2}, chance = 60, }, [7] = { item = {2469, 1}, chance = 70, }, [8] = { item = {2492, 2}, chance = 80, }, } } local function broadcast(message) for _, targetPlayer in ipairs(Game.getPlayers()) do targetPlayer:sendTextMessage(MESSAGE_STATUS_WARNING, message) end return true end function onUse(cid, item, fromPosition, itemEx, toPosition) local player = Player(cid) if (itemEx.itemid ~= config.crate_itemid) then return false end if (math.random(100) <= config.key_break) then toPosition:sendMagicEffect(3) player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Na tentativa de abrir a crate, sua chave quebrou!") else local random = math.random(100) local i = 1 while (i <= #config.rewards) do local v = config.rewards[i] if (random <= v.chance) then if (v.item == "addon") then local lookType = v.lookType[player:getSex()] if (not player:hasOutfit(lookType, v.addon)) then player:addOutfitAddon(lookType, v.addon) broadcast(player:getName() .. " abriu uma loot crate e ganhou o addon ".. v.name .. ".") i = 9999 break else random = math.random(100) end elseif(v.item == "mount") then if (not player:hasMount(v.mountId)) then player:addMount(v.mountId) broadcast(player:getName() .. " abriu uma loot crate e ganhou a montaria ".. v.name .. ".") i = 9999 break else random = math.random(100) end else local new_item = player:addItem(v.item[1], v.item[2]) if (type(new_item) == "table") then new_item = new_item[1] end broadcast(player:getName() .. " abriu uma loot crate e ganhou ".. v.item[2] .. " ".. new_item:getName() .. ".") i = 9999 break end end i = i + 1 end if (i == 9999) then toPosition:sendMagicEffect(14) player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Eh uma pena, mas a loot crate estava vazia.") else toPosition:sendMagicEffect(15) end end itemEx:remove() item:remove() return true end actions.xml <action itemid="22607" script="key_loot_crate.lua" /> <!-- Loot Crate Key --> HAVE FUN ! http://baiakuza.com/IP: baiakuza.com TIBIA: 10.96 Baiak Custom [ High Exp Rate ]
Postado Fevereiro 15, 2018 7 anos Parabéns, seu tópico de conteúdo foi aprovado! Muito obrigado pela sua contribuição, nós do Tibia King agradecemos. Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP. Spoiler Congratulations, your content has been approved! Thank you for your contribution, we of Tibia King we are grateful. Your content will help many other users, you received +1 REP. Talvez você queira ver: BestBaiak [FAQ]Remere's Map Editor - Dúvidas e soluções de bugs Contato: Discord:
Postado Fevereiro 15, 2018 7 anos Gostei do Sistema, Parabéns mano, sempre trazendo conteúdos de qualidade pra comunidade
Postado Maio 10, 2018 7 anos Testei ele é funcional, porém quando você ganha não aparece a mensagem dizendo ah você ganhou e talz aparece sempre: 23:14 É uma pena, mas a loot crate estava vazia. Sendo que eu ganhei o item kk
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.