Postado Abril 29, 2017 8 anos olá venho pedir a vocês uma script tipo a gold box ou surprise bag ou glooth bag que você clica e ganha X iten aleatoriamente com chance de 1% a 100% claro isso a pessoa mudaria de acordo com oque acha OBS abaixo deixo a script da glooth bag se alguem conseguir adicionar a % de drop na script ou me passar uma ficaria feliz, obrigado -- <action itemid="23574" script="other/glooth_bag.lua"/> local items = { glooth_spears = 23529, glooth_amulet = 23554, glooth_club = 23549, glooth_axe = 23551, glooth_blade = 23550, glooth_backpack = 23666, glooth_sandwiches = 23514, glooth_soup = 23515, glooth_steaks = 23517, control_unit = 23557, } function onUse(player, item, fromPosition, target, toPosition, isHotkey) local rand = math.random(1, 100) if rand <= 15 then player:addItem(items.glooth_spears, 2) elseif rand >= 16 and rand <= 23 then player:addItem(items.glooth_amulet, 1) elseif rand >= 24 and rand <= 32 then player:addItem(items.glooth_club, 1) elseif rand >= 33 and rand <= 50 then player:addItem(items.glooth_axe, 1) elseif rand >= 51 and rand <= 64 then player:addItem(items.glooth_blade, 1) elseif rand >= 65 and rand <= 75 then player:addItem(items.glooth_backpack, 1) elseif rand >= 76 and rand <= 86 then player:addItem(items.glooth_sandwiches, 10) elseif rand >= 87 and rand <= 96 then player:addItem(items.glooth_soup, 10) elseif rand >= 97 and rand <= 99 then player:addItem(items.control_unit, 1) elseif rand == 100 then player:addItem(items.glooth_steaks, 10) end item:remove(1) return true end
Postado Abril 30, 2017 8 anos -- id = id do item -- chance = chance em porcentagem (valido de 1 a 100, decimal invalido) -- count = quantidade que ira ganhar do item local itemsReward = { {id = 1000, chance = 40, count = 1}, {id = 2000, chance = 20, count = 5} } local function sortItem() local selectedItem = nil while (!selectedItem) do for i = 1, #itemsReward do local randomNumber = math.random(100) if (randomNumber > itemsReward[i].chance) then selectedItem = itemsReward[i] break end end end return selectedItem end function onUse(player, item, fromPosition, target, toPosition, isHotkey) local rewardItem = sortItem() player:addItem(rewardItem.id, rewardItem.count) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Voce ganhou [" ..ItemType(rewardItem.id):getName().."] " ..rewardItem.count.. "x!") end Teste e avise se funcionou. https://github.com/Cjaker/ , _ , ( o o ) /'` ' `'\ ESTOU TE OBSERVANDO O_O |'''''''| |\\'''//| """
Postado Maio 1, 2017 8 anos Autor @ES Ichigo vou testar já aviso. @ES Ichigo amigo minha tfs é 1x global 10.99 do OTX fiz da seguinte maneira <action itemid="23754" script="other/gold box.lua"/> -- 23754 id da stone of insight lua ficou assim -- id = 23754 -- chance = chance em porcentagem (valido de 1 a 100, decimal invalido) -- count = quantidade que ira ganhar do item local itemsReward = { {id = 2160, chance = 40, count = 5}, {id = 2142, chance = 20, count = 5} } local function sortItem() local selectedItem = nil while (!selectedItem) do for i = 1, #itemsReward do local randomNumber = math.random(100) if (randomNumber > itemsReward.chance) then selectedItem = itemsReward break end end end return selectedItem end function onUse(player, item, fromPosition, target, toPosition, isHotkey) local rewardItem = sortItem() player:addItem(rewardItem.id, rewardItem.count) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Voce ganhou [" ..ItemType(rewardItem.id):getName().."] " ..rewardItem.count.. "x!") end
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.