Postado Junho 27, 2022 2 anos .Qual servidor ou website você utiliza como base? Znote Qual o motivo deste tópico? Script Ola pessoal, estou procurando um script tfs 1.3, um baú tem 10% de chance de saquear um item (como 10 itens no total, aleatório com chance) Se eu obtiver, por exemplo, um item, aumentarei 5% essa chance para 10 + 5 % para obter um item, se eu usar 10 items aumentarei para 10+50%, Chance de cada item diferente, como 60% 10 crystal coins, 20% uma bp, 5% uma runa, etc. removendo o item enquanto estiver usando o baú. Não tenho certeza se é possível fazer esse tipo de script Eu sei que poderiamos usar atributos como: mas nao sei como criar esse tipo de script, cooldown_storage = 44444 cooldown = 60 * 60 * 2 player:setStorageValue(config.cooldown_storage, os.time() + config.cooldown) _____________________________________________________________________________ local box = Action() local JEWEL = {2152, 2148} local REWARD = {2160} function box.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, 22, "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, 22, "You found an extra item!") local randomChance = math.random(1, #JEWEL) doPlayerAddItem(cid, JEWEL[randomChance], 1) end doSendMagicEffect(getPlayerPosition(cid), 172) doRemoveItem(item.uid, 1) return true end box:id(18100) box:register() Obrigado
Postado Junho 29, 2022 2 anos explica melhor sua ideia, não deu pra entender exatamente o que você quer usa o baú e tem 10% de chance de ganhar item e 90% de não ganhar? isso? Toda terça-feira um tópico novo: Descanso para curar mana (Spell): https://tibiaking.com/forums/topic/94615-spell-descanso-para-curar-mana/ Peça sua spell (Suporte): https://tibiaking.com/forums/topic/84162-peça-sua-spell/ Chuva de flechas (Spell): https://tibiaking.com/forums/topic/72232-chuva-de-flechas-spell/ Doom (Spell): https://tibiaking.com/forums/topic/51622-doom-spell/ Utilização do VS Code (Infra): https://tibiaking.com/forums/topic/94463-utilizando-o-visual-studio-code-notepad-nunca-mais/ SD com Combo (Spell): https://tibiaking.com/forums/topic/94520-sd-modificada/ Alteração attack speed (C++): https://tibiaking.com/forums/topic/94714-c-attack-speed-spells-itens-e-onde-você-quiser/ Bônus de Speed (NPC): https://tibiaking.com/forums/topic/94809-npc-concede-bônus-aos-players/
Postado Julho 2, 2022 2 anos Autor Solução Em 29/06/2022 em 04:24, Reds disse: explica melhor sua ideia, não deu pra entender exatamente o que você quer usa o baú e tem 10% de chance de ganhar item e 90% de não ganhar? isso? Olá desculpe a demora na resposta, parece que o site .com está inacessível, exceto se você clicar em fóruns, eu finalmente encontrei local config = { actionId = 45001, baseChance = 100, cooldown = { active = true, key = 11111, value = 64800 }, chanceIncreasers = { [1111] = {chanceIncrease = 10} }, rewards = { {itemId = 1111, minCount = 1, maxCount = 1, chance = 500}, {itemId = 2222, minCount = 1, maxCount = 10, chance = 50}, {itemId = 3333, minCount = 10, maxCount = 50, chance = 5} } } local rewardChest = Action() function rewardChest.onUse(player, item, fromPosition, target, toPosition, isHotkey) if config.cooldown.active then local currentTime = os.time() local currentStorage = player:getStorageValue(config.cooldown.key) if currentStorage > currentTime then player:sendCancelMessage("Currently on cooldown. Can use again in ".. os.date("!%Hh %Mm %Ss", currentStorage - currentTime) .."") return true end player:setStorageValue(config.cooldown.key, (currentTime + config.cooldown.value)) end local chance = config.baseChance for v, k in pairs(config.chanceIncreasers) do local increaserCount = player:getItemCount(v) local increasersUsed = 0 while chance < 1000 and increaserCount > 0 do chance = chance + k.chanceIncrease increasersUsed = increasersUsed - 1 end player:removeItem(config.itemChanceIncreaserId, increasersUsed) end local rand = math.random(1000) if chance > rand then player:say("No reward.", TALKTYPE_MONSTER_SAY) return true end local rewardList = {} while #rewardList < 1 do for i = 1, #config.rewards do rand = math.random(1000) if rand <= config.rewards[i].chance then rewardList[#rewardList + 1] = i end end end rand = math.random(#rewardList) player:addItem(config.rewards[rand].itemId, math.random(config.rewards[rand].minCount, config.rewards[rand].maxCount), true) player:say("Received " .. ItemType(config.rewards[rand].itemId):getName():lower() .. " as reward.", TALKTYPE_MONSTER_SAY) return true end rewardChest:aid(config.actionId) rewardChest:register() Editado Julho 2, 2022 2 anos por Alumoz (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.