Postado Abril 9, 2015 10 anos Este é um post popular. Arena PvP 1x1 em data/lib/ crie arenapvp.lua : -- CONFIGURAÇÕES AQUI arena = { --INICIO DAS CONFIGS DA POSIÇÃO-- time = 10, -- Minutos se não houver vencedor ambos são kikados player1pos = {x= 652, y= 1024, z= 7}, -- Posição 1 player2pos = {x= 652, y= 1026, z= 7}, -- Posição 2 nplayer1pos = {x= 605, y= 1008, z= 7}, -- Posição para aonde o player 1 vai ser teleportado.. nplayer2pos = {x= 612, y= 1008, z= 7}, -- Posição para aonde o player 2 vai ser teleportado.. toPos = {x= 602, y=1004, z= 7}, fromPos = {x= 610, y=1013, z= 7}, exitPos = {x= 654, y=1025, z= 7}, -- FIM DAS CONFIGS DA POSIÇÃO-- -- NÃO EDITAR SE NÃO POSSUIR CONHECIMENTO -- gstorage = 14784, -- //GLOBAL STORAGE pstorage = 14785, -- //PLAYER STORAGES } function getQuantidadeCreature(toPos, fromPos) arenaPlayers = 0 for x = toPos.x, fromPos.x do for y = toPos.y, fromPos.y do player = getTopCreature({x= x, y= y, z= fromPos.z}).uid if isPlayer(player) then arenaPlayers = arenaPlayers + 1 end end end return arenaPlayers end function doRemoveCreature(toPos, fromPos, teleportTo, storage) for x = toPos.x, fromPos.x do for y = toPos.y, fromPos.y do player = getTopCreature({x= x, y= y, z= fromPos.z}).uid if isPlayer(player) then doTeleportThing(player, teleportTo) setPlayerStorageValue(player, storage, -1) end end end return true end em data/actions/scripts crie arenapvp.lua : dofile('data/lib/arenapvp.lua') function onUse(cid, item, toPosition, itemEx, fromPosition) local player1 = getTopCreature(arena.player1pos).uid local player2 = getTopCreature(arena.player2pos).uid if item.itemid == 1945 then doTransformItem(item.uid, item.itemid+1) if getGlobalStorageValue(arena.gstorage) < 1 then if isPlayer(player1) and isPlayer(player2) then doPlayerSendTextMessage(player1, MESSAGE_STATUS_WARNING, "Fight!") doPlayerSendTextMessage(player2, MESSAGE_STATUS_WARNING, "Fight!") doSendMagicEffect(getThingPos(player1), CONST_ME_POFF) doSendMagicEffect(getThingPos(player2), CONST_ME_POFF) setPlayerStorageValue(player1, arena.pstorage, 1) setPlayerStorageValue(player2, arena.pstorage, 1) doTeleportThing(player1, arena.nplayer1pos) doTeleportThing(player2, arena.nplayer2pos) setGlobalStorageValue(arena.gstorage, 1) addEvent(function () if getQuantidadeCreature(arena.toPos, arena.fromPos) > 0 then doRemoveCreature(arena.toPos, arena.fromPos, arena.exitPos, arena.pstorage) setGlobalStorageValue(arena.gstorage, -1) end end, 1000*60*arena.time) else doCreatureSay(cid, "need two players to start", TALKTYPE_ORANGE_1) end else doCreatureSay(cid, "has two players in arena", TALKTYPE_ORANGE_1) end elseif item.itemid == 1946 then doTransformItem(item.uid, item.itemid-1) end return true end actions.XML : <!-- Arena Pvp --> <action actionid="2170" event="script" value="arenapvp.lua"/> em data/creaturescripts/scripts crie arenapvp.lua : dofile('data/lib/arenapvp.lua') function onStatsChange(cid, attacker, type, combat, value) if isPlayer(cid) and getPlayerStorageValue(cid, arena.pstorage) == 1 and type == STATSCHANGE_HEALTHLOSS then if value >= getCreatureHealth(cid) then local killer = attacker doCreatureAddHealth(cid, getCreatureMaxHealth(cid)) doCreatureAddMana(cid, getCreatureMaxMana(cid)) doCreatureAddHealth(killer, getCreatureMaxHealth(killer)) doCreatureAddMana(killer, getCreatureMaxMana(killer)) doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "[Arena]: you lost the duel!") doPlayerSendTextMessage(killer, MESSAGE_STATUS_WARNING, "[Arena]: you win the duel!") doTeleportThing(cid, arena.exitPos) doTeleportThing(killer, arena.exitPos) doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) doSendMagicEffect(getThingPos(killer), CONST_ME_POFF) setPlayerStorageValue(cid, arena.pstorage, -1) setPlayerStorageValue(killer, arena.pstorage, -1) setGlobalStorageValue(arena.gstorage, -1) return false end end return true end function onLogin(cid) registerCreatureEvent(cid, "ArenaPVP") return true end creaturescripts.XML <!-- ARENA PVP --> <event type="statschange" name="ArenaPVP" event="script" value="arenapvp.lua"/> <event type="login" name="verf_PVP" event="script" value="arenapvp.lua"/> Testado em tfs 0.4. abrçs Agradeço ao zipter e ao whitewolf, por terem me ajudado em alguns empecilhos e créditos a imagem do zibusu(otland). Editado Abril 9, 2015 10 anos por Summ (veja o histórico de edições)
Postado Abril 9, 2015 10 anos O tópico foi movido para a área correta, preste mais atenção da próxima vez! Leia as regras do fórum: http://tibiaking.com/forum/topic/1281-regras-gerais/?p=7680 Este tópico foi movido: De: "OTServ → Aprovação de Tópicos de Conteúdos" Para: "OTServ → Scripting → Sistemas e MODs"
Postado Abril 10, 2015 10 anos Nossa ,bacana ,vou testar,obrigador por liberar,uma pena vc estar partindo.Boa sorte e sucesso em sua vida.
Postado Abril 20, 2015 10 anos vllw mano. Mas minha alavanca n ta esta teleportando os plays. na action do chao e na alavanca, coloco q action id, ou uniq id ? Editado Abril 20, 2015 10 anos por mkmmkm (veja o histórico de edições)
Postado Abril 20, 2015 10 anos vllw mano. Mas minha alavanca n ta esta teleportando os plays. na action do chao e na alavanca, coloco q action id, ou uniq id ? Sou o summ... você só precisa colocar a pos que os 2 player tem que estar aqui : player1pos = {x= 652, y= 1024, z= 7}, -- Posição 1 player2pos = {x= 652, y= 1026, z= 7}, -- Posição 2 não precisa colocar action id no piso. Editado Abril 20, 2015 10 anos por Stinger (veja o histórico de edições)
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.