Ir para conteúdo

Líderes

Conteúdo Popular

Exibindo conteúdo com a maior reputação em 04/22/24 em todas áreas

  1. [TFS 1.4.2] Boss Reward Chest System!!

    Forged reagiu a Mateus Robeerto por uma resposta no tópico

    1 ponto
    Este sistema é baseado em Reward Chests. Confira o Tibia Wiki para saber mais sobre como funciona. É simples! Em relação à Reward, ela será enviada para o depósito designado. Basta localizar a linha 'depotId' e especificar o numero que você deseja enviar para a cidade correspondente; isso garantirá a entrega direta ao depósito. Por exemplo, atribuir o número 1 para a cidade principal e 2 para Thais, e assim por diante, facilita esse processo. Confira o GIF aqui, basta clicar para ver. https://imgur.com/wNtfnS4 Este script está configurado para ativar um temporizador de 5 minutos após a expiração, removendo automaticamente o Reward Chest Id 21584. Caso deseje estender a duração ou ajustá-la com base nas diretrizes do Tibia Wiki, ele oferece versatilidade. Este sistema é particularmente adequado para salas de chefes onde a derrota do chefe resulta na transformação de seu cadáver no RewardChestId. Os jogadores interagem com ele e, após um período designado, o baú se dissipa. Quando você mata o chefe, ele morre e se transforma em um Baú de Recompensa com ID 21584. Siga o guia de instalação passo a passo fornecido aqui. Registre o evento no arquivo XML do monstro fornecido: <script> <event name="BossDeath"/> </script> Defina o cadáver do chefe como 0, caso contrário você receberá uma mensagem de loot adicional. <look type="201" corpse="0" /> Este é o RevScripts. Coloque o script em qualquer lugar na pasta data/scripts, seja em uma subpasta ou em sua localização preferida. local bossesList = { { name = "Orshabaal", storage = 6655, expirationTime = 5 * 60, loot = { {item = 2160, count = 5, chance = 100000}, {item = 2494, count = 1, chance = 50000}, }, RewardChestId = 21584, depotID = 1 }, { name = "Cave Rat", storage = 6656, expirationTime = 5 * 60, loot = { {item = 2160, count = 10, chance = 100000}, {item = 2498, count = 1, chance = 75000}, }, RewardChestId = 21584, depotID = 1 }, -- Add more bosses as needed } local STORAGE_KEYS = { bossData = "boss_data", } local function createRewardChest(bossPosition, rewardChestId, expirationTime) local rewardItem = Game.createItem(rewardChestId, 1, bossPosition) if rewardItem then rewardItem:setAttribute(ITEM_ATTRIBUTE_ACTIONID, ACTION_ID) addEvent(function() if rewardItem and rewardItem:getPosition() then rewardItem:remove() local players = Game.getPlayers() for _, player in ipairs(players) do player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The reward chest has disappeared!") end end end, expirationTime * 1000) else print("Error creating reward chest.") end end local function hasRewardExpired(player, storageKey) local expirationTime = player:getStorageValue(storageKey) return expirationTime ~= -1 and expirationTime <= os.time() end local creatureEvent = CreatureEvent("BossDeath") function creatureEvent.onDeath(creature, corpse) local bossPosition = creature:getPosition() local rewardChestId = 0 local depotID = 0 local bossName = "" for _, boss in ipairs(bossesList) do if creature:getName():lower() == boss.name:lower() then rewardChestId = boss.RewardChestId depotID = boss.depotID bossName = boss.name break end end if rewardChestId ~= 0 then createRewardChest(bossPosition, rewardChestId, bossesList[1].expirationTime) creature:say("The reward chest will disappear in 5 minutes!", TALKTYPE_MONSTER_SAY) else print("Reward chest ID not found.") end for _, player in ipairs(Game.getPlayers()) do if player:isPlayer() then for _, boss in ipairs(bossesList) do if creature:getName():lower() == boss.name:lower() then player:setStorageValue(boss.storage, 1) local expirationTime = os.time() + boss.expirationTime player:setStorageValue(STORAGE_KEYS.bossData, expirationTime) local message = "You contributed to defeating " .. boss.name .. ". Now go to the chest to claim your reward! Expiration time: " .. os.date("%c", expirationTime) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) end end end end end creatureEvent:register() local function sendRewardMessage(player, bossName, receivedItems) local message if #receivedItems > 0 then message = "From " .. bossName .. ": " .. table.concat(receivedItems, ", ") player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your reward has been sent to your depot.") else message = "From " .. bossName .. ": Unfortunately, you did not receive any items." player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) end end local rewardAction = Action() function rewardAction.onUse(player, item, fromPosition, target, toPosition, isHotkey) if not player or not player:isPlayer() or not item then return false end local depotID = 0 for _, boss in ipairs(bossesList) do if item:getId() == boss.RewardChestId and player:getStorageValue(boss.storage) == 1 then depotID = boss.depotID local storageKey = "boss_reward_time" if hasRewardExpired(player, storageKey) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Your reward from " .. boss.name .. " has expired.") else local depot = player:getDepotChest(depotID, true) -- Using depotID from the boss configuration if not depot then return false end local bag = depot:addItem(7343, 1) if not bag then print("Failed to add the reward bag to the player's depot.") return false end local receivedItems = {} for _, lootItem in ipairs(boss.loot) do if math.random(100000) <= lootItem.chance then local itemAdded = bag:addItem(lootItem.item, lootItem.count or 1) if itemAdded then local itemName = ItemType(lootItem.item):getPluralName() or ItemType(lootItem.item):getName() table.insert(receivedItems, (lootItem.count or 1) .. "x " .. itemName) end end end sendRewardMessage(player, boss.name, receivedItems) end player:setStorageValue(boss.storage, 0) player:setStorageValue(storageKey, -1) break end end return true end rewardAction:aid(ACTION_ID) rewardAction:register() Este script é a segunda versão. No Baú de Recompensa (por exemplo, no templo ou na sala do chefe), você deve configurá-lo usando o ID de Ação conforme mostrado na imagem. Confira o GIF aqui, basta clicar para ver. https://imgur.com/B9EezSM O indivíduo que infligiu o maior dano e outro que infligiu uma quantidade menor ambos recebem uma recompensa. Por outro lado, aqueles que não contribuíram com nenhum dano não recebem nenhuma recompensa. Este sistema opera de forma direta. Espero que você tenha achado esta explicação satisfatória. data/scripts. -- Define a table listing the bosses and their respective properties local bossesList = { { name = "Orshabaal", storage = 6655, expirationTime = 7 * 24 * 60 * 60, -- 7 days loot = { {item = 2160, count = 5, chance = 100000}, -- 100% chance {item = 2494, count = 1, chance = 50000}, -- 50% chance }, rewardChestId = 21584, -- Reward chest ID depotId = 1, -- Depot ID of the main city where the items will be sent }, { name = "Cave Rat", storage = 6656, expirationTime = 7 * 24 * 60 * 60, loot = { {item = 2160, count = 10, chance = 100000}, -- 100% chance {item = 2498, count = 1, chance = 75000}, -- 75% chance }, rewardChestId = 21584, -- Reward chest ID depotId = 1, -- Depot ID of the main city where the items will be sent }, -- Add more bosses as needed } local ACTION_ID = 2550 -- You need to open the RME Editor and set it to 2550, then save. local STORAGE_KEYS = { bossData = "boss_data" } -- Function to check if a reward has expired local function hasRewardExpired(player, storageKey) local expirationTime = player:getStorageValue(storageKey) return expirationTime ~= -1 and expirationTime <= os.time() end local creatureEvent = CreatureEvent("BossDeath") function creatureEvent.onDeath(creature, corpse, killer, mostDamageKiller) if killer and killer:isPlayer() then local creatureName = creature:getName():lower() for _, boss in ipairs(bossesList) do if creatureName == boss.name:lower() then -- Set reward data for the killer killer:setStorageValue(boss.storage, 1) local expirationTime = os.time() + boss.expirationTime killer:setStorageValue(STORAGE_KEYS.bossData, expirationTime) local message = "You contributed to defeating " .. boss.name .. ". Now go to the chest to claim your reward! Expiration time: " .. os.date("%c", expirationTime) killer:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) -- Check if there's a most damage killer if mostDamageKiller and mostDamageKiller:isPlayer() and mostDamageKiller:getId() ~= killer:getId() then mostDamageKiller:setStorageValue(boss.storage, 1) mostDamageKiller:setStorageValue(STORAGE_KEYS.bossData, expirationTime) local messageMostDamage = "You dealt the most damage to " .. boss.name .. ". Now go to the chest to claim your reward! Expiration time: " .. os.date("%c", expirationTime) mostDamageKiller:sendTextMessage(MESSAGE_EVENT_ADVANCE, messageMostDamage) end break end end end end creatureEvent:register() -- Function to send reward message to player local function sendRewardMessage(player, bossName, receivedItems) if #receivedItems > 0 then local message = "From " .. bossName .. ": " .. table.concat(receivedItems, ", ") player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your reward has been sent to your depot.") else local message = "From " .. bossName .. ": Unfortunately, you did not receive any items." player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) end end local rewardAction = Action() function rewardAction.onUse(player, item, fromPosition, target, toPosition, isHotkey) if not player or not player:isPlayer() or not item then return false end local rewardsClaimed = false for _, boss in ipairs(bossesList) do if item:getId() == boss.rewardChestId and player:getStorageValue(boss.storage) == 1 then local storageKey = STORAGE_KEYS.bossData if hasRewardExpired(player, storageKey) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your reward from " .. boss.name .. " has expired.") else local depot = player:getDepotChest(boss.depotId, true) if not depot then return false end local bag = depot:addItem(7343, 1) if not bag then print("Failed to add the reward bag to the player's depot.") return false end local receivedItems = {} for _, lootItem in ipairs(boss.loot) do if math.random(100000) <= lootItem.chance then local itemAdded = bag:addItem(lootItem.item, lootItem.count or 1) if itemAdded then local itemName = ItemType(lootItem.item):getPluralName() or ItemType(lootItem.item):getName() table.insert(receivedItems, (lootItem.count or 1) .. "x " .. itemName) end end end if #receivedItems > 0 then sendRewardMessage(player, boss.name, receivedItems) player:setStorageValue(boss.storage, 0) player:setStorageValue(storageKey, -1) rewardsClaimed = true else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You did not receive any items from " .. boss.name .. ".") end end end end if not rewardsClaimed then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to defeat the corresponding boss first to receive the reward.") return false end return true end rewardAction:aid(ACTION_ID) rewardAction:register() O que eu fiz foi reescrever o script do zero, créditos para mim mesmo. Espero que gostem deste conteúdo!
  2. 1 ponto
    Muito bom!
  3. talkaction !comprar skill tfs 1.4

    mane stick reagiu a Mateus Robeerto por uma resposta no tópico

    1 ponto
    Esse script que eu postei é apenas para TFS 1x+, funcionando sem modificações no OTX/OTG misturado, e está tudo funcionando normalmente. O usuário @mane stick me procurou pelo Discord e, depois de pensar sobre isso, aceitei. Fiz as alterações necessárias para torná-lo compatível com OTX/OTG, e agora está funcionando perfeitamente. Ele disse que está tudo ok após os testes. data/scripts -- Definição das habilidades e suas características local skills = { ["magiclevel"] = {vocations = {1, 5, 2, 6, 11, 12}, voc_msg= "Somente Sorcerers, Druids e Infernalists podem comprar magic level.", lim = 200, lim_msg = "Você não pode ter magic level acima de 200.", price= 3, incre = 1, skill = SKILL_MAGLEVEL}, ["skillclub"] = {vocations = {1, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", lim = 350, lim_msg = "Você não pode ter skill club acima de 350.", price= 1, incre = 1, skill = SKILL_CLUB}, ["skillsword"] = {vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", lim = 350, lim_msg = "Você não pode ter skill sword acima de 350.", price= 1, incre = 1, skill = SKILL_SWORD}, ["skillaxe"] = {vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", lim = 350, lim_msg = "Você não pode ter skill axe acima de 350.", price= 1, incre = 1, skill = SKILL_AXE}, ["skilldistance"] = {vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", lim = 350, lim_msg = "Você não pode ter skill distance acima de 350.", price= 1, incre = 1, skill = SKILL_DISTANCE}, ["skillshielding"] = {vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", lim = 350, lim_msg = "Você não pode ter skill shielding acima de 350.", price= 1, incre = 1, skill = SKILL_SHIELD}, ["magiclevel5"] = {vocations = {1, 5, 2, 6, 11, 12}, voc_msg= "Somente Sorcerers, Druids e Infernalists podem comprar magic level.", lim = 200, lim_msg = "Você não pode pode ter magic level acima de 200.", price= 15, incre = 5, skill = SKILL_MAGLEVEL}, ["skillclub10"] = {vocations = {9, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", lim = 350, lim_msg = "Você não pode ter skill club acima de 350.", price= 10, incre = 10, skill = SKILL_CLUB}, ["skillsword10"] = {vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", lim = 350, lim_msg = "Você não pode ter skill sword acima de 350.", price= 10, incre = 10, skill = SKILL_SWORD}, ["skillaxe10"] = {vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", lim = 350, lim_msg = "Você não pode ter skill axe acima de 350.", price= 10, incre = 10, skill = SKILL_AXE}, ["skilldistance10"] = {vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", lim = 350, lim_msg = "Você não pode ter skill distance acima de 350.", price= 10, incre = 10, skill = SKILL_DISTANCE}, ["skillshielding10"] = {vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", lim = 350, lim_msg = "Você não pode ter skill shielding acima de 350.", price= 10, incre = 10, skill = SKILL_SHIELD}, } -- Função para obter o nome da habilidade com base no ID local function getPlayerSkillName(skillId) local skillNames = { [SKILL_CLUB] = "Club", [SKILL_SWORD] = "Sword", [SKILL_AXE] = "Axe", [SKILL_DISTANCE] = "Distance", [SKILL_SHIELD] = "Shielding", [SKILL_MAGLEVEL] = "Magic Level" } return skillNames[skillId] or "Unknown" end local function buySkill(player, skillData) local coinID = 9971 -- ID da moeda utilizada para compra local storage = 45611 -- Valor de armazenamento para controle de tempo if player:getItemCount(coinID) < skillData.price then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Você não possui a quantidade necessária para comprar.") return false end local skillId = skillData.skill local skillName = getPlayerSkillName(skillId) local currentSkill if skillId == SKILL_MAGLEVEL then currentSkill = player:getMagicLevel() else currentSkill = player:getSkillLevel(skillId) end if currentSkill == nil then player:sendCancelMessage("Você não possui essa habilidade.") return false end if skillId == SKILL_MAGLEVEL then local newMagLevel = currentSkill + skillData.incre if newMagLevel > skillData.lim then player:sendCancelMessage(skillData.lim_msg) return false end local target = player target:addManaSpent(target:getVocation():getRequiredManaSpent(target:getBaseMagicLevel() + 1) - target:getManaSpent()) print("Player: " .. player:getName() .. " adquiriu " .. skillData.incre .. " níveis de magic level. Novo magic level: " .. newMagLevel) else local target = player target:addSkillTries(skillId, target:getVocation():getRequiredSkillTries(skillId, target:getSkillLevel(skillId) + 1) - target:getSkillTries(skillId)) print("Player: " .. player:getName() .. " adquiriu " .. skillData.incre .. " níveis em " .. skillName) end if not isInArray(skillData.vocations, player:getVocation():getId()) then player:sendCancelMessage(skillData.voc_msg) return false end player:removeItem(coinID, skillData.price) player:setStorageValue(storage, os.time() + 1) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Você comprou " .. skillData.incre .. " níveis em " .. skillName .. " por " .. skillData.price .. " moedas.") return true end local buyComprar = TalkAction("!comprar") function buyComprar.onSay(player, words, param) local param = param:lower() local tile = player:getTile() if not tile or not tile:hasFlag(TILESTATE_PROTECTIONZONE) then player:sendCancelMessage("Você precisa estar em área protegida para utilizar este comando.") return false end local storage = 45611 -- Valor de armazenamento para controle de tempo if player:getStorageValue(storage) >= os.time() then player:sendCancelMessage("Por medidas de segurança você só pode utilizar este comando em " .. (player:getStorageValue(storage) - os.time()) .. " segundos.") return false end if param == "" or not skills[param] then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Comando inválido ou habilidade não encontrada. Use !comprar <habilidade> para comprar.") return false end local skillData = skills[param] local playerVocation = player:getVocation():getId() if not isInArray(skillData.vocations, playerVocation) then player:sendCancelMessage("Sua vocação não pode comprar essa habilidade.") return false end return buySkill(player, skillData) end buyComprar:separator(" ") buyComprar:register()
Líderes está configurado para São Paulo/GMT-03:00

Informação Importante

Confirmação de Termo