Ir para conteúdo

Alumoz

Membro
  • Registro em

  • Última visita

Solutions

  1. Alumoz's post in Script Tfs1.3 Chest Chance was marked as the answer   
    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()  
     
     

Informação Importante

Confirmação de Termo