RodriigoRobson 111 Postado Agosto 11, 2013 Share Postado Agosto 11, 2013 (editado) *Atualizado 04/04/14 *Suporta qualquer tipo de [banco de dados] *Suporta qualquer versao de ot server - Team Balance Por Tile - O Sistema se Basea em um Balanceamente Por Escolha. - Voce Pode Escolher que Time Vai Entrar e Pode Criar Varios Times ex: [Rosa,preto,branco,azul,vermelho......] - Team Storages: - Red: 6666 - Blue: 6667 - Vai em moveevents/Team1.lua e add isso: XML: <movevent type="StepIn" actionid="8888" event="script" value="Team1.lua"/> function onStepIn(cid, item, position, fromPosition) ----------- Cordenadas e Configuraçoes ------ --- Posiçao: {x=1008, y=981, z=7} canto Superior Esquerdo --- Posiçao: {x=1053, y=1002, z=7} Canto Inferior Direito ----- {} : Nao Mecha ------ 2 : Quantidade de Players Nesse Time ----- 6666: Storage do Time local from,to,players,limit = {x=1008, y=981, z=7}, {x=1053, y=1002, z=7},{},2 for _, pid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(pid,6666) >= 1 and getPlayerGroupId(pid) <= 1 then if isInRange(getCreaturePosition(pid), from, to) then table.insert(players, pid) end end end if #players >= limit then doTeleportThing(cid, fromPosition, true) doCreatureExecuteTalkAction(cid, "!online") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Team] Team esta Full!") doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) return true end return true end - Vai em moveevents/Team2.lua e add isso: XML: <movevent type="StepIn" actionid="8888" event="script" value="Team2.lua"/> function onStepIn(cid, item, position, fromPosition) ----------- Cordenadas e Configuraçoes ------ --- Posiçao: {x=1008, y=981, z=7} canto Superior Esquerdo --- Posiçao: {x=1053, y=1002, z=7} Canto Inferior Direito ----- {} : Nao Mecha ------ 2 : Quantidade de Players Nesse Time ----- 6667: Storage do Time local from,to,players,limit = {x=1008, y=981, z=7}, {x=1053, y=1002, z=7},{},2 for _, pid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(pid,6667) >= 1 and getPlayerGroupId(pid) <= 1 then if isInRange(getCreaturePosition(pid), from, to) then table.insert(players, pid) end end end if #players >= limit then doTeleportThing(cid, fromPosition, true) doCreatureExecuteTalkAction(cid, "!online") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Team] Team esta Full!") doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) return true end return true end - Em Moveevents cria um Arquivo chamado TileTeam.lua: XML: <movevent type="StepIn" actionid="14999-15000" event="script" value="TileTeam.lua"/> local config = { storageTeamOne = 6666, ---- RED storageTeamTwo = 6667 ------- BLUE } local BaseRed = {x= 1010, y= 1010 ,z= 7} ----- Posiçoes das Bases dos Times local BaseBlue = {x= 1010, y= 1010, z= 7} local conditionBlue = createConditionObject(CONDITION_OUTFIT) setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, 1800 * 1000) addOutfitCondition(conditionBlue, {lookType = 152, lookHead = 87, lookBody = 87, lookLegs = 87, lookFeet = 87}) -- Cor da Roupa local conditionRed = createConditionObject(CONDITION_OUTFIT) setConditionParam(conditionRed, CONDITION_PARAM_TICKS, 1800 * 1000) addOutfitCondition(conditionRed, {lookType = 143, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94}) function onStepIn(cid, item, pos) if item.actionid == 15000 then doTeleportThing(cid,BaseRed) setPlayerStorageValue(cid, config.storageTeamOne, 1) doPlayerSendTextMessage(cid, 22, "Voce Entrou no Time Vermelho !") doAddCondition(cid, conditionRed) elseif item.actionid == 14999 then doTeleportThing(cid,BaseBlue) setPlayerStorageValue(cid, config.storageTeamTwo, 1) doAddCondition(cid, conditionBlue) doPlayerSendTextMessage(cid, 22, "Voce Entrou no Time Azul !") end return true end - Depois vai em creaturescripts/Logout.lua e add isso: function onLogout(cid)if getPlayerStorageValue(cid,6666) >= 1 thensetPlayerStorageValue(cid,6666,0)doBroadcastMessage("O Jogador "..getCreatureName(cid).. " Saiu do Time Red!",22)endif getPlayerStorageValue(cid,6667) >= 1 thensetPlayerStorageValue(cid,6667,0)doBroadcastMessage("O Jogador "..getCreatureName(cid).. " Saiu do Time Blue!",22)endreturn trueend XML: <event type="logout" name="logar" event="script" value="Logout.lua"/> Registra no Login.lua: registerCreatureEvent(cid, "logar") - Depois Cria um Arquivo chamado Death.lua: function onDeath(cid, corpse, killer)if getPlayerStorageValue(cid,6666) >= 1 thensetPlayerStorageValue(cid,6666,0)doBroadcastMessage("O Jogador "..getCreatureName(cid).. " Morreu e Saiu do Time Red!",22)endif getPlayerStorageValue(cid,6667) >= 1 thensetPlayerStorageValue(cid,6667,0)doBroadcastMessage("O Jogador "..getCreatureName(cid).. " Morreu e Saiu do Time Blue!",22)endreturn trueend XML: <event type="death" name="deathtime" event="script" value="Death.lua"/> Registra no Login.lua: registerCreatureEvent(cid, "deathtime") - Depois talkactions/online.lua function onSay(cid, words, param, channel)local players = getPlayersOnline()local x = 0local y = 0local z = 0local adm = 0for i, pid in ipairs(players) doif getPlayerStorageValue(pid,6666) == 1 and getPlayerGroupId(pid) <= 1 thenx = x + 1elseif getPlayerStorageValue(pid,6667) == 1 and getPlayerGroupId(pid) <= 1 theny = y + 1elseif getPlayerGroupId(pid) >= 5 thenadm = adm + 1endz = z + 1endlocal strings, i, position, added, showGamemasters = {""}, 1, 1, false, getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))for _, pid in ipairs(getPlayersOnline()) doif(added) thenif(i > (position * 7)) thenstrings[position] = strings[position] .. ","position = position + 1strings[position] = ""elsestrings[position] = i == 1 and "" or strings[position] .. ", "endendadded = falseif((showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) thenstrings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. ":" .. getPlayerVocationName(pid) .. "]"i = i + 1added = trueendenddoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player" .. (i > 1 and "s" or "") .. " online:")for i, str in ipairs(strings) doif(str:sub(str:len()) ~= ",") thenstr = str .. "."enddoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)endminutes,seconds = getTime(getGlobalStorageValue(501) - os.time())doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"".. x .." Jogadores do time Red online!")doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"".. y .." Jogadores do time Blue online!")doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"".. adm .." Admins online!")return trueend xml: <talkaction words="!online" event="script" value="online.lua"/> - Team Balance Por Login *ATUALIZADO [06/10/13] *Suport [Mysql] *Suporta qualquer tipo de [banco de dados] *Suporta qualquer versao de ot server *Favor trocar todos os scripts e nao reaproveitar os Antigos scripts *Download Mapa ja configurado: http://www.4shared.com/rar/glPqSHjG/world.html? Eae Galera , eu vi muita gente querendo o Script de Team balance e nao os que tem na Net para baixar Eu vou ensinar a instalar o sistema em qualquer Servidor de War: *Primeiro vai na sua Lib e cria um arquivo chamado War.Lib: -- config -- WAR_MAP_NAMES = {'FIBULA', 'EDRON', ' VENORE', 'THAIS', 'ARENA'} --- Nomes dos Mapas WAR_SPAWNS = {} WAR_SPAWNS[1] = {{2,3},{4,5}} -- map 1 WAR_SPAWNS[2] = {{6,7},{8,9}} -- map 2 WAR_SPAWNS[3] = {{10,11},{12,13}} -- map 3 ---- < Townids dos Mapas WAR_SPAWNS[4] = {{14,15},{16,17}} -- map 4 WAR_SPAWNS[5] = {{18,18},{19,19}} -- map 5 WAR_MAP_CYCLE = {{1,2},{2,3},{3,4},{4,5},{5,1}} --- nessa parte o script faz um ciclo de mapas começa com : Map(1) depois (2) etc... no final tem que volta para o mapa (1) WAR_COLORS = {{98,94,94,94},{89,89,89,89}} WAR_TEAM_NAMES = {'Team Red','Team Blue'} WAR_TEAMS = 1 -------------------------------------------------------- STORAGE_TEAM_ID = 12000 STORAGE_SKULL = 13000 GLOBAL_STORAGE_MAP = 500 GLOBAL_STORAGE_MAP_CHANGE_TIME = 501 warInitialized = 0 function getTime(s) local n = math. floor(s / 60) s = s - (60 * n) return n, s end function getSpawn(cid) local map_info = WAR_MAP_CYCLE[getGlobalStorageValue(GLOBAL_STORAGE_MAP)] local map_id = map_info[1] local map_spawns = WAR_SPAWNS[map_id] local team_spawns = map_spawns[getPlayerStorageValue(cid, STORAGE_TEAM_ID)] return getTownTemplePosition(team_spawns[math.random(1,#team_spawns)]) end function getTeamMembers(id) local players = getPlayersOnline() local team = {} if #players == 0 then return team end for i, cid in ipairs(players) do if getPlayerStorageValue(cid, STORAGE_TEAM_ID) == id and getPlayerGroupId(cid) == 1 then table.insert(team, cid) end end return team end function updateOutfit(cid) if WAR_TEAMS == 1 then --outfit local colors = WAR_COLORS[getPlayerStorageValue(cid, STORAGE_TEAM_ID)] local outfit = getCreatureOutfit(cid) outfit.lookHead = colors[1] outfit.lookBody = colors[2] outfit.lookLegs = colors[3] outfit.lookFeet = colors[4] doCreatureChangeOutfit(cid, outfit) end end function setTeam(cid) if WAR_TEAMS ~= 1 then setPlayerStorageValue(cid, STORAGE_TEAM_ID, 1) else local team1 = getTeamMembers(1) local team2 = getTeamMembers(2) if #team1 >= #team2 then setPlayerStorageValue(cid, STORAGE_TEAM_ID, 2) else setPlayerStorageValue(cid, STORAGE_TEAM_ID, 1) end updateOutfit(cid) end end function cronWar() if getGlobalStorageValue(GLOBAL_STORAGE_MAP_CHANGE_TIME) < os.time() then -- change map local map_info = WAR_MAP_CYCLE[getNextMapId()] local map_id = map_info[1] doTeleportThing(pid,getTeamSpawn(pid),false) -- teleporta para a base if WAR_TEAMS == 1 then doBroadcastMessage(getTeamScore(), MESSAGE_STATUS_DEFAULT) end setMap(getNextMapId()) elseif getGlobalStorageValue(GLOBAL_STORAGE_BROADCAST_TOP5) < os.time() then -- broadcast top 5 setGlobalStorageValue(GLOBAL_STORAGE_BROADCAST_TOP5, os.time()+WAR_BROADCAST_INTERVAL_TOP5) addEvent(doBroadcastMessage, 1000, getTop5Players(), MESSAGE_STATUS_CONSOLE_ORANGE) end addEvent(cronWar, 1000) end function getNextMapId() if getGlobalStorageValue(GLOBAL_STORAGE_MAP) == #WAR_MAP_CYCLE then return 1 end return getGlobalStorageValue(GLOBAL_STORAGE_MAP)+1 end function setMap(id) local map_info = WAR_MAP_CYCLE[id] setGlobalStorageValue(GLOBAL_STORAGE_MAP,id) setGlobalStorageValue(GLOBAL_STORAGE_MAP_CHANGE_TIME,os.time()+60*40) local players = getPlayersOnline() for i, cid in ipairs(players) do addEvent(doRemoveCreature, 5*1000, cid, true) doCreatureSetSkullType(cid, 0) doCreatureAddHealth(cid, getCreatureMaxHealth(cid)) doCreatureAddMana(cid, getCreatureMaxMana(cid)) doChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid)) doTeleportThing(cid, getSpawn(cid), TRUE) removeConditions(cid) end end function removeConditions(cid) doRemoveCondition(cid, CONDITION_INFIGHT) doRemoveCondition(cid, CONDITION_PARALYZE) doRemoveCondition(cid, CONDITION_ENERGY) doRemoveCondition(cid, CONDITION_FIRE) doRemoveCondition(cid, CONDITION_POISON) doRemoveCondition(cid, CONDITION_DRUNK) end Depois vai na cria um arquivo chamado data.lib ass essa linha dentro do arquivo data.lib dofile(getDataDir() .. "lib/WAR.lua") *Depois vai em data/creaturescripts/loginwar.lua function onLogin(cid) if warInitialized == 0 then warInitialized = 1 setPlayerStorageValue(cid, STORAGE_TEAM_ID, 1) setMap(1) cronWar() end setPlayerStorageValue(cid, STORAGE_TEAM_ID, 0) setTeam(cid) doTeleportThing(cid, getSpawn(cid), TRUE) return TRUE end *Agora a parte do Change Map, vai em globalevents/scripts/changemap.lua e add isso : function onThink(interval, lastExecution)broadcastMessage("Auto-Kick for Map change in 10 second.", MESSAGE_STATUS_CONSOLE_BLUE)addEvent(onThink2, 1000)return TRUEendfunction onThink2(interval, lastExecution)broadcastMessage("Auto-Kick for Map change in 9 seconds.", MESSAGE_STATUS_CONSOLE_BLUE)addEvent(onThink3, 1000)return TRUEendfunction onThink3(interval, lastExecution)broadcastMessage("Auto-Kick for Map change in 8 seconds.", MESSAGE_STATUS_CONSOLE_BLUE)addEvent(onThink4, 1000)return TRUEendfunction onThink4(interval, lastExecution)broadcastMessage("Auto-Kick for Map change in 7 seconds.", MESSAGE_STATUS_CONSOLE_BLUE)addEvent(onThink5, 1000)return TRUEendfunction onThink5(interval, lastExecution)broadcastMessage("Auto-Kick for Map change in 6 seconds.", MESSAGE_STATUS_CONSOLE_BLUE)addEvent(onThink6, 1000)return TRUEendfunction onThink6(interval, lastExecution)broadcastMessage("Auto-Kick for Map change in 5 seconds.", MESSAGE_STATUS_CONSOLE_BLUE)addEvent(onThink7, 1000)return TRUEendfunction onThink7(interval, lastExecution)broadcastMessage("Auto-Kick for Map change in 4 seconds.", MESSAGE_STATUS_CONSOLE_BLUE)addEvent(onThink8, 1000)return TRUEendfunction onThink8(interval, lastExecution)broadcastMessage("Auto-Kick for Map change in 3 seconds.", MESSAGE_STATUS_CONSOLE_BLUE)addEvent(onThink9, 1000)return TRUEendfunction onThink9(interval, lastExecution)broadcastMessage("Auto-Kick for Map change in 2 seconds.", MESSAGE_STATUS_CONSOLE_BLUE)addEvent(onThink10, 1000)return TRUEendfunction onThink10(interval, lastExecution)broadcastMessage("Auto-Kick for Map change in 1 seconds.", MESSAGE_STATUS_CONSOLE_BLUE)addEvent(onThink11, 1000)return TRUEendfunction onThink11(interval)setMap(getNextMapId()) return TRUEend XmL: <globalevent name="mudarmapa" interval="2400" event="script" value="changemap.lua"/> 2400 é 40 minutos *Agora os Comandos [Online e Changemap] : online: vai em talkactions/script/online.lua: function onSay(cid, words, param, channel) local players = getPlayersOnline() local x = 0 local y = 0 local z = 0 local adm = 0 for i, pid in ipairs(players) do if getPlayerStorageValue(pid,12000) == 1 and getPlayerGroupId(pid) <= 1 then x = x + 1 elseif getPlayerStorageValue(pid,12000) == 2 and getPlayerGroupId(pid) <= 1 then y = y + 1 elseif getPlayerGroupId(pid) >= 5 then adm = adm + 1 end z = z + 1 end local strings, i, position, added, showGamemasters = {""}, 1, 1, false, getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand')) for _, pid in ipairs(getPlayersOnline()) do if(added) then if(i > (position * 7)) then strings[position] = strings[position] .. "," position = position + 1 strings[position] = "" else strings[position] = i == 1 and "" or strings[position] .. ", " end end added = false if((showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. ":" .. getPlayerVocationName(pid) .. "]" i = i + 1 added = true end end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player" .. (i > 1 and "s" or "") .. " online:") for i, str in ipairs(strings) do if(str:sub(str:len()) ~= ",") then str = str .. "." end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str) end minutes,seconds = getTime(getGlobalStorageValue(501) - os.time()) doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"".. x .." Jogadores do time Red online!") doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"".. y .." Jogadores do time Blue online!") doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"".. adm .." Admins online!") doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"RedCTF [".. (getGlobalStorageValue(18888)).."] VS ["..(getGlobalStorageValue(18889)).. "] BlueCTF [-*-] RedFrag [".. (getGlobalStorageValue(5002)).."] VS ["..(getGlobalStorageValue(5001)).."] BlueFrag ") doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Faltam ".. minutes .." minutos e "..seconds.. " segundos para mudar o mapa!") return trueend *Changemap vai em talkactions/scripts/changemap.lua: function onSay(cid, words, param)setMap(getNextMapId()) return trueend XML: <talkaction log="yes" access="5" words="/changemap" event="script" value="changemap.lua"/> *Obs: da pra por 2 bases pra cada Time um exemplo: [1] = {{2,2},{3,3}}, = voce vai no seu mapa editor e coloca 4 bases 2 azul e 2 vermelho ai vc add as townid de cada time ficando assim [1] = {{2,3},{4,5}}, = ficando assim ele vai ter 4 bases 2 pra cada time e so configurar os templos de cada time no MAPA editor =D *obs²: nao adianta instala o sistema sem coloca as townid/os templos no Mapa editor vai da Erro .Voce tem que ir no mapa editor e coloca pelo menos 2 mapa pro sistema de changemap funciona se nao vai da erro tambem Creditos : Nextbr Editado Abril 8, 2014 por Nextbr Link para o comentário https://xtibia.com/forum/topic/219305-balanceamento-de-times-war-tile-login/ Compartilhar em outros sites More sharing options...
kttallan 319 Postado Agosto 11, 2013 Share Postado Agosto 11, 2013 Nao gosto de tibia mais segura meu rep+ mt bem explicado Link para o comentário https://xtibia.com/forum/topic/219305-balanceamento-de-times-war-tile-login/#findComment-1549922 Compartilhar em outros sites More sharing options...
DavyziinC 1 Postado Setembro 24, 2013 Share Postado Setembro 24, 2013 ta cara mais meu ot tem CTF eu te mando meu war.lib e login tu arruma bllz? Link para o comentário https://xtibia.com/forum/topic/219305-balanceamento-de-times-war-tile-login/#findComment-1564748 Compartilhar em outros sites More sharing options...
RodriigoRobson 111 Postado Setembro 24, 2013 Autor Share Postado Setembro 24, 2013 (editado) Cara ja tem um server pronto com Team balance e CTF http://www.xtibia.com/forum/topic/211379-86-mini-games-war-10-advanced/ quer tirar o ctf? vai em Moveevents/moveevents.xml e tira essa tag > <movevent type="StepIn" actionid="17779;17778" event="script" value="ctf/CTF.lua"/> Editado Setembro 24, 2013 por Nextbr Link para o comentário https://xtibia.com/forum/topic/219305-balanceamento-de-times-war-tile-login/#findComment-1564750 Compartilhar em outros sites More sharing options...
VekMower 1 Postado Outubro 2, 2013 Share Postado Outubro 2, 2013 Cara pode me ajudar? esta dando erro no distro (IMAGENS ABAIXO) fiz tudo certo só que quando eu coloco essa linha setTeam(cid) no Login dá o erro igual imagem abaixo e se eu tiro ele para o erro,se poder me ajudar preciso muito desse script. Script Link para o comentário https://xtibia.com/forum/topic/219305-balanceamento-de-times-war-tile-login/#findComment-1568576 Compartilhar em outros sites More sharing options...
RodriigoRobson 111 Postado Outubro 6, 2013 Autor Share Postado Outubro 6, 2013 [Tutorial Atualizado] [06/10/13] Link para o comentário https://xtibia.com/forum/topic/219305-balanceamento-de-times-war-tile-login/#findComment-1569848 Compartilhar em outros sites More sharing options...
RodriigoRobson 111 Postado Abril 5, 2014 Autor Share Postado Abril 5, 2014 Script Atualizado: 04/04/14 - Balanceamento de Times (WAR - SERVER) Por [Login & Tile] Link para o comentário https://xtibia.com/forum/topic/219305-balanceamento-de-times-war-tile-login/#findComment-1633663 Compartilhar em outros sites More sharing options...
Posts Recomendados