Postado Julho 2, 2017 7 anos Este é um post popular. Olá pessoal, tudo bom? Então, estou trazendo um evento que criei: o Duca Evento. A uns 10 anos atrás joguei um ot pvp enforced que funcionava quase da mesma forma desse evento e recentemente resolvi criar um evento dessa forma ... Como funciona: • Primeiramente abre um teleport onde os jogadores que estão acima do level estipulado podem entrar (lembrando que o teleport fica aberto até o final do evento, ou seja, você pode morrer dentro do evento e entrar novamente quantas vezes quiser). • Ao entrar no teleport você será enviado para uma equipe: azul ou rosa (lembrando que o objetivo é você matar jogadores da outra equipe e não poderá atacar os da mesma equipe). • Existe uma pontuação dentro do evento, ou seja, a cada jogador que matar da outra equipe você ganha 1 duca ponto (lembrando que se você morrer você é teleportado para fora do evento e seus duca pontos zeram.) • A cada morte dentro do evento é atualizada uma LISTA RANK, onde é gerado um rank de acordo com a pontuação dentro do evento. • O evento começa ficar bom quando existem mais de 11 jogadores dentro dele, pois é quando o sistema verifica os jogadores da "lista rank" que estão nas posições de segundo a décimo primeiro (2º a 11º) e coloca eles em uma equipe diferente: a vermelha, e é ai que o "bicho pega", pois fora os outros jogadores das outras equipes, existem 10 jogadores dessa equipe, e o melhor, quem mata-los recebe 10 duca pontos. • Como dito acima, ao ter mais de 11 jogadores dentro do evento é criado automaticamente a equipe vermelha (2º a 11º do rank), pois bem, para quem leu certinho viu que pulamos o 1º do rank: é ai que entra a equipe verde, sim, esta equipe será composta apenas por 1 jogador, sempre o que tiver mais pontos no evento (lembrando que essa função do sistema atualiza a cada morte dentro do evento), e é claro quem mata-lo ganhará 30 pontos dentro do evento. • Aconselho a colocar sempre o tempo do evento superior a 30 minutos para melhor jogabilidade e rivalidade. • O objetivo do evento é ser do time verde ao terminar o evento e ganhar o premio (configurei para os do time vermelho tbem ganhar premio, mas inferior ao do verde). Observações: • As cores das equipes que citei são represetativas, lá você pode editar as que quiserem. • Um mapa opcional esta disponivel para download no tópico. • Não ensinarei detalhes minimos de instalação no servidor porque você deve ao menos ter uma noção básica de otserv. Como instalar: • Primeiramente o arquivo que ficará na lib, ele é o coração do evento, tudo que você precisar configurar é nele. Nomeie de DUCA.lua: Spoiler -- DUCA EVENTO by luanluciano93 DUCA = { EVENT_MINUTES = 40, TELEPORT_POSITION = {x = 32365, y = 32236, z = 7}, STORAGE_TEAM = 27000, TOTAL_PONTOS = 27001, TOTAL_PLAYERS = 27003, -- global storage LEVEL_MIN = 80, REWARD_FIRST = {2160, 10}, REWARD_SECOND = {2160, 5}, TEAMS = { [1] = {color = "Black", temple = {x = 16887, y = 16676, z = 7}}, [2] = {color = "White", temple = {x = 16887, y = 16676, z = 7}}, [3] = {color = "Red"}, [4] = {color = "Green"}, }, } local conditioBlack = createConditionObject(CONDITION_OUTFIT) setConditionParam(conditioBlack, CONDITION_PARAM_TICKS, -1) addOutfitCondition(conditioBlack, {lookType = 128, lookHead = 114, lookBody = 114, lookLegs = 114, lookFeet = 114}) local conditioWhite = createConditionObject(CONDITION_OUTFIT) setConditionParam(conditioWhite, CONDITION_PARAM_TICKS, -1) addOutfitCondition(conditioWhite, {lookType = 128, lookHead = 19, lookBody = 19, lookLegs = 19, lookFeet = 19}) local conditioRed = createConditionObject(CONDITION_OUTFIT) setConditionParam(conditioRed, CONDITION_PARAM_TICKS, -1) addOutfitCondition(conditioRed, {lookType = 134, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94}) local conditioGreen = createConditionObject(CONDITION_OUTFIT) setConditionParam(conditioGreen, CONDITION_PARAM_TICKS, -1) addOutfitCondition(conditioGreen, {lookType = 134, lookHead = 101, lookBody = 101, lookLegs = 101, lookFeet = 101}) -- function DUCA.teleportCheck() DUCA.teleportCheck = function() local item = getTileItemById(DUCA.TELEPORT_POSITION, 1387).uid if item > 0 then doRemoveItem(item) DUCA.finishEvent() print(">>> Duca Event was finished. <<<") else doBroadcastMessage("Duca Event was started and will close in ".. DUCA.EVENT_MINUTES .." minutes.") print(">>> Duca Event was started. <<<") local teleport = doCreateItem(1387, 1, DUCA.TELEPORT_POSITION) doItemSetAttribute(teleport, "aid", 48000) setGlobalStorageValue(DUCA.TOTAL_PLAYERS, 0) addEvent(DUCA.teleportCheck, DUCA.EVENT_MINUTES * 60 * 1000) end end -- function DUCA.addPlayerinTeam(cid, team) DUCA.addPlayerinTeam = function(cid, team) doRemoveCondition(cid, CONDITION_OUTFIT) doRemoveCondition(cid, CONDITION_INVISIBLE) if team == 1 then doAddCondition(cid, conditioBlack) elseif team == 2 then doAddCondition(cid, conditioWhite) elseif team == 3 then doAddCondition(cid, conditioRed) elseif team == 4 then doAddCondition(cid, conditioGreen) end setPlayerStorageValue(cid, DUCA.STORAGE_TEAM, team) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You will join the " .. DUCA.TEAMS[team].color .. " Team.") doCreatureAddHealth(cid, getCreatureMaxHealth(cid)) doCreatureAddMana(cid, getCreatureMaxMana(cid)) end -- function DUCA.balanceTeam() DUCA.balanceTeam = function() local time1, time2 = 0, 0 for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) == 1 then time1 = time1 + 1 elseif getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) == 2 then time2 = time2 + 1 end end return (time1 <= time2) and 1 or 2 end -- function DUCA.removePlayer(cid) DUCA.removePlayer = function(cid) doRemoveCondition(cid, CONDITION_OUTFIT) --doRemoveCondition(cid, CONDITION_HUNTING) --doRemoveCondition(cid, CONDITION_INFIGHT) --doRemoveCondition(cid, CONDITIONID_COMBAT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are dead in Duca Event and your Duca points is set to 0!") doCreatureAddHealth(cid, getCreatureMaxHealth(cid)) doCreatureAddMana(cid, getCreatureMaxMana(cid)) setPlayerStorageValue(cid, DUCA.STORAGE_TEAM, 0) setPlayerStorageValue(cid, DUCA.TOTAL_PONTOS, 0) unregisterCreatureEvent(cid, "Duca-Death") unregisterCreatureEvent(cid, "Duca-Combat") doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) setGlobalStorageValue(DUCA.TOTAL_PLAYERS, getGlobalStorageValue(DUCA.TOTAL_PLAYERS) - 1) end -- function DUCA.updateRank() DUCA.updateRank = function() local participantes = {} for _, uid in pairs(getPlayersOnline()) do if getPlayerStorageValue(uid, DUCA.STORAGE_TEAM) > 0 then table.insert(participantes, uid) end end table.sort(participantes, function(a, b) return getPlayerStorageValue(a, DUCA.TOTAL_PONTOS) > getPlayerStorageValue(b, DUCA.TOTAL_PONTOS) end) for x = 1, #participantes do if getPlayerStorageValue(participantes[x], DUCA.STORAGE_TEAM) >= 3 then DUCA.addPlayerinTeam(participantes[x], DUCA.balanceTeam()) end end if (#participantes >= 1) then DUCA.addPlayerinTeam(participantes[1], 4) end if (#participantes >= 11) then for i = 2, 11 do DUCA.addPlayerinTeam(participantes[i], 3) end end end -- function DUCA.finishEvent() DUCA.finishEvent = function() DUCA.updateRank() for _, uid in pairs(getPlayersOnline()) do if getPlayerStorageValue(uid, DUCA.STORAGE_TEAM) == 4 then local winner = getCreatureName(uid) doBroadcastMessage("Congratulation ".. winner .."!! Duca Event is finish. ".. winner .." win reward.") doPlayerAddItem(uid, DUCA.REWARD_FIRST[1], DUCA.REWARD_FIRST[2]) elseif getPlayerStorageValue(uid, DUCA.STORAGE_TEAM) == 3 then doPlayerAddItem(uid, DUCA.REWARD_SECOND[1], DUCA.REWARD_SECOND[2]) end if getPlayerStorageValue(uid, DUCA.STORAGE_TEAM) > 0 then DUCA.removePlayer(uid) end end end • Depois na pasta creaturescripts/scripts/ crie o arquivo DUCA_creaturescripts.lua: (lembrando que as tags para colocar no creaturescripts.xml esta como comentário no começo do código) Spoiler --[[ <!-- DUCA Event --> <event type="login" name="Duca-Login" event="script" value="DUCA_creaturescript.lua"/> <event type="logout" name="Duca-Logout" event="script" value="DUCA_creaturescript.lua"/> <event type="preparedeath" name="Duca-Death" event="script" value="DUCA_creaturescript.lua"/> <event type="combat" name="Duca-Combat" event="script" value="DUCA_creaturescript.lua"/> ]]-- dofile('data/lib/DUCA.lua') function onLogin(cid) if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) > 0 then DUCA.removePlayer(cid) end return true end function onLogout(cid) if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) > 0 then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can not logout now!") return false end return true end function onPrepareDeath(cid, deathList, lastHitKiller, mostDamageKiller) local pontos = {[1] = 1, [2] = 1, [3] = 10, [4] = 30,} if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) > 0 then local pontos_ganhos = pontos[getPlayerStorageValue(cid, DUCA.STORAGE_TEAM)] setPlayerStorageValue(deathList[1], DUCA.TOTAL_PONTOS, getPlayerStorageValue(deathList[1], DUCA.TOTAL_PONTOS) + pontos_ganhos) doPlayerSendTextMessage(deathList[1], MESSAGE_STATUS_CONSOLE_BLUE, "You have ".. getPlayerStorageValue(deathList[1], DUCA.TOTAL_PONTOS) .." duca points.") DUCA.removePlayer(cid) DUCA.updateRank() end return false end function onCombat(cid, target) if isPlayer(cid) and isPlayer(target) then if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) > 0 then if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) == getPlayerStorageValue(target, DUCA.STORAGE_TEAM) then return false end end end return true end • Depois na pasta globalevents/scripts/ crie o arquivo DUCA_globalevents.lua: (lembrando que as tags para colocar no globalevents.xml esta como comentário no começo do código) Spoiler --[[ <!-- DUCA Event --> <globalevent name="Duca" time="00:00:00" script="DUCA_globalevents.lua" /> ]]-- dofile('data/lib/DUCA.lua') function onTime(interval) -- se der bug use: function onTimer(interval) DUCA.teleportCheck() return true end • Depois na pasta movements/scripts/ crie o arquivo DUCA_movements.lua: (lembrando que as tags para colocar no movements.xml esta como comentário no começo do código) Spoiler --[[ <!-- DUCA Event --> <movevent event="StepIn" actionid="48000" script="DUCA_movements.lua"/> ]]-- dofile('data/lib/DUCA.lua') function onStepIn(cid, item, position, fromPosition) if not isPlayer(cid) then return false end if getPlayerGroupId(cid) >= 3 then doTeleportThing(cid, DUCA.TEAMS[1].temple) return true end if getPlayerLevel(cid) < DUCA.LEVEL_MIN then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need level " .. DUCA.LEVEL_MIN .. " to enter in Duca event.") doTeleportThing(cid, fromPosition) return false end if getPlayerItemCount(cid, 2165) >= 1 or getPlayerSlotItem(cid, CONST_SLOT_RING).itemid == 2202 then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can not enter stealth ring in the event.") doTeleportThing(cid, fromPosition) return false end for _, uid in pairs(getPlayersOnline()) do if getPlayerIp(cid) == getPlayerIp(uid) and getPlayerStorageValue(uid, DUCA.STORAGE_TEAM) > 0 then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already have another player inside the event.") doTeleportThing(cid, fromPosition) return false end end local team = DUCA.balanceTeam() DUCA.addPlayerinTeam(cid, team) doTeleportThing(cid, DUCA.TEAMS[team].temple) setPlayerStorageValue(cid, DUCA.TOTAL_PONTOS, 0) registerCreatureEvent(cid, "Duca-Death") registerCreatureEvent(cid, "Duca-Combat") setGlobalStorageValue(DUCA.TOTAL_PLAYERS, getGlobalStorageValue(DUCA.TOTAL_PLAYERS) + 1) return true end Espero que gostem! D U C A ducaMap.otbm STYLLER OT 2022
Postado Julho 2, 2017 7 anos Parabéns, seu tópico de conteúdo foi aprovado! Muito obrigado pela sua contribuição, nós do Tibia King agradecemos. Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP. Spoiler Congratulations, your content has been approved! Thank you for your contribution, we of Tibia King we are grateful. Your content will help many other users, you received +1 REP. ➥ Regras | Seções OTServ | Seções BOT
Postado Julho 2, 2017 7 anos @luanluciano93 no caso sá poderá participar 11 pessoas por vez no evento ? ou pode varios nessa parte eu nao intendi bem. e outra funfa também em 0.3.6? + REP !
Postado Julho 2, 2017 7 anos Autor 3 minutos atrás, leozincorsair disse: @luanluciano93 no caso sá poderá participar 11 pessoas por vez no evento ? ou pode varios nessa parte eu nao intendi bem. e outra funfa também em 0.3.6? + REP ! É ilimitado a quantidade de players e creio que funcione sim no 0.3.6, muda apenas algumas funções. STYLLER OT 2022
Postado Julho 2, 2017 7 anos 6 minutos atrás, luanluciano93 disse: É ilimitado a quantidade de players e creio que funcione sim no 0.3.6, muda apenas algumas funções. Aproveitando aqui rapidão onde eu coloco a posição da arena tipo frompos e topos ou nao tem ? Ta dando esse erro :
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.