Postado Janeiro 26, 2015 10 anos Mato e nao aparece a outra WAVE do Distro: Creaturescripts: function onKill(cid, target) print("test6") if isPlayer(cid) and getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) > -1 then print("test3") local new_wave = getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) + 1 if newWave() then print("test4") local reward = ARENA.WAVES[getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto)].prize local str = "You won:" if reward.cash then doPlayerAddMoney(cid, reward.cash) str = str.."\n"..reward.cash.."$" end if reward.items then for i = 1, #reward.items do local item = reward.items[i][1] local count = reward.items[i][2] if not isItemStackable(item) and count > 1 then for i = 1, count do doPlayerAddItem(cid, item, 1) end else doPlayerAddItem(cid, item, count) end str = str.."\nItem - "..count.."x "..getItemNameById(item) end end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, str) 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 end return true end function onLogout(cid) if isPlayer(cid) then if getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) > -1 then doPlayerSendCancel(cid, "You can't logout now.") return false end end return true end function onPrepareDeath(cid) if getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) > -1 then setPlayerStorageValue(cid, ARENA.STORAGES.wave_sto, -1) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) setGlobalStorageValue(1000, -1) clearArena() end return true end e a LIB: ARENA = { WAVES = { [1] = { monsters = { {"Demon", {x = 617, y = 2086, z = 6}}, --{nome_do_monstro, {posição_que_vai_nascer}}, {"Demon", {x = 617, y = 2089, z = 6}}, {"Demon", {x = 627, y = 2086, z = 6}}, {"Demon", {x = 627, y = 2089, z = 6}}, }, prize = { cash = 500000, --Coloque false se não for receber cash nessa wave. items = false, --Coloque false se não for receber item(s) nessa wave. }, }, [2] = { monsters = { {"Hellfire Figher", {x = 617, y = 2086, z = 6}}, --{nome_do_monstro, {posição_que_vai_nascer}}, {"Hellfire Figher", {x = 617, y = 2089, z = 6}}, {"Hellfire Figher", {x = 627, y = 2086, z = 6}}, {"Hellfire Figher", {x = 627, y = 2089, z = 6}}, }, prize = { cash = 1000000, items = false, }, }, [3] = { monsters = { {"Orshabaal", {x = 617, y = 2086, z = 6}}, --{nome_do_monstro, {posição_que_vai_nascer}}, {"Orshabaal", {x = 617, y = 2089, z = 6}}, {"Orshabaal", {x = 627, y = 2086, z = 6}}, {"Orshabaal", {x = 627, y = 2089, z = 6}}, }, prize = { cash = 1000000, items = { {2160, 1}, --{ID do item, quantidade}, {2160, 1}, }, }, }, }, NPC = { price = 2000, --Preço para entrar na arena. position = {x = 622, y = 2088, z = 6}, --Para onde o jogador será teleportado ao falar com o NPC. }, TELEPORT = { tpId = 1387, --ID do teleporte. tpPos = {x = 622, y = 2084, z = 6}, --Onde o teleporte será criado, ao matar o último boss. tpToPos = {x = 622, y = 2081, z = 5}, --Para onde o teleporte levará. aid = 1307, }, STORAGES = { storage = 90190, wave_sto = 90191, }, toPos = {x = 630, y = 2092, z = 6}, --Coordenadas da posição superior esquerda da arena. fromPos = {x = 614, y = 2082, z = 6}, --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] local m = monster.monsters doPlayerSendTextMessage(cid, 27, "Em "..ARENA.delay.." segundos, começa seu desafio. [Wave: "..wave.."]") addEvent(function() for i = 1, #m do doCreateMonster(m[i][1], m[i][2]) end 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 function newWave() 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 print("test1") if not isPlayer(creature) and not isSummon(creature) then print("test5") return false end end end end end print("test2") return true end Editado Janeiro 26, 2015 10 anos por glacialot (veja o histórico de edições)
Postado Janeiro 26, 2015 10 anos OK. Refiz a parte que checa se a wave foi ou não completa. Tanto a maneira antiga quanto a nova funcionaram aqui. Espero que o mesmo aconteça no seu servidor. Troque sua lib por essa: ARENA = { WAVES = { [1] = { monsters = { {"Demon", {x = 617, y = 2086, z = 6}}, --{nome_do_monstro, {posição_que_vai_nascer}}, {"Demon", {x = 617, y = 2089, z = 6}}, {"Demon", {x = 627, y = 2086, z = 6}}, {"Demon", {x = 627, y = 2089, z = 6}}, }, prize = { cash = 500000, --Coloque false se não for receber cash nessa wave. items = false, --Coloque false se não for receber item(s) nessa wave. }, }, [2] = { monsters = { {"Hellfire Figher", {x = 617, y = 2086, z = 6}}, --{nome_do_monstro, {posição_que_vai_nascer}}, {"Hellfire Figher", {x = 617, y = 2089, z = 6}}, {"Hellfire Figher", {x = 627, y = 2086, z = 6}}, {"Hellfire Figher", {x = 627, y = 2089, z = 6}}, }, prize = { cash = 1000000, items = false, }, }, [3] = { monsters = { {"Orshabaal", {x = 617, y = 2086, z = 6}}, --{nome_do_monstro, {posição_que_vai_nascer}}, {"Orshabaal", {x = 617, y = 2089, z = 6}}, {"Orshabaal", {x = 627, y = 2086, z = 6}}, {"Orshabaal", {x = 627, y = 2089, z = 6}}, }, prize = { cash = 1000000, items = { {2160, 1}, --{ID do item, quantidade}, {2160, 1}, }, }, }, }, NPC = { price = 2000, --Preço para entrar na arena. position = {x = 622, y = 2088, z = 6}, --Para onde o jogador será teleportado ao falar com o NPC. }, TELEPORT = { tpId = 1387, --ID do teleporte. tpPos = {x = 622, y = 2084, z = 6}, --Onde o teleporte será criado, ao matar o último boss. tpToPos = {x = 622, y = 2081, z = 5}, --Para onde o teleporte levará. aid = 1307, }, STORAGES = { storage = 90190, wave_sto = 90191, kill = 90194, }, toPos = {x = 630, y = 2092, z = 6}, --Coordenadas da posição superior esquerda da arena. fromPos = {x = 614, y = 2082, z = 6}, --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] local m = monster.monsters doPlayerSendTextMessage(cid, 27, "Em "..ARENA.delay.." segundos, começa seu desafio. [Wave: "..wave.."]") addEvent(function() for i = 1, #m do doCreateMonster(m[i][1], m[i][2]) end 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 function getKilledMonsters(cid) return getPlayerStorageValue(cid, ARENA.STORAGES.kill) > 0 and getPlayerStorageValue(cid, ARENA.STORAGES.kill) or 0 end Troque seu creaturescript por esse: function onKill(cid, target) if isPlayer(cid) and getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) > -1 then setPlayerStorageValue(cid, ARENA.STORAGES.kill, getKilledMonsters(cid) + 1) local wave = getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) local new_wave = wave + 1 if getKilledMonsters(cid) >= #ARENA.WAVES[wave].monsters then local reward = ARENA.WAVES[getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto)].prize local str = "You won:" if reward.cash then doPlayerAddMoney(cid, reward.cash) str = str.."\n"..reward.cash.."$" end if reward.items then for i = 1, #reward.items do local item = reward.items[i][1] local count = reward.items[i][2] if not isItemStackable(item) and count > 1 then for i = 1, count do doPlayerAddItem(cid, item, 1) end else doPlayerAddItem(cid, item, count) end str = str.."\nItem - "..count.."x "..getItemNameById(item) end end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, str) setPlayerStorageValue(cid, ARENA.STORAGES.kill, 0) 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 end return true end function onLogout(cid) if isPlayer(cid) then if getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) > -1 then doPlayerSendCancel(cid, "You can't logout now.") return false end 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 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 27, 2015 10 anos Cara tu não vai acreditar mas agora ele da erro no script do NPC Script: 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) setPlayerStorageValue(cid, 90183, 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()) Editado Janeiro 27, 2015 10 anos por glacialot (veja o histórico de edições)
Postado Janeiro 27, 2015 10 anos Solucionado pelo Skype. O erro estava sendo causado porque o glacialot havia copiado o nome da tabela errado (RENA, e não ARENA). O sistema está funcionando perfeitamente. Editado Janeiro 27, 2015 10 anos por zipter98 (veja o histórico de edições) não respondo pms solicitando suporte em programação/scripting
Postado Janeiro 27, 2015 10 anos Show de bola, o problema estava quando substitui esse ultimo post dele copiei apenas RENA e nao ARENA como ele mesmo informou... Quero agradecer imensamente a ajuda do @ziper98 pelo esforço e dedicação aplicada nesse script, ficou 100% mesmo, tudo funcionando conforme o pedido, que você continue ajudando aqui no Forum, faz um ótimo trabalho amigo, precisamos de mais pessoas como você por aqui! Parabéns!
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.