Postado Outubro 18, 2015 9 anos Bom Fiz uma modificações no script desse evento pra funcionar em TFS 1.0. É um evento muito legal pra por no servidor. Você faz um duelo de Summons Aleatorios, no qual o nivel do player não intervem. Somente o poder dos monstros mesmo.Bem aqui esta os Scripts:OBS.: Criem monstros que possam ser sumonados.Action.xml O id você poe na Alavanca que levara a arena. Mude o item de recompensa e a quantidade de acordo com sua vontade. <action actionid="1515" script="monsterarena.lua"/> monsterarena.lua MonsterArena = { fromPosition = { Position(14885, 14912, 7), Position(14887, 14912, 7) }, toPosition = { Position(14861, 14913, 7), Position(14864, 14913, 7) }, spawnPosition = { Position(14861, 14914, 7), Position(14864, 14914, 7) }, area = { from = Position(14853, 14905, 7), to = Position(14872, 14920, 7) }, exitPosition = Position(14888, 14909, 7), reward = {itemId = 2312, count = 1}, blockItemId = 3362, -- Only convincable / summonable monsters -- You can create custom monsters which are stronger and convincable monsters = {'Hercules', 'Teseu', 'Agamenon', 'Perseu', 'Ajax'}, event = 'MonsterArenaDeath', players = {} } function MonsterArena.hasPlayer(cid) local position = player:getPosition() return position.x >= MonsterArena.area.from.x and position.y >= MonsterArena.area.from.y and position.x <= MonsterArena.area.to.x and position.y <= MonsterArena.area.to.y and position.z == MonsterArena.area.from.z end function MonsterArena.isOccupied() for _, pid in ipairs(MonsterArena.players) do local player = Player(pid) if player and MonsterArena.hasPlayer(player) then return true end end return false end function MonsterArena.clean() for i = 1, #MonsterArena.players do MonsterArena.players[i] = nil end end function onUse(cid, item, fromPosition, target, toPosition, isHotkey) if item.itemid ~= 1945 then doTransformItem(1946) return true end if MonsterArena.isOccupied() then doPlayerSendCancel(cid, 'The monster arena is currently occupied.') return true end local players = {} for _, fromPosition in ipairs(MonsterArena.fromPosition) do local creature = Tile(fromPosition):getTopCreature() if not creature or not creature:isPlayer() then doPlayerSendCancel(cid, 'You need another player for the monster arena.') return true end table.insert(players, creature) end MonsterArena.clean() local summons = {} for i, player in ipairs(players) do player:teleportTo(MonsterArena.toPosition[i]) MonsterArena.fromPosition[i]:sendMagicEffect(CONST_ME_POFF) MonsterArena.toPosition[i]:sendMagicEffect(CONST_ME_TELEPORT) local monsterName = MonsterArena.monsters[math.random(#MonsterArena.monsters)] local monster = Game.createMonster(monsterName, MonsterArena.spawnPosition[i], true) monster:setMaster(player) monster:registerEvent(MonsterArena.event) table.insert(summons, monster) Game.createItem(MonsterArena.blockItemId, 1, MonsterArena.spawnPosition[i]) player:sendTextMessage(MESSAGE_INFO_DESCR, string.format('A %s is fighting for you this round!', monsterName)) table.insert(MonsterArena.players, player.uid) end players[1]:setTarget(summons[2]) players[2]:setTarget(summons[1]) doTransformItem(1945) return true end creaturescripts.xml <event type="death" name="MonsterArenaDeath" script="monsterarenadeath.lua"/> monsterarenadeath.luafunction onDeath(monster, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) local winnerPlayer = Creature(killer):getMaster() local loserPlayer = Creature(monster):getMaster() local reward = MonsterArena.reward if reward then winnerPlayer:sendTextMessage(MESSAGE_INFO_DESCR, 'Your monster won the fight and earned a reward for you!') winnerPlayer:addItem(reward.itemId, reward.count) else winnerPlayer:sendTextMessage(MESSAGE_INFO_DESCR, 'Your monster won the fight!') end loserPlayer:sendTextMessage(MESSAGE_INFO_DESCR, 'Your monster lost the fight!') winnerPlayer:teleportTo(MonsterArena.exitPosition) loserPlayer:teleportTo(MonsterArena.exitPosition) MonsterArena.exitPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE) for _, position in ipairs(MonsterArena.spawnPosition) do local item = Tile(position):getItemById(MonsterArena.blockItemId) if item then item:remove() end end Creature(killer):remove() return true end Imagens:Alavanca você poe o id que escolhe no actions.xmlOs Dois Players sobem nos pisos e acionam a alavanca, o duelo começa. Quando o monstro morrer, os dois players são teleportados pra fora da arena e a recompensa é dada ao player vencedor.Área do Duelo:Bem Gente, tentei arrumar pra TFS 1.0, aqui funcionou tranquilamente. Espero ter ajudado.Não coloquei créditos porque achei em outro fórum e este tbm estava sem os créditos.Queria pedir para conseguirem uma alteração, cada turno de batalha só poderá ser feito um por vez, com esse script, mais de um turno pode ser feito. Não danifica o duelo, mas meio que atrapalha, pois um bixo ataca o do outro nas waves. Se puderem ajudar ai. segue a parte do script, na qual acho que esta o erro:function MonsterArena.isOccupied() for _, pid in ipairs(MonsterArena.players) do local player = Player(pid) if player and MonsterArena.hasPlayer(player) then return true end end return false end Valeu pela atenção Editado Outubro 18, 2015 9 anos por overseer (veja o histórico de edições) -- Att,Lucas Soledade Desenvolvedor de Servidores Inovação -> Colossus Server <-
Postado Outubro 19, 2015 9 anos Seu tópico foi aprovado e movido para a seção correta!Muito obrigado pela sua contribuição, nós do Tibia King agradecemos.Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP.
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.