Vodkart 1515 Postado Agosto 28, 2012 Share Postado Agosto 28, 2012 (editado) Mapa feito por AnneMotta: Mapa Battlefield.rar scan: https://www.virustot...sis/1346548669/ Imagens do mapa: Descrição: - O evento é automático e acontece em determinado dia e hora da semana - Logo após é aberto um teleport então apenar um número limitado de players entra no evento - São formados por dois times, os "Black Assassins" e os "Red Barbarians" - Os times são balanceados automaticamente, quando o último jogador entra, esse teleport é fechado e depois de 5 minutos o evento começa, os 5 minutos são para os players ter tempo de planejar um ataque. - O sistema tem por finalidade matar todos do time inimigo, e os players que sobreviverem recebem um prêmio. Bônus: - Durante o evento é mostrado na tela somente dos jogadores que estão no evento um placar de times. - Até o último player entrar no evento, ficam mandando broadcast dizendo quanto players faltam para dar inicio ao jogo. - Se o evento abrir e não atingir a meta de players colocada, o evento é finalizado e os players voltam para o templo. Lembre-se: - De colocar Pvp Tool na área - De colocar área NoLogout Imagens: -- -- -- -- -- Instalação: Data/Lib BattleLib.lua _Lib_Battle_Info = { Reward = {2160,10}, TeamOne = {name = "Black Assassins", storage = 140120, pos = {x=613,y=802,z=7}}, TeamTwo = {name = "Red Barbarians",storage = 140121,pos = {x=631,y=801,z=7}}, storage_count = 180400, tpPos = {x=158, y=57, z=7}, limit_Time = 10 -- em minutos } function resetBattle() return setGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage, 0) and setGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0) end function OpenWallBattle() local B = { {1543,{x=622, y=803, z=7, stackpos = 1}}, {1543,{x=622, y=804, z=7, stackpos = 1}}, {1543,{x=622, y=805, z=7, stackpos = 1}}, {1543,{x=622, y=806, z=7, stackpos = 1}} } for i = 1, #B do if getTileItemById(B[i][2], B[i][1]).uid == 0 then doCreateItem(B[i][1], 1, B[i][2]) else doRemoveItem(getThingfromPos(B[i][2]).uid,1) end end end function doBroadCastBattle(type,msg) local players = {} for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage) == 1 or getPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage) == 1 then table.insert(players, cid) end end for i = 1, #players do doPlayerSendTextMessage(players[i],type,msg) end end function removeBattleTp() local t = getTileItemById(_Lib_Battle_Info.tpPos, 1387).uid return t > 0 and doRemoveItem(t) and doSendMagicEffect(_Lib_Battle_Info.tpPos, CONST_ME_POFF) end function getWinnersBattle(storage) local players,str = {},"" for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, storage) == 1 then table.insert(players, cid) end end str = str .. ""..#players.." Player"..(#players > 1 and "s" or "").." from team "..(getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage) == 0 and _Lib_Battle_Info.TeamTwo.name or _Lib_Battle_Info.TeamOne.name).." won the event battlefield, they received a ".._Lib_Battle_Info.Reward[2].." "..getItemNameById(_Lib_Battle_Info.Reward[1]).."!" for i = 1, #players do doPlayerAddItem(players[i], _Lib_Battle_Info.Reward[1], _Lib_Battle_Info.Reward[2]) doRemoveCondition(players[i], CONDITION_OUTFIT) doTeleportThing(players[i], getTownTemplePosition(getPlayerTown(players[i]))) setPlayerStorageValue(players[i], storage, -1) end resetBattle() OpenWallBattle() return doBroadcastMessage(str) end function CheckEvent(delay) if delay > 0 and getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then doBroadcastMessage("[battleField Event] We are waiting "..getGlobalStorageValue(_Lib_Battle_Info.storage_count).." players to Battlefield starts") elseif delay == 0 and getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then local players = {} for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage) == 1 or getPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage) == 1 then table.insert(players, cid) end end for i = 1, #players do doRemoveCondition(players[i], CONDITION_OUTFIT) doTeleportThing(players[i], getTownTemplePosition(getPlayerTown(players[i]))) setPlayerStorageValue(players[i], getPlayerStorageValue(players[i], _Lib_Battle_Info.TeamOne.storage) == 1 and _Lib_Battle_Info.TeamOne.storage or _Lib_Battle_Info.TeamTwo.storage, -1) end doBroadcastMessage("The event cannot be started because not had enough players.") setGlobalStorageValue(_Lib_Battle_Info.storage_count, 0) resetBattle() removeBattleTp() end addEvent(CheckEvent, 60000, delay-1) end Data/CreatureScript BattleCreatureScript.lua function onLogin(cid) if getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage) == -1 then setGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage, 0) setGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0) setGlobalStorageValue(_Lib_Battle_Info.storage_count, 0) end registerCreatureEvent(cid, "BattleTeam") registerCreatureEvent(cid, "BattleDeath") return true end function onCombat(cid, target) if isPlayer(cid) and isPlayer(target) then if getPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage) == 1 and getPlayerStorageValue(target, _Lib_Battle_Info.TeamOne.storage) == 1 then doPlayerSendCancel(cid, "You may not attack your team mates.") return false end if getPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage) == 1 and getPlayerStorageValue(target, _Lib_Battle_Info.TeamTwo.storage) == 1 then doPlayerSendCancel(cid, "You may not attack your team mates.") return false end return true end return true end function onPrepareDeath(cid, deathList, lastHitKiller, mostDamageKiller) if getPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage) >= 1 then setPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage, -1) setGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage, getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage)-1) doRemoveCondition(cid, CONDITION_OUTFIT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[battle Field] You Are Dead!") if getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage) == 0 then getWinnersBattle(_Lib_Battle_Info.TeamTwo.storage) else doBroadCastBattle(23,"[battleField Information] ".._Lib_Battle_Info.TeamOne.name.." "..getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage).." VS "..getGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage).." " .._Lib_Battle_Info.TeamTwo.name) end elseif getPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage) >= 1 then setPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage, -1) setGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage, getGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage)-1) doRemoveCondition(cid, CONDITION_OUTFIT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[battle Field] You Are Dead!") if getGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage) == 0 then getWinnersBattle(_Lib_Battle_Info.TeamOne.storage) else doBroadCastBattle(23,"[battleField Information] ".._Lib_Battle_Info.TeamOne.name.." "..getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage).." VS "..getGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage).." " .._Lib_Battle_Info.TeamTwo.name) end end return true end creaturescript.xml <event type="login" name="BattleLogin" event="script" value="BattleCreatureScript.lua"/> <event type="PrepareDeath" name="BattleDeath" event="script" value="BattleCreatureScript.lua"/> <event type="combat" name="BattleTeam" event="script" value="BattleCreatureScript.lua"/> Data/Globalevents BattleGlobalEvents.lua function onThink(interval, lastExecution) local _Lib_Battle_Days = { ["Monday"] = { ["16:00"] = {players = 30}, ["21:30"] = {players = 20} }, ["Tuesday"] = { ["17:02"] = {players = 8} }, ["Thursday"] = { ["11:26"] = {players = 4}, ["20:30"] = {players = 10} } } if _Lib_Battle_Days[os.date("%A")] then local hours = tostring(os.date("%X")):sub(1, 5) local tb = _Lib_Battle_Days[os.date("%A")][hours] if tb and (tb.players % 2 == 0) then local tp = doCreateItem(1387, 1, _Lib_Battle_Info.tpPos) doItemSetAttribute(tp, "aid", 45000) CheckEvent(_Lib_Battle_Info.limit_Time) doBroadcastMessage("The event BattleField was opened and We are waiting "..tb.players.." Players! Team divided into "..((tb.players)/2).." VS "..((tb.players)/2)) setGlobalStorageValue(_Lib_Battle_Info.storage_count, tb.players) return true end end return true end globalevents.xml <globalevent name="GlobalBattle" interval="60" event="script" value="BattleGlobalEvents.lua"/> obs: Lembre-sem caso o seu servidor seja em mileseconed mude 60 por 60000 Data/Movements BattleMovements.lua local conditionBlack = createConditionObject(CONDITION_OUTFIT) setConditionParam(conditionBlack, CONDITION_PARAM_TICKS, -1) addOutfitCondition(conditionBlack, {lookType = 134, lookHead = 114, lookBody = 114, lookLegs = 114, lookFeet = 114}) local conditionRed = createConditionObject(CONDITION_OUTFIT) setConditionParam(conditionRed, CONDITION_PARAM_TICKS, -1) addOutfitCondition(conditionRed, {lookType = 143, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94}) function onStepIn(cid, item, position, fromPosition) if getPlayerAccess(cid) > 3 then doTeleportThing(cid, _Lib_Battle_Info.TeamOne.pos) return false elseif getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then setGlobalStorageValue(_Lib_Battle_Info.storage_count, getGlobalStorageValue(_Lib_Battle_Info.storage_count)-1) end if getGlobalStorageValue(_Lib_Battle_Info.storage_count) >= 0 then if getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage) < getGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage) then setPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage, 1) doAddCondition(cid, conditionBlack) setGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage, getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage)+1) doTeleportThing(cid, _Lib_Battle_Info.TeamOne.pos) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You will join the team " .. _Lib_Battle_Info.TeamOne.name .. "!") else setPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage, 1) doAddCondition(cid, conditionRed) setGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage, getGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage)+1) doTeleportThing(cid, _Lib_Battle_Info.TeamTwo.pos) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You will join the team " .. _Lib_Battle_Info.TeamTwo.name .. "!") end end if getGlobalStorageValue(_Lib_Battle_Info.storage_count) == 0 then removeBattleTp() doBroadcastMessage("Battlefield will start in 2 minutes, please create your strategy!") addEvent(doBroadcastMessage, 2*60*1000-500, "BattleField will begin now!") addEvent(OpenWallBattle, 2*60*1000) end return true end movements.xml <movevent type="StepIn" actionid="45000" event="script" value="BattleMovements.lua"/> Como configurar: Configuração dos Times: em Data/Lib/BattleLib.lua vai ter essa tabela: _Lib_Battle_Info = { Reward = {2160,10}, TeamOne = {name = "Black Assassins", storage = 140120, pos = {x=613,y=802,z=7}}, TeamTwo = {name = "Red Barbarians",storage = 140121,pos = {x=631,y=801,z=7}}, storage_count = 180400, tpPos = {x=158, y=57, z=7}, limit_Time = 10 -- em minutos } Reward = {2160,10} -- aqui se configura o prêmio que os jogadores vão receber -- TeamOne = { name = "Black Assassins", -- É o nome do time storage = 140120, -- n mexa pos = {x=613,y=802,z=7} -- é a posição para onde eles vão entrar no teleport, cada time tem o seu. } -- storage_count = 180400, -- n mexa -- tpPos = {x=158, y=57, z=7}, -- É A POSIÇÃO ONDE O TELEPORT VAI ABRIR -- limit_Time = 10 -- É o tempo limite para os jogadores entrarem no teleport. Configurar Datas do evento: Em data/globalevents/script/BattleGlobalEvents.lua vai ter essa tabela: _Lib_Battle_Days = { ["Monday"] = { ["16:00"] = {players = 30}, ["21:30"] = {players = 20} }, ["Wednesday"] = { ["19:00"] = {players = 16} }, ["Thursday"] = { ["11:26"] = {players = 4}, ["20:30"] = {players = 10} } } ["DIA DA SEMANA"] = { ["HORARIO"] = {players = QUANTOS JOGADORES IRÃO PARTICIPAR} Regra: Sempre coloque números pares para os jogadores, do contrário o evento não irá iniciar. -- Configuração Paredes: É importante que você faça no mapper editor as paredes que vão separar os times, quando o evento começar elas serão removidas, e quanto terminar o evento elas serão repostas automaticamente. em Data/Lib/BattleLib.lua vai ter essa função: function OpenWallBattle() local B = { {1543,{x=622, y=803, z=7, stackpos = 1}}, {1543,{x=622, y=804, z=7, stackpos = 1}}, {1543,{x=622, y=805, z=7, stackpos = 1}}, {1543,{x=622, y=806, z=7, stackpos = 1}} } for i = 1, #B do if getTileItemById(B[i][2], B[i][1]).uid == 0 then doCreateItem(B[i][1], 1, B[i][2]) else doRemoveItem(getThingfromPos(B[i][2]).uid,1) end end end local B = { {1543,{x=622, y=803, z=7, stackpos = 1}}, {1543,{x=622, y=804, z=7, stackpos = 1}}, {1543,{x=622, y=805, z=7, stackpos = 1}}, {1543,{x=622, y=806, z=7, stackpos = 1}} } {ID DA SUA PAREDE, E A PÓS DELA} PODE AUMENTAR O NÚMERO DE PAREDES E OS ID DELAS. Editado Novembro 20, 2012 por Vodkart Link para o comentário https://xtibia.com/forum/topic/192920-battlefield-event/ Compartilhar em outros sites More sharing options...
LuckOake 400 Postado Agosto 28, 2012 Share Postado Agosto 28, 2012 Nossa Vodkart, nem precisou na minha ajuda e da do notle2012 no fim, haeuaehue Maneiro o evento, mas tou sem REP agr. Link para o comentário https://xtibia.com/forum/topic/192920-battlefield-event/#findComment-1326542 Compartilhar em outros sites More sharing options...
Mulizeu 86 Postado Agosto 28, 2012 Share Postado Agosto 28, 2012 Pow Falar oq vindo dessa cara, meu xará, simplismente fantastico....... Concerteza merece mto mais do meu simples rep+ Abraços xará! Link para o comentário https://xtibia.com/forum/topic/192920-battlefield-event/#findComment-1326603 Compartilhar em outros sites More sharing options...
Barths 0 Postado Agosto 29, 2012 Share Postado Agosto 29, 2012 Excellent vodkart! i will test this:) Link para o comentário https://xtibia.com/forum/topic/192920-battlefield-event/#findComment-1326912 Compartilhar em outros sites More sharing options...
Moonshadow 9 Postado Agosto 29, 2012 Share Postado Agosto 29, 2012 (editado) Nossa, muito bom. É praticamente igual ao BG do ragnarok. Valeu por compartilhar. Obs: Acho que faltou uma indentação melhor no código. Editado Agosto 29, 2012 por Moonshadow Link para o comentário https://xtibia.com/forum/topic/192920-battlefield-event/#findComment-1326980 Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Agosto 29, 2012 Autor Share Postado Agosto 29, 2012 Nossa, muito bom. É praticamente igual ao BG do ragnarok. Valeu por compartilhar. Obs: Acho que faltou uma indentação melhor no código. Na verdade ta indentado, o xtibia que quebra a identação ._. Link para o comentário https://xtibia.com/forum/topic/192920-battlefield-event/#findComment-1327009 Compartilhar em outros sites More sharing options...
rhamer 5 Postado Agosto 29, 2012 Share Postado Agosto 29, 2012 lol perfeito mt foda cara parabens Link para o comentário https://xtibia.com/forum/topic/192920-battlefield-event/#findComment-1327010 Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Agosto 29, 2012 Autor Share Postado Agosto 29, 2012 Obrigado a todos que comentaram ^^ qualquer dúvida ou bug só postar que resolveremos vlw Link para o comentário https://xtibia.com/forum/topic/192920-battlefield-event/#findComment-1327071 Compartilhar em outros sites More sharing options...
eickhoff 11 Postado Agosto 29, 2012 Share Postado Agosto 29, 2012 Mas esse nao é esse mesmo sistema? http://www.xtibia.com/forum/topic/170316-mod-evento-team-battle/ Link para o comentário https://xtibia.com/forum/topic/192920-battlefield-event/#findComment-1327094 Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Agosto 29, 2012 Autor Share Postado Agosto 29, 2012 é praticamente o mesmo evento, que tem como objetivo matar todos do time inimigo, porém o script que eu refiz está melhor e mais fácil de configurar Link para o comentário https://xtibia.com/forum/topic/192920-battlefield-event/#findComment-1327122 Compartilhar em outros sites More sharing options...
Derlexy 0 Postado Agosto 29, 2012 Share Postado Agosto 29, 2012 (editado) Vod, seria possível programar para por exemplo a recompensa ser em exp points? Dinheiro e exp points... Editado Agosto 29, 2012 por Derlexy Link para o comentário https://xtibia.com/forum/topic/192920-battlefield-event/#findComment-1327170 Compartilhar em outros sites More sharing options...
Moonshadow 9 Postado Agosto 29, 2012 Share Postado Agosto 29, 2012 Nossa, muito bom. É praticamente igual ao BG do ragnarok. Valeu por compartilhar. Obs: Acho que faltou uma indentação melhor no código. Na verdade ta indentado, o xtibia que quebra a identação ._. Fui perceber isto só agora. ;; Link para o comentário https://xtibia.com/forum/topic/192920-battlefield-event/#findComment-1327206 Compartilhar em outros sites More sharing options...
notle2012 233 Postado Agosto 29, 2012 Share Postado Agosto 29, 2012 Mas esse nao é esse mesmo sistema? http://www.xtibia.co...to-team-battle/ não sei se vc noto que esse tem menos linha do que esse do link Link para o comentário https://xtibia.com/forum/topic/192920-battlefield-event/#findComment-1327210 Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Agosto 29, 2012 Autor Share Postado Agosto 29, 2012 Vod, seria possível programar para por exemplo a recompensa ser em exp points? Dinheiro e exp points... Tudo é possível, não assiste o programa não? rsrsrs me diz uma coisa, oque seria exatamente esse "exp points" ? Link para o comentário https://xtibia.com/forum/topic/192920-battlefield-event/#findComment-1327223 Compartilhar em outros sites More sharing options...
Derlexy 0 Postado Agosto 29, 2012 Share Postado Agosto 29, 2012 Ao invés de os vencedores ganharem por exemplo: 10 crystal coins, eles ganhassem os 10 crystal coins + 10k de experiencia... Link para o comentário https://xtibia.com/forum/topic/192920-battlefield-event/#findComment-1327314 Compartilhar em outros sites More sharing options...
Posts Recomendados