Postado Novembro 3, 2020 4 anos Evento Monster Hunt Durante uma hora, o player que mais matar um monstro específico ganha o evento. Na pasta lib, crie um arquivo chamado monsterHunt.lua com isso dentro MONSTER_HUNT = { list = {"Demon", "Rotworm", "Cyclops"}, days = { ["Sunday"] = {"13:55"}, ["Monday"] = {"13:55"}, ["Tuesday"] = {"13:55"}, ["Wednesday"] = {"13:55"}, ["Thursday"] = {"13:55"}, ["Friday"] = {"13:55"}, ["Saturday"] = {"13:55"}, }, messages = { prefix = "[Monster Hunt] ", warnInit = "O evento irá começar em %d minuto%s. Seu objetivo será matar a maior quantidade de monstros escolhidos pelo sistema.", init = "O monstro escolhido pelo sistema foi %s. Você tem 1 hora para matar a maior quantidade desse monstro.", warnEnd = "Faltam %d minuto%s para acabar o evento. Se apressem!", final = "O jogador %s foi o ganhador do evento! Parabéns.", noWinner = "Não houve ganhadores no evento.", reward = "Você recebeu o seu prêmio no mailbox!", kill = "Você já matou {%d} %s do evento.", }, rewards = { {id = 2160, count = 100}, }, storages = { monster = 891641, player = 891642, }, players = {}, } function MONSTER_HUNT:initEvent() Game.setStorageValue(MONSTER_HUNT.storages.monster, 0) Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnInit:format(5, "s")) addEvent(function() Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnInit:format(3, "s")) end, 2 * 60 * 1000) addEvent(function() Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnInit:format(1, "")) end, 4 * 60 * 1000) addEvent(function() local rand = math.random(#MONSTER_HUNT.list) Game.setStorageValue(MONSTER_HUNT.storages.monster, rand) Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.init:format(MONSTER_HUNT.list[rand])) end, 5 * 60 * 1000) return true end function MONSTER_HUNT:endEvent() Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnEnd:format(5, "s")) addEvent(function() Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnEnd:format(3, "s")) end, 2 * 60 * 1000) addEvent(function() Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnEnd:format(1, "")) end, 4 * 60 * 1000) addEvent(function() if #MONSTER_HUNT.players == nil then Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.noWinner) return end table.sort(MONSTER_HUNT.players, function(a,b) return a[2] > b[2] end) local player = Player(MONSTER_HUNT.players[1][1]) if player then Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.final:format(player:getName())) player:setStorageValue(MONSTER_HUNT.storages.player, -1) for c, d in ipairs(MONSTER_HUNT.rewards) do local item = Game.createItem(d.id, d.count) player:addItemEx(item) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.reward) player:getPosition():sendMagicEffect(30) end --[[ Função exclusiva (ignore) else local player = Player(MONSTER_HUNT.players[1][1], true) if not player then return false end Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.final:format(player:getName())) player:setStorageValue(MONSTER_HUNT.storages.player, -1) for c, d in ipairs(MONSTER_HUNT.rewards) do local item = Game.createItem(d.id, d.count) player:getInbox():addItemEx(item, INDEX_WHEREEVER, FLAG_NOLIMIT) end player:delete() --]] end for a, b in pairs(MONSTER_HUNT.players) do local player = Player(b[1]) if player then player:setStorageValue(MONSTER_HUNT.storages.player, 0) MONSTER_HUNT.players[a] = nil --[[ Função exclusiva (ignore) else player = Player(b[1], true) player:setStorageValue(MONSTER_HUNT.storages.player, 0) MONSTER_HUNT.players[a] = nil player:delete() --]] end end Game.setStorageValue(MONSTER_HUNT.storages.monster, -1) end, 5 * 60 * 1000) return true end Não esqueça de registrar essa lib no lib.lua Agora em globalevents, crie um arquivo na pasta scripts com isso dentro function onThink(interval) if MONSTER_HUNT.days[os.date("%A")] then local hrs = tostring(os.date("%X")):sub(1, 5) if isInArray(MONSTER_HUNT.days[os.date("%A")], hrs) then MONSTER_HUNT:initEvent() end end return true end function onTime(interval) MONSTER_HUNT:endEvent() return true end Não esqueça de adicionar a tag no globalevents <globalevent name="MonsterHunt" interval="60000" script="custom/events/monsterHunt.lua" /> <globalevent name="MonsterHuntEnd" time="14:55" script="custom/events/monsterHunt.lua" /> Agora em creaturescripts, crie um arquivo na pasta scripts com isso dentro function onKill(player, target) if Game.getStorageValue(MONSTER_HUNT.storages.monster) == nil then return true end if not player or not target then return true end if player:getStorageValue(MONSTER_HUNT.storages.player) == -1 then player:setStorageValue(MONSTER_HUNT.storages.player, 0) end if target:isMonster() and target:getName():lower() == (MONSTER_HUNT.list[Game.getStorageValue(MONSTER_HUNT.storages.monster)]):lower() then player:setStorageValue(MONSTER_HUNT.storages.player, player:getStorageValue(MONSTER_HUNT.storages.player) + 1) player:sendTextMessage(MESSAGE_STATUS_BLUE_LIGHT, MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.kill:format(player:getStorageValue(MONSTER_HUNT.storages.player), target:getName())) table.insert(MONSTER_HUNT.players, {player:getId(), player:getStorageValue(MONSTER_HUNT.storages.player)}) end return true end Com a tag no creaturescripts <event type="kill" name="MonsterHunt" script="custom/monsterHunt.lua" /> Não esqueça de registrar o evento no login.lua player:registerEvent("MonsterHunt") Bom aproveito. Créditos: 100% meu Baiak Thunder New TFS Downgrade [TFS 1.5 - 8.60] Gesior Ferobra Downgrade Evento Monster Hunt [TFS 1.X] Evento SafeZone [TFS 1.X] Online Bonus System [TFS 1.X] Dodge & Critical [TFS 1.X] Nova moeda, funcionando com NPCs [TFS 1.X] Square System [TFS 1.X] Loot Channel [TFS 1.X] Gerenciador de Quests [All TFS] NPCs comprando vial/flasks por storage [TFS 1.X] AntiBot [TFS 1.X] Como compilar TFS 0.X
Postado Novembro 19, 2020 4 anos como posso usar se meu ot e do revscripts? nao tem folder de movements e de creaturescripts
Postado Janeiro 9, 2021 4 anos @Breno Alves Da pra colocar itens aleatórios ? Editado Janeiro 9, 2021 4 anos por amoxicilina (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.