Furabio 257 Postado Abril 10, 2015 Share Postado Abril 10, 2015 É um sistema já conhecido da versão 7.4. Para instalar em seu servidor basta configurar, os script de acordo com o nome da pos da img abaixo : creaturescripts.xml <event type="preparedeath" name="pvparena" script="pvparena.lua"/> <event type="login" name="pvparena_r" script="pvparena.lua"/> pvparena.lua local arena = { frompos = {x = 1041, y = 985, z = 9}, topos = {x = 1052, y = 991, z = 9}, exitpos = {x = 1038, y = 988, z = 8} } function onPrepareDeath(player, lastHitKiller, mostDamageKiller) if player:isPlayer() then local ppos = player:getPosition() if isInRange(ppos, arena.frompos, arena.topos) then local maxhp = player:getMaxHealth() player:addHealth(maxhp) addEvent(doCreatureAddHealth, 100, player:getId(), maxhp) player:sendTextMessage(MESSAGE_STATUS_WARNING,"[Arena]: You lost the duel.") end if isInRange(ppos, arena.frompos, arena.topos) then player:teleportTo(arena.exitpos) return true end end return true end function onLogin(player) player:registerEvent("pvparena") return true end actions.xml <action uniqueid="6040" script="arenapvp.lua"/> pvparena.lua -- CONFIG BEGINS HERE -- local arena = { frompos = {x = 1041, y = 985, z = 9}, topos = {x = 1052, y = 991, z = 9}, exitpos = {x = 1038, y = 988, z = 8} } local checkpvparena = true -- checks if someone is blocking the arena local duel_limit = 15 * 60 -- in seconds local player1pos = {x = 1040, y = 987, z = 8} local leverpos = {x = 1040, y = 988, z = 8} local player2pos = {x = 1040, y = 989, z = 8} local nplayer1pos = {x = 1042, y = 988, z = 9} local nplayer2pos = {x = 1051, y = 988, z = 9} -- CONFIG ENDS HERE -- function lever_back(uid) doTransformItem(uid,1945) return true end function kick_r() if getCreaturesInQuestArea(TYPE_PLAYER, arena.frompos, arena.topos, GET_COUNT) > 1 then for a = arena.frompos.x, arena.topos.x do for b = arena.frompos.y, arena.topos.y do pos = {x=a,y=b,z=11,stackpos = 255} if(isPlayer(getTopCreature(pos).uid)) then doPlayerSendTextMessage(getTopCreature(pos).uid,MESSAGE_INFO_DESCR,"Time up. Round drawn.") doTeleportThing(getTopCreature(pos).uid,arena.exitpos) end end end end return true end local TYPE_PLAYER = 1 local TYPE_MONSTER = 2 local TYPE_NPC = 3 local TYPE_ALL = 4 local GET_COUNT = 1 local GET_UID = 2 function getCreaturesInQuestArea(type, fromPos, toPos, get, countSummon) local types = { [TYPE_PLAYER] = isPlayer, [TYPE_MONSTER] = isMonster, [TYPE_NPC] = isNpc, [TYPE_ALL] = isCreature } local tmp = {} local t = types[type] if not t then return print("[!] --> [Warning - Function::getCreaturesInQuestArea] Unknown type " .. (type or "(nil value)")) end local thing local pos for x = fromPos.x, toPos.x do for y = fromPos.y, toPos.y do for z = fromPos.z, toPos.z do pos = {x = x, y = y, z = z} thing = getTopCreature(pos) if t(thing.uid) then table.insert(tmp, thing.uid) if not countSummon and isSummon(thing.uid) then for i = 1, #tmp do if tmp[i] == thing.uid then table.remove(tmp, i) break end end end end end end end return (get == GET_COUNT and #tmp or get == GET_UID and tmp or print("[Warning - Function::getCreaturesInQuestArea] Unknown type to get " .. (get or "(nil value)"))) end function onUse(player, item, frompos, item2, topos) local cid = player:getId() if item.itemid == 1945 then if isPlayer(getTopCreature(player1pos).uid) == true and isPlayer(getTopCreature(player2pos).uid) == true then if checkpvparena then if getCreaturesInQuestArea(TYPE_PLAYER, arena.frompos, arena.topos, GET_COUNT) > 0 then if getCreaturesInQuestArea(TYPE_PLAYER, arena.frompos, arena.topos, GET_COUNT) == 1 then for c = arena.frompos.x, arena.topos.x do for d = arena.frompos.y, arena.topos.y do pos = {x=c,y=d,z=11, stackpos = 255} if(isPlayer(getTopCreature(pos).uid)) then doPlayerSendTextMessage(getTopCreature(pos).uid,MESSAGE_INFO_DESCR,"You have been kicked from the arena.") doTeleportThing(getTopCreature(pos).uid,arena.exitpos) end end end else arena_counter = getGlobalStorageValue(24510) - os.time() if arena_counter < 0 then for c = arena.frompos.x, arena.topos.x do for d = arena.frompos.y, arena.topos.y do pos = {x=c,y=d,z=11, stackpos = 255} if(isPlayer(getTopCreature(pos).uid)) then doPlayerSendTextMessage(getTopCreature(pos).uid,MESSAGE_INFO_DESCR,"You have been kicked from the arena.") doTeleportThing(getTopCreature(pos).uid,arena.exitpos) end end end else doCreatureSay(cid, "There is still active duel.\n" .. showTimeLeft(arena_counter, true) .. " left.\nPlease wait for your turn.", TALKTYPE_ORANGE_1) pvpaback = addEvent(lever_back, 5000, item.uid) return false end end end end -- let the match begin doSendMagicEffect(player1pos,CONST_ME_POFF) doSendMagicEffect(player2pos,CONST_ME_POFF) doPlayerSendTextMessage(getTopCreature(player1pos).uid,MESSAGE_STATUS_WARNING,"Fight!") doPlayerSendTextMessage(getTopCreature(player2pos).uid,MESSAGE_STATUS_WARNING,"Fight!") doTeleportThing(getTopCreature(player1pos).uid,nplayer1pos) doTeleportThing(getTopCreature(player2pos).uid,nplayer2pos) doSendMagicEffect(nplayer1pos,CONST_ME_TELEPORT) doSendMagicEffect(nplayer2pos,CONST_ME_TELEPORT) doTransformItem(getTileItemById(leverpos, 1945).uid,item.itemid+1) setGlobalStorageValue(24510,os.time() + duel_limit) pvpaback = addEvent(lever_back, 5000, item.uid) if arena_kick_r then stopEvent(arena_kick_r) end arena_kick_r = addEvent(kick_r, duel_limit * 1000) else doCreatureSay(cid, "You need two players to enter the arena.", TALKTYPE_ORANGE_1) pvpaback = addEvent(lever_back, 5000, item.uid) return false end else -- if timer or checking is offline player can push the lever manually if pvpaback then doPlayerSendDefaultCancel(cid, RETURNVALUE_CANNOTUSETHISOBJECT) else doTransformItem(getTileItemById(leverpos, 1946).uid,1945) end end return true end Créditos zbizu. Link para o comentário https://xtibia.com/forum/topic/232931-tfs-11-classic-pvp-arena/ Compartilhar em outros sites More sharing options...
Lumus 254 Postado Maio 6, 2015 Share Postado Maio 6, 2015 if isInRange(ppos, arena.frompos, arena.topos) then Aqui está dando erro nessa linha <a nil value> Link para o comentário https://xtibia.com/forum/topic/232931-tfs-11-classic-pvp-arena/#findComment-1650352 Compartilhar em outros sites More sharing options...
Furabio 257 Postado Maio 6, 2015 Autor Share Postado Maio 6, 2015 Mande o erro completo ... verifique se configurou aqui corretamente : local arena = { frompos = {x = 1041, y = 985, z = 9}, topos = {x = 1052, y = 991, z = 9}, exitpos = {x = 1038, y = 988, z = 8} } Link para o comentário https://xtibia.com/forum/topic/232931-tfs-11-classic-pvp-arena/#findComment-1650359 Compartilhar em outros sites More sharing options...
Lumus 254 Postado Maio 6, 2015 Share Postado Maio 6, 2015 Consegui arrumar.. uma dúvida, teria como adaptar ele pra monstros também? Porque foi o único método que achei para ter a arena novamente no meu servidor. TFS 1.1... coloquei ele sem o uso de alavanca e tals, e funcionou. Link para o comentário https://xtibia.com/forum/topic/232931-tfs-11-classic-pvp-arena/#findComment-1650365 Compartilhar em outros sites More sharing options...
Furabio 257 Postado Maio 6, 2015 Autor Share Postado Maio 6, 2015 Adaptar esse não, teria como eu fazer outro, só falar como quer, que quandro sobrar um tempo pra scriptear eu faço. Link para o comentário https://xtibia.com/forum/topic/232931-tfs-11-classic-pvp-arena/#findComment-1650367 Compartilhar em outros sites More sharing options...
Administrador Administrador 1436 Postado Maio 6, 2015 Administrador Share Postado Maio 6, 2015 Muito bom! Bem formulado =) Link para o comentário https://xtibia.com/forum/topic/232931-tfs-11-classic-pvp-arena/#findComment-1650373 Compartilhar em outros sites More sharing options...
Lumus 254 Postado Maio 6, 2015 Share Postado Maio 6, 2015 Adaptar esse não, teria como eu fazer outro, só falar como quer, que quandro sobrar um tempo pra scriptear eu faço. é o básico, se o player morrer na área definida(para monstros)\/ ele não irá perder nem loot, nem xp, nada, como se tivesse morrendo na arena mesmo, e sendo teleportado para uma pos específica. Só que no TFS 1.1 não funciona aquela parada de No-PVP / PVP local arena = { frompos = {x = 1041, y = 985, z = 9}, topos = {x = 1052, y = 991, z = 9}, exitpos = {x = 1038, y = 988, z = 8} } Link para o comentário https://xtibia.com/forum/topic/232931-tfs-11-classic-pvp-arena/#findComment-1650389 Compartilhar em outros sites More sharing options...
Posts Recomendados