Vodkart 1515 Postado Julho 23, 2015 Share Postado Julho 23, 2015 Informações: Repassei esse sistema: http://www.xtibia.com/forum/topic/192920-battlefield-event/page-1 para a nova versão Versão: TFS 1.1 ou SUPERIOR(NÃO FUNCIONA NO TFS 1.0) OBS: Favor ter noções básicas de como instalar o sistema no seu server. Instalando o Sistema: data\creaturescripts\scripts battlefield.lua function onLogin(player) player:registerEvent("battledeath") if Game.getStorageValue(_Lib_Battle_Info.TeamOne.storage) == -1 then Game.setStorageValue(_Lib_Battle_Info.TeamOne.storage, 0) Game.setStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0) Game.setStorageValue(_Lib_Battle_Info.storage_count, 0) end if player:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 or player:getStorageValue(_Lib_Battle_Info.TeamTwo.storage) >= 1 then player:setStorageValue(_Lib_Battle_Info.TeamOne.storage, -1) player:setStorageValue(_Lib_Battle_Info.TeamTwo.storage, -1) player:teleportTo(player:getTown():getTemplePosition()) end return true end function onPrepareDeath(creature, lastHitKiller, mostDamageKiller) if creature:isPlayer() and creature:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 or creature:getStorageValue(_Lib_Battle_Info.TeamTwo.storage) >= 1 then local MyTeam = creature:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 and _Lib_Battle_Info.TeamOne.storage or _Lib_Battle_Info.TeamTwo.storage local EnemyTeam = creature:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 and _Lib_Battle_Info.TeamTwo.storage or _Lib_Battle_Info.TeamOne.storage Game.setStorageValue(MyTeam, (Game.getStorageValue(MyTeam)-1)) creature:sendTextMessage(MESSAGE_INFO_DESCR, "[Battle Field] You Are Dead!") creature:setStorageValue(MyTeam, -1) creature:removeCondition(CONDITION_OUTFIT) if Game.getStorageValue(MyTeam) == 0 then getWinnersBattle(EnemyTeam) else doBroadCastBattle(23,"[BattleField Information] ".._Lib_Battle_Info.TeamOne.name.." "..Game.getStorageValue(_Lib_Battle_Info.TeamOne.storage).." VS "..Game.getStorageValue(_Lib_Battle_Info.TeamTwo.storage).." " .._Lib_Battle_Info.TeamTwo.name) end end return true end creaturescript.xml <event type="login" name="battleflogin" script="battlefield.lua"/> <event type="preparedeath" name="battledeath" script="battlefield.lua"/> -------------------------------------------//------------------------------------------------- data\events\scripts abra o arquivo creature.lua e troque: function Creature:onTargetCombat(target) return true end por function Creature:onTargetCombat(target) if not self then return true end if self:isPlayer() and target:isPlayer() then if self:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 and target:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 or self:getStorageValue(_Lib_Battle_Info.TeamTwo.storage) >= 1 and target:getStorageValue(_Lib_Battle_Info.TeamTwo.storage) >= 1 then return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER end end return true end events.xml Troque: <event class="Creature" method="onTargetCombat" enabled="0" /> por <event class="Creature" method="onTargetCombat" enabled="1" /> -------------------------------------------//------------------------------------------------- data\globalevents\scripts battlefieldstart.lua function onStartup() Game.setStorageValue(_Lib_Battle_Info.TeamOne.storage, 0) Game.setStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0) Game.setStorageValue(_Lib_Battle_Info.storage_count, 0) return true end battlefieldthink.lua _Lib_Battle_Days = { ["Tuesday"] = { ["16:00"] = {players = 30}, ["15:32"] = {players = 2} }, ["Wednesday"] = { ["23:06"] = {players = 2} }, ["Thursday"] = { ["11:26"] = {players = 4}, ["20:30"] = {players = 10} } } function onThink(interval) if _Lib_Battle_Days[os.date("%A")] then hours = tostring(os.date("%X")):sub(1, 5) tb = _Lib_Battle_Days[os.date("%A")][hours] if tb and (tb.players % 2 == 0) then local tp = Game.createItem(1387, 1, _Lib_Battle_Info.tpPos) tp:setActionId(45000) CheckEvent(_Lib_Battle_Info.limit_Time) Game.setStorageValue(_Lib_Battle_Info.storage_count, tb.players) broadcastMessage("The event BattleField was opened and We are waiting "..tb.players.." Players! Team divided into "..((tb.players)/2).." VS "..((tb.players)/2)) end end return true end globalevents.xml <globalevent type="startup" name="NoBugBattle" script="battlefieldstart.lua"/> <globalevent interval="60000" name="BattleField" script="battlefieldthink.lua"/> -------------------------------------------//------------------------------------------------- data\lib\core battlefield.lua _Lib_Battle_Info = { Reward = { exp = {true, 100}, items = {true, 2160, 10}, premium_days = {false, 1} }, TeamOne = {name = "Black Assassins", storage = 140120, pos = {x=95,y=113,z=7}}, TeamTwo = {name = "Red Barbarians",storage = 140121,pos = {x=100,y=116,z=7}}, storage_count = 180400, tpPos = {x=92, y=116, z=7}, limit_Time = 2 -- em minutos } function resetBattle() Game.setStorageValue(_Lib_Battle_Info.TeamOne.storage, 0) Game.setStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0) end function doBroadCastBattle(type, msg) for _, cid in pairs(Game.getPlayers()) do if Player(cid):getStorageValue(_Lib_Battle_Info.TeamOne.storage) == 1 or Player(cid):getStorageValue(_Lib_Battle_Info.TeamTwo.storage) == 1 then Player(cid):sendTextMessage(type, msg) end end end function getWinnersBattle(storage) local str, c = "" , 0 for _, cid in pairs(Game.getPlayers()) do local player = Player(cid) if player:getStorageValue(storage) >= 1 then if _Lib_Battle_Info.Reward.exp[1] == true then player:addExperience(_Lib_Battle_Info.Reward.exp[2]) end if _Lib_Battle_Info.Reward.items[1] == true then player:addItem(_Lib_Battle_Info.Reward.items[2], _Lib_Battle_Info.Reward.items[3]) end if _Lib_Battle_Info.Reward.premium_days[1] == true then player:addPremiumDays(_Lib_Battle_Info.Reward.premium_days[2]) end player:teleportTo(player:getTown():getTemplePosition()) player:setStorageValue(storage, -1) player:removeCondition(CONDITION_OUTFIT) c = c+1 end end str = str .. ""..c.." Player"..(c > 1 and "s" or "").." from team "..(Game.getStorageValue(_Lib_Battle_Info.TeamOne.storage) == 0 and _Lib_Battle_Info.TeamTwo.name or _Lib_Battle_Info.TeamOne.name).." won the event battlefield!" resetBattle() OpenWallBattle() return broadcastMessage(str) end function OpenWallBattle() local B = { {1543,{x=96, y=124, z=7, stackpos = 1}}, {1543,{x=95, y=124, 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 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 CheckEvent(delay) if delay > 0 and Game.getStorageValue(_Lib_Battle_Info.storage_count) > 0 then broadcastMessage("[BattleField Event] We are waiting "..Game.getStorageValue(_Lib_Battle_Info.storage_count).." players to Battlefield starts") elseif delay == 0 and Game.getStorageValue(_Lib_Battle_Info.storage_count) > 0 then for _, cid in pairs(Game.getPlayers()) do local player = Player(cid) if player:getStorageValue(_Lib_Battle_Info.TeamOne.storage) == 1 or player:getStorageValue(_Lib_Battle_Info.TeamTwo.storage) == 1 then player:teleportTo(player:getTown():getTemplePosition()) player:setStorageValue(_Lib_Battle_Info.TeamOne.storage, -1) player:setStorageValue(_Lib_Battle_Info.TeamTwo.storage, -1) player:removeCondition(CONDITION_OUTFIT) end end broadcastMessage("The event cannot be started because not had enough players.") Game.setStorageValue(_Lib_Battle_Info.storage_count, 0) resetBattle() removeBattleTp() end addEvent(CheckEvent, 60000, delay-1) end Na mesma pasta procure por data\lib\core.lua e adc essa linha: dofile('data/lib/core/battlefield.lua') -------------------------------------------//------------------------------------------------- data\movements\scripts battlefield.lua local conditionRed = Condition(CONDITION_OUTFIT) conditionRed:setTicks(120 * 60 * 1000) conditionRed:setOutfit({lookType = 143, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94}) local conditionBlack = Condition(CONDITION_OUTFIT) conditionBlack:setTicks(120 * 60 * 1000) conditionBlack:setOutfit({lookType = 134, lookHead = 114, lookBody = 114, lookLegs = 114, lookFeet = 114}) function onStepIn(creature, item, position, fromPosition) local player = creature:getPlayer() if player == nil then return false end if player:getGroup():getId() >= 3 then return player:teleportTo(_Lib_Battle_Info.TeamOne.pos) end if Game.getStorageValue(_Lib_Battle_Info.storage_count) > 0 then local getMyTeam = Game.getStorageValue(_Lib_Battle_Info.TeamOne.storage) < Game.getStorageValue(_Lib_Battle_Info.TeamTwo.storage) and {_Lib_Battle_Info.TeamOne.storage,_Lib_Battle_Info.TeamOne.pos,_Lib_Battle_Info.TeamOne.name,conditionBlack} or {_Lib_Battle_Info.TeamTwo.storage,_Lib_Battle_Info.TeamTwo.pos, _Lib_Battle_Info.TeamTwo.name, conditionRed} player:addCondition(getMyTeam[4]) player:setStorageValue(getMyTeam[1], 1) Game.setStorageValue(getMyTeam[1], Game.getStorageValue(getMyTeam[1])+1) player:teleportTo(getMyTeam[2]) player:sendTextMessage(MESSAGE_INFO_DESCR, "You will join the team " .. getMyTeam[3] .. "!") Game.setStorageValue(_Lib_Battle_Info.storage_count, Game.getStorageValue(_Lib_Battle_Info.storage_count)-1) end if Game.getStorageValue(_Lib_Battle_Info.storage_count) == 0 then removeBattleTp() broadcastMessage("Battlefield will start in 2 minutes, please create your strategy!") addEvent(broadcastMessage, 2*60*1000-500, "BattleField will begin now!") addEvent(OpenWallBattle, 2*60*1000) end return true end movements.xml <movevent event="StepIn" actionid="45000" script="battlefield.lua"/> -------------------------------------------//------------------------------------------------- Configurações do TIME: em data\lib\core\battlefield.lua tem essas linhas: _Lib_Battle_Info = { Reward = { exp = {true, 100}, items = {true, 2160, 10}, premium_days = {false, 1} }, TeamOne = {name = "Black Assassins", storage = 140120, pos = {x=95,y=113,z=7}}, TeamTwo = {name = "Red Barbarians",storage = 140121,pos = {x=100,y=116,z=7}}, storage_count = 180400, tpPos = {x=92, y=116, z=7}, limit_Time = 10 -- em minutos } exp = {true,100} -- se vai receber exp ao ganhar evento? true ou false e quantidade items = {true, 2160, 10} -- se vai receber items ao ganhar o evento, true ou false e id, quantidade do item premium_days = {false, 1} -- se vai receber premium days ao ganhar o evento, true ou false e quantidade TeamOne = {name = "Black Assassins", storage = 140120, pos = {x=95,y=113,z=7}}, TeamTwo = {name = "Red Barbarians",storage = 140121,pos = {x=100,y=116,z=7}}, Name = nome do time Storage = Não mexa Pos = Onde cada time vai nascer storage_count = 180400 -- NÃO MEXAR tpPos = {x=92, y=116, z=7} -- Onde o teleporte irá aparecer ao iniciar o evento limit_Time = 10 -- É o tempo limite para os jogadores entrarem no teleport.(em minutos) Configurar Datas dos Eventos: Em data\globalevents\scripts\battlefieldthink.lua vai ter essa tabela: _Lib_Battle_Days = { ["Tuesday"] = { ["16:00"] = {players = 30}, ["15:32"] = {players = 2} }, ["Wednesday"] = { ["23:06"] = {players = 2} }, ["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. Link para o comentário https://xtibia.com/forum/topic/235694-battlefield-tfs-11/ Compartilhar em outros sites More sharing options...
tiagoduuarte 44 Postado Julho 23, 2015 Share Postado Julho 23, 2015 Hahaha bem bacana esse seu script, só fica meio enjuativo se vc colocar sempre esse evento, cê bem que podia colocar mais umas posições, tipo uns 7 locais de scripts configuraveis, ai um por semana, num lugar diferente não ia enjoar Link para o comentário https://xtibia.com/forum/topic/235694-battlefield-tfs-11/#findComment-1661963 Compartilhar em outros sites More sharing options...
Lumus 254 Postado Julho 23, 2015 Share Postado Julho 23, 2015 Acho que deu um biziu: em vez de remover a parede, tá criando as grade sde ID 1343 impossibilitando do evento continuar... Link para o comentário https://xtibia.com/forum/topic/235694-battlefield-tfs-11/#findComment-1661964 Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Julho 23, 2015 Autor Share Postado Julho 23, 2015 Acho que deu um biziu: em vez de remover a parede, tá criando as grade sde ID 1343 impossibilitando do evento continuar... isso é simples, você adiciona no MAPA EDITOR as parades, configura no script o ID delas e POS, quando começar o evento a função vai checar se tem realmente as paredes naquele lugar q vc configurou, caso não tiver, vai cria-las. Hahaha bem bacana esse seu script, só fica meio enjuativo se vc colocar sempre esse evento, cê bem que podia colocar mais umas posições, tipo uns 7 locais de scripts configuraveis, ai um por semana, num lugar diferente não ia enjoar vou fazer isso então, só vou adc uma storage igual eu fiz no map changer. qndo eu atualizar aviso Link para o comentário https://xtibia.com/forum/topic/235694-battlefield-tfs-11/#findComment-1661981 Compartilhar em outros sites More sharing options...
mkbrabsolute 134 Postado Julho 23, 2015 Share Postado Julho 23, 2015 Ótimo, quais as funções do TFS 1.1 que não tem no 1.0 pra adicionar nas sources? Link para o comentário https://xtibia.com/forum/topic/235694-battlefield-tfs-11/#findComment-1662003 Compartilhar em outros sites More sharing options...
Lumus 254 Postado Julho 23, 2015 Share Postado Julho 23, 2015 isso é simples, você adiciona no MAPA EDITOR as parades, configura no script o ID delas e POS, quando começar o evento a função vai checar se tem realmente as paredes naquele lugar q vc configurou, caso não tiver, vai cria-las. Vdd dlç.. não tinha percebido isso... mudei o ID das walls ficou perfeito! funcionando sem erros. Link para o comentário https://xtibia.com/forum/topic/235694-battlefield-tfs-11/#findComment-1662033 Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Julho 23, 2015 Autor Share Postado Julho 23, 2015 Ótimo, quais as funções do TFS 1.1 que não tem no 1.0 pra adicionar nas sources? só ir em data/events/script e ver que o creature.lua falta algumas funções que foram corrigidas no TFS 1.1 Link para o comentário https://xtibia.com/forum/topic/235694-battlefield-tfs-11/#findComment-1662034 Compartilhar em outros sites More sharing options...
Bruno 536 Postado Julho 23, 2015 Share Postado Julho 23, 2015 @, Em nome da comunidade agradeço pelo conteúdo, muito obrigado Não só por este, mas por todos! Abraço! Link para o comentário https://xtibia.com/forum/topic/235694-battlefield-tfs-11/#findComment-1662035 Compartilhar em outros sites More sharing options...
curruwilliam 28 Postado Agosto 3, 2015 Share Postado Agosto 3, 2015 Fiz o evento aqui.. sobrou 3 player do time black e não aconteceu nada. É por que eu não coloquei Pvp Tool na área e NoLogout ? Link para o comentário https://xtibia.com/forum/topic/235694-battlefield-tfs-11/#findComment-1663417 Compartilhar em outros sites More sharing options...
Administrador Administrador 1436 Postado Agosto 3, 2015 Administrador Share Postado Agosto 3, 2015 Grande contribuição! Link para o comentário https://xtibia.com/forum/topic/235694-battlefield-tfs-11/#findComment-1663419 Compartilhar em outros sites More sharing options...
elli 16 Postado Outubro 2, 2015 Share Postado Outubro 2, 2015 Evento ta funcionando de boa, o problema é q os cara tao matando próprio time e bugando tudo antes de começar Link para o comentário https://xtibia.com/forum/topic/235694-battlefield-tfs-11/#findComment-1670865 Compartilhar em outros sites More sharing options...
zipter98 1102 Postado Outubro 2, 2015 Share Postado Outubro 2, 2015 Evento ta funcionando de boa, o problema é q os cara tao matando próprio time e bugando tudo antes de começar Troque: return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER por: return false Link para o comentário https://xtibia.com/forum/topic/235694-battlefield-tfs-11/#findComment-1670874 Compartilhar em outros sites More sharing options...
elli 16 Postado Outubro 3, 2015 Share Postado Outubro 3, 2015 vlww kkk Link para o comentário https://xtibia.com/forum/topic/235694-battlefield-tfs-11/#findComment-1670925 Compartilhar em outros sites More sharing options...
Auspicioso 0 Postado Outubro 6, 2015 Share Postado Outubro 6, 2015 e o mapa? aquele que você postou no antigo funciona para essa versao ou eh só 8.6 +/-? Link para o comentário https://xtibia.com/forum/topic/235694-battlefield-tfs-11/#findComment-1671344 Compartilhar em outros sites More sharing options...
luanmax21 1 Postado Janeiro 25, 2016 Share Postado Janeiro 25, 2016 Este sistema funciona em OT server 8.6? Link para o comentário https://xtibia.com/forum/topic/235694-battlefield-tfs-11/#findComment-1683296 Compartilhar em outros sites More sharing options...
Posts Recomendados