Postado Junho 11, 2014 10 anos Este é um post popular. Fala galerinha linda do TK, hoje estou trazendo um evento que andei modificando e otimizando, é o evento City WAR, este evento tem no servidor globalwar e outros. A autoria vem de um membro da otland, portante havia o mesmo aqui em um datapack e decidi otimizar este evento para vocês do TK. Observação: É um pouco parecido com o evento do meu amigo e scripter DuH, porém com mais funções e regras, mas o objetivo é praticamente o mesmo. Como funciona: Quando um GM executar o comando para abrir o evento, abrirá um teleport no lugar configurada onde os membros entraram em uma arena onde não perde level nem skills, o evento terá o tempo de 20 minutos (configurável), caso o player morra poderá voltar novamente pelo teleport que estará localizado no lugar até o termino do evento, a regra é clara produção, quando der os X minutos, o que mais matou levará para a casa backpack o prêmio do evento. Vamos lá; Primeiramente, em sua pasta data/lib crie um arquivo com o nome de city war.lua e dentro do mesmo coloque: configCW = {timetostart = 500, -- tempo para iniciar o evento em segundos by Absolute telpos = {x=32340, y=32213, z=7}, -- onde aparecerá o teleport stats = 201201201701, kill = 201201201702, death = 201201201703, ostime = 201201201704, evttime = 20, -- quanto tempo irá rolar o evento topleftPos = {x=32722, y=31336, z=6}, -- canto esquerdo superior botrightPos = {x=32791, y=31384, z=6}, -- canto direito inferior templepos = {x=32369, y=32241, z=7}, -- posição do templo principal arenapos = {{x=32722, y=31340, z=6}, {x=32786, y=31336, z=6}, {x=32722, y=31380, z=6}, {x=32783, y=31374, z=6}}, -- posição dos 4 tronos times = 8, -- não precisa mexer finaltime = 300 -- não precisa mexer } function configCW:new() local newevt = {} setmetatable(newevt, self) self.__index = self doBroadcastMessage("The City War will be open in " .. self.timetostart .. " seconds.") setGlobalStorageValue(self.stats, 0) addEvent(function () newevt:start() end, self.timetostart*1000) end function configCW:start() if getGlobalStorageValue(self.stats) == 0 then setGlobalStorageValue(self.ostime, os.time()) local teleport = doCreateItem(1387, self.telpos) doItemSetAttribute(teleport, "aid", 5540) setGlobalStorageValue(self.stats, 1) doBroadcastMessage("The City War is starting...") for _, posi in pairs(self.arenapos) do local item = getTileItemById(posi, 1387) if(item.uid ~= 0) then doRemoveItem(item.uid) end end addEvent(function () self:preclose() end, self.evttime*1000*60) addEvent(function () self:announce(0) end, (self.evttime/self.times)*1000*60) end end function configCW:announce(times) if times < self.times then if #self:getTopFrags(true) >= 1 then doBroadcastMessage("Top City War fraggers: " .. self:getTopFrags()) end addEvent(function () self:announce(times+1) end, (self.evttime/self.times)*1000*60) end end function configCW:preclose() if getGlobalStorageValue(self.stats) == 1 then setGlobalStorageValue(self.stats, 2) doBroadcastMessage("The City War will end in " .. self.finaltime .. " seconds.") addEvent(function () self:close() end, self.finaltime*1000) local item = getTileItemById(self.telpos, 1387) if(item.uid ~= 0) then doRemoveItem(item.uid) end end end function configCW:close() if getGlobalStorageValue(self.stats) == 2 then if #self:getTopFrags(true) >= 1 then doBroadcastMessage("The City War has ended. The winners are: " .. self:getTopFrags()) else doBroadcastMessage("The City War has ended. There were no winners.") end doRemovePlayersFromArea(self.topleftPos, self.botrightPos, self.templepos) for _, posi in pairs(self.arenapos) do doCreateTeleport(1387, self.templepos, posi) end for place, info in ipairs(self:getTopFrags(true)) do if place > 5 then break end local cid = getPlayerByName(info) doPlayerSendTextMessage(cid, 4, "Congratulations, you were the " .. place .. "º place in the City War.") doPlayerAddItem(cid, 6571, 1) end setGlobalStorageValue(self.stats, -1) end end function configCW:isPlayerInEvent(cid) if getPlayerStorageValue(cid, self.stats) == -1 or getPlayerStorageValue(cid, self.stats) - os.time() <= -5 or getGlobalStorageValue(self.stats) < 1 then return false end return true end function configCW:getTopFrags(tab) local frag = {} for _, pid in pairs(getPlayersOnline()) do if (getPlayerStorageValue(pid, self.kill) ~= -1 or getPlayerStorageValue(pid, self.death) ~= -1) and self:isPlayerInEvent(pid) then local kill = getPlayerStorageValue(pid, self.kill)+1 local death = getPlayerStorageValue(pid, self.death)+1 print(getCreatureName(pid), kill-death) table.insert(frag, {getCreatureName(pid), kill-death}) end end print(#frag) local frag, str, n = doOrderTab(frag, 0), nil, 5 print(#frag) if tab then return frag else if #frag < 5 then n = #frag end for i = 1, n do local cid = getPlayerByName(frag[i]) local kill = getPlayerStorageValue(cid, self.kill)+1 local death = getPlayerStorageValue(cid, self.death)+1 str = str and str .. ", " .. frag[i] .. "[" .. kill .. "/" .. death .. "]" or frag[i] .. "[" .. kill .. "/" .. death .. "]" end end return str end function doOrderTab(tabela, value) local max, index = {}, nil for i = 1, #tabela do valor = value for a, b in ipairs(tabela) do if b[2] > valor then valor = b[2] valor2 = b[1] index = a end end table.remove(tabela, index) if valor ~= value then table.insert(max, valor2) end end return max end Configuração do arquivo: telpos = {x=32340, y=32213, z=7}, -- POSIÇÃO ONDE NASCE O TP DO EVENTO! topleftPos = {x=32722, y=31336, z=6}, -- AQUI COLOQUE A POSIÇÃO DO CANTO ESQUERDO LA EM CIMA DO MAPA botrightPos = {x=32791, y=31384, z=6}, -- AQUI A POSIÇÃO DO CANTO DIREITO EM BAIXO DO MAPA templepos = {x=32369, y=32241, z=7}, -- POSIÇÃO DO TEMPLO ONDE OS JOGADORES NASCERAM PÓS A MORTE arenapos = {{x=32722, y=31340, z=6}, {x=32786, y=31336, z=6}, {x=32722, y=31380, z=6}, {x=32783, y=31374, z=6}}, -- ATENÇÃO, NO MAPA QUE ESTAREI DISPONIBILIZANDO VISIVELMENTE TERÁ 4 BASES, VOCÊ TERA QUE COLOCAR A POSIÇÃO DAS BASES AÍ NESSES 3 LUGARES. doPlayerAddItem(cid, 6571, 1) -- AQUI VOCÊ COLOCARÁ O PRÊMIO DO GANHADOR, NO CASO QUEIRA ADICIONAR POR EXEMPLO 1kk, COLOQUE 2160,1 - Primeiro ID depois quantia. Segundo passo, crie um arquivo com o nome de citywarCreature.lua e coloque dentro da pasta creaturescripts/scripts com o seguinte conteúdo: function onPrepareDeath(cid, lastHitKiller, mostDamageKiller) if isInRange(getCreaturePosition(cid), configCW.topleftPos, configCW.botrightPos) then setPlayerStorageValue(cid, configCW.death, getPlayerStorageValue(cid, configCW.death) +1) setPlayerStorageValue(lastHitKiller[1], configCW.kill, getPlayerStorageValue(lastHitKiller[1], configCW.kill) +1) end return true end E adicione em creaturescripts.xml a seguinte tag <event type="preparedeath" name="CityWar" event="script" value="citywarCreature.lua"/> Terceiro passo, crie um arquivo em movements/scripts com o nome de citywarMovements.lua com o seguinte conteúdo: function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition) if isPlayer(cid) and getGlobalStorageValue(configCW.stats) == 1 then doTeleportThing(cid, configCW.arenapos[math.random(1, #configCW.arenapos)]) doSendMagicEffect(getPlayerPosition(cid), 28) if not(configCW:isPlayerInEvent(cid)) then setPlayerStorageValue(cid, configCW.stats, getGlobalStorageValue(configCW.ostime) + configCW.evttime*60 + configCW.finaltime) setPlayerStorageValue(cid, configCW.kill, -1) setPlayerStorageValue(cid, configCW.death, -1) end else doTeleportThing(cid, fromPosition) end return true end Em Movements.xml adicione a seguinte linha: <movevent type="StepIn" actionid="5540" event="script" value="citywarMovements.lua"/> Quarto e último passo, em talkactions/scripts crie um arquivo com o nome de citywarTalkactions.lua e coloque o seguinte conteúdo: function onSay(cid, words, param) if getGlobalStorageValue(configCW.stats) == -1 then configCW:new() else doPlayerSendCancel(cid, "The event is already running.") end return true end Em talkactions/talkactions.xml adicione a seguinte linha: <talkaction log="yes" words="/citywar" access="3" event="script" value="citywarTalkactions.lua"/> E por fim, estou disponibilizando o world do evento, vocês usam se quiser, tentei adapta-lo para 8.6 mas ficou meio slá, o Viiting estava ocupado e não pode me ajudar, enfim segue a imagem e download do world.otbm: Download do mapa: http://www.sendspace.com/file/v3u8pt Scan do Mapa: https://www.virustotal.com/pt/url/44b2d870c26798ffc9de2c7493cf8c7dc73df328a1c0a58770d423fff30b93ff/analysis/1402527378/ Lembrando que ninguém além do Collocorpusek da otland tem direito de pedir remoção do script, pois a base é dele. Créditos: Absolute Collocor Gringo Lindo. Editado Junho 11, 2014 10 anos por Absolute (veja o histórico de edições) Entenda tudo sobre VPS, DEDICADOS & HOSPEDAGENS. => Clique aqui Global Full Download 10.9x - TFS 1.2/FERUMBRAS/KRAILOS. => Clique aqui Muitos querem aquilo que você tem, mas vão desistir quando souberem o preço que você pagou. lu.lukinha [email protected]
Postado Junho 12, 2014 10 anos Muito bom seu lindu. Espero que gostem do mapa,só adicionei uns detalhes ! Ajudei = REP+ Não dou suporte por PM qualquer dúvida procure no fórum,caso não encontre oque procura crie um tópico. [email protected]" /> | TFS 0.4 DEV | %5Bcreaturescript%5D Icones no minimap com descrição%5Btalkaction%5D Adicionar ou remover VIP do player.%5Bcreaturescripts%5D Senha para porta%5Btalkaction%5D Mandar mensagem para pasta do servidorMapa Evento War Castle%5Baction%5D Canoa em MovimentoTeleport Scroll System%5Bcreaturescripts%5D Recompensa por level para X vocations%5Btalkaction%5D Adicionar X item para o player%5Btalkactions%5D Adicionar item para todos players online%5Baction%5D Item que teleporta o player para house[action+movement] Passaporte para entrar no barco
Postado Junho 12, 2014 10 anos como posso modificar o tempo q inicia o evento? fica ae 500 seconds ja olhei +Rep Editado Junho 12, 2014 10 anos por deviletico (veja o histórico de edições)
Postado Junho 14, 2014 10 anos hmmmm, eu que fiz esse código... Era pra ser exclusivo da GlobalOTS, mas acho que acabou vazando. Well, eu não sou da otland rsrsrs
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.