Postado Janeiro 22, 2015 10 anos Solução OK. Eu fiz bem rapidamente o sistema aqui, talvez haja algum(s) erro(s). data/lib, crie um arquivo com extensão .lua e coloque o seguinte conteúdo: ARENA = { WAVES = { [1] = {"monster_name", {x = x, y = y, z = z}}, --{nome_do_monstro, {posição_que_vai_nascer}}, [2] = {"monster_name", {x = x, y = y, z = z}}, [3] = {"monster_name", {x = x, y = y, z = z}}, [4] = {"monster_name", {x = x, y = y, z = z}}, [5] = {"monster_name", {x = x, y = y, z = z}}, [6] = {"monster_name", {x = x, y = y, z = z}}, [7] = {"monster_name", {x = x, y = y, z = z}}, [8] = {"monster_name", {x = x, y = y, z = z}}, }, NPC = { price = 2000, --Preço para entrar na arena. position = {x = x, y = y, z = z}, --Para onde o jogador será teleportado ao falar com o NPC. }, TELEPORT = { tpId = 1387, --ID do teleporte. tpPos = {x = x, y = y, z = z}, --Onde o teleporte será criado, ao matar o último boss. tpToPos = {x = x, y = y, z = z}, --Para onde o teleporte levará. aid = 1307, }, STORAGES = { storage = 90181, wave_sto = 90182, }, fromPos = {x = x, y = y, z = z}, --Coordenadas da posição superior esquerda da arena. toPos = {x = x, y = y, z = z}, --Coordenadas da posição inferior direita da arena. delay = 15, --Segundos para o boss aparecer. level = 100, --Level mínimo. } function doWave(cid, wave) if not isPlayer(cid) then return true elseif not ARENA.WAVES[wave] then return true elseif getPlayerStorageValue(cid, ARENA.STORAGES.storage) > -1 then return true end local monster = ARENA.WAVES[wave][1] local pos = ARENA.WAVES[wave][2] doPlayerSendTextMessage(cid, 27, "In "..ARENA.delay.." seconds, a boss will spawn. [Wave: "..wave.."]") addEvent(function() doCreateMonster(monster, pos) end, ARENA.delay * 1000) end function clearArena() for x = ARENA.fromPos.x, ARENA.toPos.x do for y = ARENA.fromPos.y, ARENA.toPos.y do for z = ARENA.fromPos.z, ARENA.toPos.z do local area = {x = x, y = y, z = z} local creature = getTopCreature(area).uid if isCreature(creature) then doRemoveCreature(creature) end end end end end Código do NPC: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg:lower(), "arena") or msgcontains(msg:lower(), "enter") then if getPlayerLevel(cid) < ARENA.level then selfSay("You do not have enough level ["..ARENA.level.."].", cid) talkState[talkUser] = 0 return true elseif getGlobalStorageValue(1000) > -1 then selfSay("Someone is at the arena right now, please wait.", cid) talkState[talkUser] = 0 return true elseif getPlayerStorageValue(cid, ARENA.STORAGES.storage) > -1 then selfSay("You already completed the arena.", cid) talkState[talkUser] = 0 return true else selfSay("You really want enter in the arena? It will cost you {"..ARENA.NPC.price.."}.", cid) talkState[talkUser] = 1 return true end elseif msgcontains(msg:lower(), "yes") and talkState[talkUser] == 1 then if doPlayerRemoveMoney(cid, ARENA.NPC.price) then selfSay("Good luck! ^.^", cid) doTeleportThing(cid, ARENA.NPC.position) setPlayerStorageValue(cid, ARENA.STORAGES.wave_sto, 1) setGlobalStorageValue(1000, 1) doWave(cid, 1) talkState[talkUser] = 0 return true else selfSay("You do not have enough money.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg:lower(), "no") and talkState[talkUser] == 1 then selfSay("Ok, then...", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) data/creaturescripts/scripts, crie um arquivo com extensão .lua, nomeie-o killboss.lua, e coloque o seguinte conteúdo: function onKill(cid, target) if isPlayer(cid) and getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) > -1 then local new_wave = getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) + 1 if ARENA.WAVES[new_wave] then setPlayerStorageValue(cid, ARENA.STORAGES.wave_sto, new_wave) doWave(cid, new_wave) else local tp = doCreateTeleport(ARENA.TELEPORT.tpId, ARENA.TELEPORT.tpToPos, ARENA.TELEPORT.tpPos) doItemSetAttribute(tp, "aid", ARENA.TELEPORT.aid) end end return true end function onLogout(cid) if getTileInfo(getThingPos(cid)).protection and getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) > -1 then return setPlayerStorageValue(cid, ARENA.STORAGES.wave_sto, -1) end if getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) > -1 then doPlayerSendCancel(cid, "You can't logout now.") return false end return true end function onPrepareDeath(cid) if getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) > -1 then setPlayerStorageValue(cid, ARENA.STORAGES.wave_sto, -1) setGlobalStorageValue(1000, -1) clearArena() end return true end Tags: <event type="kill" name="killBoss" script="killboss.lua"/> <event type="logout" name="arenaLogout" event="script" value="killboss.lua"/> <event type="preparedeath" name="deathBoss" event="script" value="killboss.lua"/> Não se esqueça de registrar o evento em login.lua: registerCreatureEvent(cid, "killBoss") registerCreatureEvent(cid, "deathBoss") Já em data/movements/scripts, você novamente cria um arquivo com extensão .lua (nome do arquivo: tpremove.lua) e coloca o seguinte código: function onStepIn(cid, item, position, fromPosition) if not isPlayer(cid) then return true end setPlayerStorageValue(cid, ARENA.STORAGES.storage, 1) setPlayerStorageValue(cid, ARENA.STORAGES.wave_sto, -1) setGlobalStorageValue(1000, -1) addEvent(function() if getTileItemById(position, ARENA.TELEPORT.tpId).uid > 0 then doRemoveItem(getTileItemById(position, ARENA.TELEPORT.tpId).uid, 1) end end, 50) return true end Tag: <movevent type="StepIn" actionid="1307" event="script" value="tpremove.lua"/> Editado Janeiro 26, 2015 10 anos por zipter98 (veja o histórico de edições) não respondo pms solicitando suporte em programação/scripting
Postado Janeiro 22, 2015 10 anos Autor Cara independentemente , deixou meu Rep+ , seu esforço já é de grande importância. Irei testar e qualquer bronca te aviso. Vlw Brother. Só uma duvida quando estava lendo seu script. Nessa parte: toPos = {x = x, y = y, z = z}, --Coordenadas da posição superior esquerda da arena. fromPos = {x = x, y = y, z = z}, --Coordenadas da posição inferior direita da arena. Não entendi bem, essa superior esquerda e direita :| Eu te Ajudei? Então solta aquele REP+ !! Meus Tutoriais: [Tutorial] Bug "Temple position is wrong" (MySql) Outros: [Meu Show OFF | Mapa próprio 8.6]
Postado Janeiro 22, 2015 10 anos Antes de tudo, sua arena deve ser quadrada/retangular. As posições que devem ser configuradas, são, respectivamente, os cantos superior (cima) esquerdo (<) e inferior (baixo) direito (>). Uma imagem demonstrativa: Os círculos vermelhos representam as posições que mencionei. Imagem retirada do tópico referente ao sistema Blood Castle. Editado Janeiro 22, 2015 10 anos por zipter98 (veja o histórico de edições) não respondo pms solicitando suporte em programação/scripting
Postado Janeiro 22, 2015 10 anos Autor Opa, brother!. Configurei conforme suas instruções. Porém deu esses Erros na Distro: Eu te Ajudei? Então solta aquele REP+ !! Meus Tutoriais: [Tutorial] Bug "Temple position is wrong" (MySql) Outros: [Meu Show OFF | Mapa próprio 8.6]
Postado Janeiro 22, 2015 10 anos Ops, falta de atenção minha hehe. Mude sua lib antiga para a nova corrigida. não respondo pms solicitando suporte em programação/scripting
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.