Postado Janeiro 6, 2018 7 anos Fala, galera! então, hoje eu vim pedir a vocês 3 scripts que não acho que sejam tão difíceis. Os scripts seriam para o mapa ir "encolhendo" e quem ficasse fora da área, começava a tomar hit. Outro para se inscrever na sala, e quando tivesse ex: 10 jogadores, o jogo começava. E por último, um baú que apareceria aleatoriamente pelo mapa Editado Janeiro 6, 2018 7 anos por Yamborghini (veja o histórico de edições)
Postado Janeiro 6, 2018 7 anos Vou tentar fazer aqui. Vai ter que ser tudo em um só script, porém, porque se não vai pesar muito. Não garanto que termino hoje a noite. Aproveitando, qual TFS está usando? [EDIT] Parte feita do script ate o momento, devo terminar amanhã se tudo der certo. Citar local config = { uniqueID = 5000, maxPlayers = 1, entrada = { {x = 396, y = 1746, z = 9, stackpos = 253} }, saida = { {x = 399, y = 1746, z = 9, stackpos = 253} }, timeSafe = 2000, timeSafe2 = 6000, arenaMinPos = {x = 395, y = 1747}, arenaMaxPos = {x = 399, y = 1743}, safeMinPos = {x = 395, y = 1747}, safeMaxPos = {x = 399, y = 1743} } function onUse(cid, item, frompos, item2, topos) if item.uid == config.uniqueID then local players = {} for i=1, config.maxPlayers do players = getThingfromPos (config.entrada) if isPlayer(players.uid) == FALSE then doPlayerSendTextMessage (cid, 22, "You need ".. config.maxPlayers .. " players.") return TRUE end end for i=1, config.maxPlayers do doSendMagicEffect(config.entrada, 2) doTeleportThing(players.uid, config.saida) doPlayerSendTextMessage (players.uid, 22, "You are going to arena.") doSendMagicEffect(config.saida, 2) addEvent(safeHurt, config.timeSafe, players.uid) end addEvent (reduceSafe, config.timeSafe2, players) end return TRUE end function safeHurt (player) if isInArena (player) == TRUE then if isSafe (player) then -- nothing else doPlayerAddHealth(player, -200) doSendMagicEffect(player, 0) end addEvent (safeHurt, timeSafe, player) else return FALSE end end function isInArena (player) playerPos = getPlayerPosition(player) if config.arenaMinPos.x <= playerPos.x and playerPos.x <= config.arenaMaxPos.x then if playerPos.y <= config.arenaMinPos.y and playerPos.y >= config.arenaMaxPos.y then return TRUE end end return FALSE end function isSafe (player) local playerPos = getPlayerPosition(player) if playerPos.x == 398 and playerPos.y == 1746 then return TRUE end return FALSE end function reduceSafe (players) quadrante = math.random(1, 4) if quadrante == 1 then config.safeMinPos.y = (config.safeMinPos.y + config.safeMaxPos.y) / 2 config.safeMaxPos.x = (config.safeMinPos.x + config.safeMaxPos.x) / 2 elseif quadrante == 2 then config.safeMinPos.x = (config.safeMinPos.x + config.safeMaxPos.x) / 2 config.safeMinPos.y = (config.safeMinPos.y + config.safeMaxPos.y) / 2 elseif quadrante == 3 then config.safeMaxPos.x = (config.safeMinPos.x + config.safeMaxPos.x) / 2 config.safeMaxPos.y = (config.safeMinPos.y + config.safeMaxPos.y) / 2 else config.safeMaxPos.y = (config.safeMinPos.y + config.safeMaxPos.y) / 2 config.safeMinPos.x = (config.safeMinPos.x + config.safeMaxPos.x) / 2 end continue = false for i=1, config.maxPlayers do if isInArena (players.uid) then local pos = getPlayerPosition(players.uid) doPlayerSendTextMessage (players.uid, 22, pos.x .. " - ".. pos.y) doPlayerSendTextMessage (players.uid, 22, "Nova safe zone no quadrante ".. quadrante .. "!") continue = true else doPlayerSendTextMessage (players.uid, 22, "vc n ta !") end end if continue == true then addEvent (reduceSafe, config.timeSafe2, players) else return true end end Editado Janeiro 6, 2018 7 anos por marcot (veja o histórico de edições)
Postado Janeiro 6, 2018 7 anos Autor Opa! estou usando TFS 0.4 8.6! Poderia por uma legenda de edição? pq n entendi MT, por ser tudo num Script só
Postado Janeiro 6, 2018 7 anos @Yamborghini Testa com esse script daqui: Em data/actions/scripts/ crie um arquivo chamado battle_royale.lua e cole dentro dele: local config = { uniqueID = 5000, -- Unique ID do ativador do evento (alavanca) maxPlayers = 1, -- Quantidade Z de jogadores necessaria entrada = { -- Z posicoes de entrada dos jogadores {x = 396, y = 1746, z = 9, stackpos = 253} }, saida = { -- Z posicoes de saida dos jogadores {x = 399, y = 1746, z = 9, stackpos = 253} }, timeSafe = 2000, -- timeSafe2 = 6000, -- Tempo para reduzir arenaMinPos = {x = 395, y = 1747}, -- Ponto inferior da arena (esquerda) arenaMaxPos = {x = 399, y = 1743}, -- Ponto superior da arena (direita) -- Deixar mesmos valores da arenaMinPos e arenaMaxPos safeMinPos = {x = 395, y = 1747}, safeMaxPos = {x = 399, y = 1743}, -- Dano causado pela playzone safeDamage_perTick = 2000, -- Efeito do dano causado pela playzone safeDamage_perTickEffect = 11, -- Configuracoes de Mensagens -- Mensagem exibida ao ser teleportado arenaMsg = "Voce foi enviado para a arena.", -- Mensagem exibida ao receber dano safeDmgMsg = "Voce sofreu dano pela playzone.", -- Lista de Itens "Airdrop" airdropID = 1740, listaItens = { -- Exemplo: {itemID, qt} {id = 2125, count = 1}, {id = 2195, count = 1} } } function onUse(cid, item, frompos, item2, topos) if item.uid == config.uniqueID then local players = {} -- Verifica se tem Z jogadores for i=1, config.maxPlayers do players[i] = getThingfromPos (config.entrada[i]) if isPlayer(players[i].uid) == FALSE then doPlayerSendTextMessage (cid, 22, "You need ".. config.maxPlayers .. " players.") return TRUE end end -- Teleporta os Z jogadores para a arena for i=1, config.maxPlayers do doSendMagicEffect(config.entrada[i], 2) doTeleportThing(players[i].uid, config.saida[i]) doPlayerSendTextMessage (players[i].uid, 22, config.arenaMsg) doSendMagicEffect(config.saida[i], 2) end addEvent (safeHurt, config.timeSafe2, players) addEvent (reduceSafe, config.timeSafe2, players) -- Adiciona um evento recursivo para reduzir a o tamanho da safe (reduceSafe) end return TRUE end function safeHurt (players) for i = 1, config.maxPlayers do player = players[i].uid if isInArena (player) then if isSafe (player) then else doPlayerSendTextMessage (player, 22, config.safeDmgMsg) doSendAnimatedText(getPlayerPosition(player), "-"..config.safeDamage_perTick, TEXTCOLOR_LIGHTBLUE) doPlayerAddHealth(player, -config.safeDamage_perTick) -- Dano da safe doSendMagicEffect(getPlayerPosition(player), 11) -- Efeito de dano da safe end end end addEvent (safeHurt, config.timeSafe2, players) return TRUE end function isInArena (player) -- Verifica se o jogador esta na arena playerPos = getPlayerPosition(player) if config.arenaMinPos.x <= playerPos.x and playerPos.x <= config.arenaMaxPos.x then if playerPos.y <= config.arenaMinPos.y and playerPos.y >= config.arenaMaxPos.y then return true end end return false end function isSafe (player) -- Verifica se o jogador esta na zona Safe playerPos = getPlayerPosition(player) if config.safeMinPos.x <= playerPos.x and playerPos.x <= config.safeMaxPos.x then if playerPos.y <= config.safeMinPos.y and playerPos.y >= config.safeMaxPos.y then return TRUE end end return false end -- Funcao utilizada para testes function isSafePos (playerPos) if config.safeMinPos.x <= playerPos.x and playerPos.x <= config.safeMaxPos.x then if playerPos.y <= config.safeMinPos.y and playerPos.y >= config.safeMaxPos.y then return TRUE end end return false end function reduceSafe (players) quadrante = math.random(1, 4) -- Nao consegui pensar num jeito pratico de reduzir a safe, entao vamos selecionar quadrantes da safe atual if quadrante == 1 then config.safeMinPos.y = (config.safeMinPos.y + config.safeMaxPos.y) / 2 config.safeMaxPos.x = (config.safeMinPos.x + config.safeMaxPos.x) / 2 elseif quadrante == 2 then config.safeMinPos.x = (config.safeMinPos.x + config.safeMaxPos.x) / 2 config.safeMinPos.y = (config.safeMinPos.y + config.safeMaxPos.y) / 2 elseif quadrante == 3 then config.safeMaxPos.x = (config.safeMinPos.x + config.safeMaxPos.x) / 2 config.safeMaxPos.y = (config.safeMinPos.y + config.safeMaxPos.y) / 2 else config.safeMaxPos.y = (config.safeMinPos.y + config.safeMaxPos.y) / 2 config.safeMinPos.x = (config.safeMinPos.x + config.safeMaxPos.x) / 2 end continue = FALSE -- Envia mensagem para todos os jogadores avisando a modificacao da safe for i=1, config.maxPlayers do if isInArena (players[i].uid) then local pos = getPlayerPosition(players[i].uid) doPlayerSendTextMessage (players[i].uid, 22, "Nova safe zone no quadrante ".. quadrante .. "!") continue = true end end airDropSpawn () if continue == true then -- Descomentar bloco se quiser checar a safe diminuindo --for i = config.arenaMaxPos.y, config.arenaMinPos.y do -- for j= config.arenaMinPos.x, config.arenaMaxPos.x do -- position = {x = j, y = i, z = 9} -- if isSafePos (position) then -- doSendMagicEffect(position, 35) -- else -- doSendMagicEffect(position, 36) -- end -- end --end addEvent (reduceSafe, config.timeSafe2, players) else return true end end function airDropSpawn () itemSorteado = math.random(1, #config.listaItens) airdrop = doCreateItem(config.airdropID, 1, {x = math.random(config.safeMinPos.x, config.safeMaxPos.x), y = math.random(config.safeMaxPos.y, config.safeMinPos.y), z = 9}) doAddContainerItem(airdrop, config.listaItens[itemSorteado].id, config.listaItens[itemSorteado].cont) end Depois, vá em data/actions/actions.xml e cole a seguinte linha: <action uniqueid="5000" script="battle_royale.lua" /> Como configurar os limites da arena: Estou sem o TFS 0.4 8.6, testei na distro Aries Server to Tibia 8.1 - Version 4.0 based on OTServ SVN Version 0.6.0 Como funciona: Citar Primeiramente é feita a verificação se temos os Z jogadores necessários para começar em suas respectivas posições. Em seguida, enviamos todos os Z jogadores para a arena e iniciamos 2 eventos: "safeHurt" e "reduceSafe" "SafeHurt" é o evento responsável pelo damage da safe no player, CASO ELE ESTEJA NA ARENA e não esteja na safe, ele receberá dano. "reduceSafe" é o evento responsável por sortear quadrantes da atual safe para serem a nova safe, em seguida, spawna um airDrop (nao consegui fazer funcionar com itens que stackam). Quando todos os jogadores estiverem fora da arena, o evento acaba. Editado Janeiro 6, 2018 7 anos por marcot (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.