Ir para conteúdo

Yan Oliveira

Moderador
  • Total de itens

    2221
  • Registro em

  • Última visita

  • Dias Ganhos

    60

Tudo que Yan Oliveira postou

  1. Eita, calma lá hahaha. Mas que bom que funcionou, fico feliz ?.
  2. Então são duas alavancas diferentes e dependendo a alavanca ela vai remover um item (taxa) do player, é isso? No caso uma das alavancas vai remover dois itens e a outra vai remover uma moeda rara?
  3. Como assim cobrar 2 itens antes de 1?
  4. Yan Oliveira

    Icone (Houses)

    Olá, a ball só fica com o ícone na bag porque o sistema de ícone trabalha quando pega Pokémon do slot (bag), ou seja, ele pega pokeball com Pokémon dentro da mochila e transforma em ícone ball. Essa maneira é trabalhada por questão de segurança in-game, pois se algum player dividir house, ou jogar a ball no chão (caso empreste para alguém ou queira mostrar) fica ocultado o pokémon que é, claro que se der look vai saber, mas é mais seguro do que a pessoa olhar e saber diretamente o pokémon que está no chão. Mas qual base você usa? Geralmente o arquivo de ícone fica em Data/Lib.
  5. Yan Oliveira

    Bug NPC Banker

    Estou dando uma estudada em Balance, Withdraw porque eu não mexo com Tibia, só Derivado, e nos Derivados não tem isso, no caso Poketibia. Mas vou refazer o script e deixar da forma mais simples possível e que funcione corretamente.
  6. Substitui todo seu código por esse: 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 -- VARIÁVEIS -- local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid msg = string.lower(msg) local id_coin = 2152 -- ID DO GOLD COIN local quantidade_coin = 40 -- QUANTIDADE COINS QUE PRECISA PARA VIAJAR local level = 30 --LEVEL MÍNIMO PARA VIAJAR local position = {x= 998, y= 992, z= 5} -- POSIÇÃO DE ONDE O PLAYER IRÁ AO SER TELEPORTADO ----------------------------------- [ DIALOGO COM NPC] --------------------------------- if msgcontains(msg, 'help') or msgcontains(msg, 'travel') or msgcontains(msg, 'viagem') then selfSay("I can take you to {Ice Island} for " ..quantidade_coin.. " gold coins. Do you want?", cid) talkState[talkUser] = 1 elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 1 then if isPremium(cid) then if getPlayerLevel(cid) >= level then if getPlayerItemCount(cid, id_coin) >= 40 then doPlayerRemoveItem(cid, id_coin, quantidade_coin) selfSay("See you!", cid) doTeleportThing(cid, position) talkState[talkUser] = 0 return true else selfSay("You don't have " ..quantidade_coin.. " gold coins.", cid) talkState[talkUser] = 0 return true end else selfSay("You need to be at least level" ..level.. " or more to travel.", cid) talkState[talkUser] = 0 return true end else selfSay("You need to be premium account to travel.", cid) talkState[talkUser] = 0 return true end elseif (msgcontains(msg, 'no') or msgcontains(msg, 'não')) and talkState[talkUser] == 1 then selfSay("Ok, goodbye.") talkState[talkUser] = 0 return true elseif (msgcontains(msg, "yes") ~= "yes" or msgcontains(msg, "sim") ~= "sim" or msgcontains(msg, "não") ~= "não" or msgcontains(msg, "no") ~= "no") and talkState[talkUser] == 1 then selfSay("I didn't understand your answer. Do you want to travel or not?", cid) return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Agora vai no arquivo xml desse npc e a partir da tag <parameters> <TAG /> </parameters> </npc> substitua tudo até o final por esse: <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|, say {help}, {viagem} or {travel} to more informations."/> </parameters> </npc> Fiz verificação se é premium, verificação por nível e se tem a quantidade de gold coins necessária para viajar. Lembre de trocar o id do gold coin na variável id_coin, pois eu não tenho base de Tibia, então testei com Poketibia, e não sei se o id do dinheiro é o mesmo. Eu testei e está funcionando. Mas testa e fale se der algum problema.
  7. Yan Oliveira

    Bug NPC Banker

    Quando você diz para de funcionar, se refere a distro crashar ou o script não funcionar?
  8. Yan Oliveira

    Bau de recompensa

    Opa o fórum não me notificou que respondeu, só vi agora. Tem sim, substitui o código por esse: local itens_grupo1 = { [1] = {id = 2152, chance = 5}, [2] = {id = 2160, chance = 10}, [3] = {id = 17214, quantidade = 1, chance = 15}, [4] = {id = 17215, quantidade = 1, chance = 70}, } local itens_grupo2 = { [1] = {id = 2152, chance = 5}, [2] = {id = 2466, quantidade = 1, chance = 10}, [3] = {id = 2497, quantidade = 1, chance = 15}, [4] = {id = 7730, quantidade = 1, chance = 70}, } local itens_grupo3 = { [1] = {id = 2152, chance = 5}, [2] = {id = 2195, quantidade = 1, chance = 10}, [3] = {id = 2492, quantidade = 1, chance = 15}, [4] = {id = 2498, quantidade = 1, chance = 70}, } local itens_grupo4 = { [1] = {id = 2392, quantidade = 1, chance = 25}, [2] = {id = 16116, quantidade = 1, chance = 50}, [3] = {id = 17214, quantidade = 1, chance = 70}, } local storage_time = 55000 ---------- CÓDIGO ---------- function onUse(cid, item, fromPosition, itemEx, toPosition) local chance_item = math.random(1, 100) local random_quantidade = math.random(1, 20) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, chance_item.. " " ..random_quantidade) if getPlayerStorageValue(cid, storage_time) <= os.time() then ------ SE FOR LEVEL MENOR QUE 25 NÃO PODERÁ RECEBER A RECOMPENSA ------ if getPlayerLevel(cid) < 25 then doPlayerSendTextMessage(cid, 27, "You need to be at least level 25 or more to open this chest.") return true ------------------------------ RECOMPENSA SE FOR LEVEL ENTRE 25 E 49 ------------------------------- elseif getPlayerLevel(cid) >= 25 and getPlayerLevel(cid) < 50 then doSendMagicEffect(getThingPos(cid), 27) -- CHANCE 5 -- if chance_item <= 5 then doPlayerAddItem(cid, itens_grupo1[1].id, random_quantidade) if random_quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..random_quantidade.. " " ..getItemNameById(itens_grupo1[1].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo1[1].id).. ".") end -- CHANCE 10 -- elseif chance_item > 5 and chance_item <= 10 then doPlayerAddItem(cid, itens_grupo1[2].id, random_quantidade) if random_quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..random_quantidade.. " " ..getItemNameById(itens_grupo1[2].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo1[2].id).. ".") end -- CHANCE 15 -- elseif chance_item > 10 and chance_item <= 15 then doPlayerAddItem(cid, itens_grupo1[3].id, itens_grupo1[3].quantidade) if itens_grupo1[3].quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..itens_grupo1[3].quantidade.. " " ..getItemNameById(itens_grupo1[3].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo1[3].id).. ".") end -- CHANCE MAIOR QUE 15 ATÉ 100 -- else doPlayerAddItem(cid, itens_grupo1[4].id, itens_grupo1[4].quantidade) if itens_grupo1[4].quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..itens_grupo1[4].quantidade.. " " ..getItemNameById(itens_grupo1[4].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo1[4].id).. ".") end end doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, storage_time, os.time() + 24 * 60 * 60) return true -------------------------------- RECOMPENSA SE FOR LEVEL ENTRE 50 E 99 ------------------------------- elseif getPlayerLevel(cid) >= 50 and getPlayerLevel(cid) < 100 then doSendMagicEffect(getThingPos(cid), 27) -- CHANCE 5 -- if chance_item <= 5 then doPlayerAddItem(cid, itens_grupo2[1].id, random_quantidade) if random_quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..random_quantidade.. " " ..getItemNameById(itens_grupo2[1].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo2[1].id).. ".") end -- CHANCE 10 -- elseif chance_item > 5 and chance_item <= 10 then doPlayerAddItem(cid, itens_grupo2[2].id, random_quantidade) if random_quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..random_quantidade.. " " ..getItemNameById(itens_grupo2[2].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo2[2].id).. ".") end -- CHANCE 15 -- elseif chance_item > 10 and chance_item <= 15 then doPlayerAddItem(cid, itens_grupo2[3].id, itens_grupo2[3].quantidade) if itens_grupo2[3].quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..itens_grupo2[3].quantidade.. " " ..getItemNameById(itens_grupo2[3].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo2[3].id).. ".") end -- CHANCE MAIOR QUE 15 ATÉ 100 -- else doPlayerAddItem(cid, itens_grupo2[4].id, itens_grupo2[4].quantidade) if itens_grupo2[4].quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..itens_grupo2[4].quantidade.. " " ..getItemNameById(itens_grupo2[4].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo2[4].id).. ".") end end doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, storage_time, os.time() + 24 * 60 * 60) return true -------------------- RECOMPENSA SE FOR LEVEL ENTRE 100 E 200 ---------------------- elseif getPlayerLevel(cid) >= 100 and getPlayerLevel(cid) < 200 then doSendMagicEffect(getThingPos(cid), 27) -- CHANCE 5 -- if chance_item <= 5 then doPlayerAddItem(cid, itens_grupo3[1].id, itens_grupo3[1].quantidade) if itens_grupo3[1].quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..itens_grupo3[3].quantidade.. " " ..getItemNameById(itens_grupo3[1].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo3[1].id).. ".") end -- CHANCE 10 -- elseif chance_item > 5 and chance_item <= 10 then doPlayerAddItem(cid, itens_grupo3[2].id, itens_grupo3[2].quantidade) if itens_grupo3[2].quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..itens_grupo3[2].quantidade.. " " ..getItemNameById(itens_grupo3[2].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo3[2].id).. ".") end -- CHANCE 15 -- elseif chance_item > 10 and chance_item <= 15 then doPlayerAddItem(cid, itens_grupo3[3].id, itens_grupo3[3].quantidade) if itens_grupo3[3].quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..itens_grupo3[3].quantidade.. " " ..getItemNameById(itens_grupo3[3].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo3[3].id).. ".") end -- CHANCE MAIOR QUE 15 ATÉ 100 -- else doPlayerAddItem(cid, itens_grupo3[4].id, itens_grupo3[4].quantidade) if itens_grupo3[4].quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..itens_grupo3[4].quantidade.. " " ..getItemNameById(itens_grupo3[4].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo3[4].id).. ".") end end doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, storage_time, os.time() + 24 * 60 * 60) return true ----------------------- RECOMPENSA SE FOR LEVEL ACIMA DE 200 ----------------------- else doSendMagicEffect(getThingPos(cid), 27) -- CHANCE ATÉ 25 -- if chance_item <= 25 then doPlayerAddItem(cid, itens_grupo4[1].id, itens_grupo4[1].quantidade) if itens_grupo4[1].quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..itens_grupo4[1].quantidade.. " " ..getItemNameById(itens_grupo4[1].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo4[1].id).. ".") end -- CHANCE ATÉ 50 -- elseif chance_item > 25 and chance_item <= 50 then doPlayerAddItem(cid, itens_grupo4[2].id, itens_grupo4[2].quantidade) if itens_grupo4[2].quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..itens_grupo4[2].quantidade.. " " ..getItemNameById(itens_grupo4[2].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo4[2].id).. ".") end -- CHANCE MAIOR QUE 50 ATÉ 100 -- else doPlayerAddItem(cid, itens_grupo4[3].id, itens_grupo4[3].quantidade) if itens_grupo4[3].quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..itens_grupo4[3].quantidade.. " " ..getItemNameById(itens_grupo4[3].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo4[3].id).. ".") end end doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, storage_time, os.time() + 24 * 60 * 60) return true end else doPlayerSendTextMessage(cid, 27, "You need to wait " ..getHorasRestante(getPlayerStorageValue(cid, storage_time) - os.time()).. " to get the reward again.") return true end end Testei aqui e funcionou. Só lembrando que a chance da última tabela tive que definir outros valores porque a do seu script estava meio confuso e a soma da chance dos itens estava dando mais de 100. Mas pode editar de acordo com sua preferência, lembrando que tem que estar de acordo com a verificação do script. Mas caso queira inserir um novo item, vai ter que editar o script, pois ele está pegando diretamente cada item da tabela de acordo com a chance, então como ele pega o índice direto, se inserir um novo item, e a chance for desse item, ele vai dar erro ou não vai adicionar nada.
  9. Por nada ?.
  10. Substitui o script.lua do npc por esse: 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 local choose = {} local cancel = {} local available = {} function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid local storage_reborn = 30023 -------- FUNÇÃO PARA VER SE PLAYER É REBORN OU NÃO E CONTINUAR CASO FOR AO ESCOLHER A VOCAÇÃO -------- function setRebornVocation(cid, storage, vocation) if (getPlayerStorageValue(cid, storage) > 0) and (getPlayerVocation(cid) == vocation) then setPlayerStorageValue(cid, storage, 1) doPlayerSetVocation(cid, vocation) return true elseif (getPlayerStorageValue(cid, storage) < 1) and (getPlayerVocation(cid) == vocation) then setPlayerStorageValue(cid, storage, -1) doPlayerSetVocation(cid, vocation) return true end end -------------------------------- CÓDIGO --------------------------------- if(msgcontains(msg, "vocacao")) then selfSay("Qual dessas vocacoes voce quer se tornar? Shenron(VIP), Vegetto(VIP), Tapion(FREE), Kame(VIP), King Vegeta(VIP), Kagome(VIP), Zaiko(VIP), Chilled(Free), C8(VIP), Bills(VIP), Whiss(VIP), Super Broly(VIP), Champa(VIP), Paikuhan(VIP), Botamo(Free), Jiren(VIP), Yamcha(Free), Zamasu(VIP), Goku Black(VIP).", cid) talkState[talkUser] = 1 elseif msgcontains(msg, "shenron") or msgcontains(msg, "SHENRON") and talk_state == 1 then doPlayerSetVocation(cid, 376) setRebornVocation(cid, storage_reborn, 376) selfSay("Parabens, voce virou um Shenron", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "vegetto") or msgcontains(msg, "VEGETTO") and talk_state == 1 then doPlayerSetVocation(cid, 388) setRebornVocation(cid, storage_reborn, 388) selfSay("Parabens, voce virou um Vegetto", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "tapion") or msgcontains(msg, "TAPION") and talk_state == 1 then doPlayerSetVocation(cid, 400) setRebornVocation(cid, storage_reborn, 400) selfSay("Parabens, voce virou um Tapion", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "kame") or msgcontains(msg, "KAME") and talk_state == 1 then doPlayerSetVocation(cid, 413) setRebornVocation(cid, storage_reborn, 413) selfSay("Parabens, voce virou um Kame", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "king vegeta") or msgcontains(msg, "KING VEGETA") and talk_state == 1 then doPlayerSetVocation(cid, 425) setRebornVocation(cid, storage_reborn, 425) selfSay("Parabens, voce virou um King Vegeta", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "kagome") or msgcontains(msg, "KAGOME") and talk_state == 1 then doPlayerSetVocation(cid, 437) setRebornVocation(cid, storage_reborn, 437) selfSay("Parabens, voce virou um Kagome", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "zaiko") or msgcontains(msg, "ZAIKO") and talk_state == 1 then doPlayerSetVocation(cid, 449) setRebornVocation(cid, storage_reborn, 449) selfSay("Parabens, voce virou um Zaiko", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "chilled") or msgcontains(msg, "CHILLED") and talk_state == 1 then doPlayerSetVocation(cid, 461) setRebornVocation(cid, storage_reborn, 461) selfSay("Parabens, voce virou um Chilled", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "c8") or msgcontains(msg, "C8") and talk_state == 1 then doPlayerSetVocation(cid, 478) setRebornVocation(cid, storage_reborn, 478) selfSay("Parabens, voce virou um C8", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "bills") or msgcontains(msg, "BILLS") and talk_state == 1 then doPlayerSetVocation(cid, 552) setRebornVocation(cid, storage_reborn, 552) selfSay("Parabens, voce virou um Bills", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "whiss") or msgcontains(msg, "WHISS") and talk_state == 1 then doPlayerSetVocation(cid, 572) setRebornVocation(cid, storage_reborn, 572) selfSay("Parabens, voce virou um Whiss", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "super broly") or msgcontains(msg, "SUPER BROLY") and talk_state == 1 then doPlayerSetVocation(cid, 587) setRebornVocation(cid, storage_reborn, 587) selfSay("Parabens, voce virou um Super Broly", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "champa") or msgcontains(msg, "CHAMPA") and talk_state == 1 then doPlayerSetVocation(cid, 602) setRebornVocation(cid, storage_reborn, 602) selfSay("Parabens, voce virou um Champa", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "paikuhan") or msgcontains(msg, "PAIKUHAN") and talk_state == 1 then doPlayerSetVocation(cid, 615) setRebornVocation(cid, storage_reborn, 615) selfSay("Parabens, voce virou um Paikuhan", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "botamo") or msgcontains(msg, "BOTAMO") and talk_state == 1 then doPlayerSetVocation(cid, 627) setRebornVocation(cid, storage_reborn, 627) selfSay("Parabens, voce virou um Botamo", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "jiren") or msgcontains(msg, "JIREN") and talk_state == 1 then doPlayerSetVocation(cid, 640) setRebornVocation(cid, storage_reborn, 640) selfSay("Parabens, voce virou um Jiren", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "yamcha") or msgcontains(msg, "YAMCHA") and talk_state == 1 then doPlayerSetVocation(cid, 653) setRebornVocation(cid, storage_reborn, 653) selfSay("Parabens, voce virou um Yamcha", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "zamasu") or msgcontains(msg, "ZAMASU") and talk_state == 1 then doPlayerSetVocation(cid, 667) setRebornVocation(cid, storage_reborn, 667) selfSay("Parabens, voce virou um Zamasu", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, "goku black") or msgcontains(msg, "GOKU BLACK") and talk_state == 1 then doPlayerSetVocation(cid, 681) setRebornVocation(cid, storage_reborn, 681) selfSay("Parabens, voce virou um Goku Black", cid) talkState[talkUser] = 0 return true elseif(msgcontains(msg, "bye") or msgcontains(msg, "goodbye") or msgcontains(msg, "cya")) then selfSay("cya!", cid, TRUE) closeShopWindow(cid) removeFocus(cid) talkState[talkUser] = 0 return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Testa e me fala, não tenho base de Dragon Ball, então não consigo testar.
  11. Você quer que quando tiver lote de 100 gold coins e clicar com direito vire platinum e assim com o crystal? Sobre o item do TC, você precisa falar qual é ou mostrar foto. E ir para store você fala ir para bag?
  12. Yan Oliveira

    Bug NPC Banker

    Quais são as ocasiões que ele funciona e não funciona? Que tipo de ação?
  13. Yan Oliveira

    Erro creaturescript.

    Esse erro acontece quando você executa alguma ação específica?
  14. Yan Oliveira

    NPC de TASK

    Eu criei um NPC de Task aqui, porém eu fiz em uma base Poketibia TFS 0.3.6, pois não tenho outra base com versão de TFS diferente. Porém olhei as funções do TFS 1.0 (que é a que você descreveu) e as funções que utilizei nos scripts tem no TFS 1.0. Vai em Data/NPC e cria um arquivo xml chamado Billie.xml e adicione o código dentro: <?xml version="1.0" encoding="UTF-8"?> <npc name="Billie" script="Billie.lua" walkinterval="10000" floorchange="0" speed="100"> <health now="150" max="150"/> <look type="1421" head="114" body="119" legs="114" feet="114" corpse="2212"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|, I need a service... Say {help} or {task} to more informations."/> </parameters> </npc> Agora em Data/NPC/Scripts crie um arquivo chamado Billie.lua e insira o código dentro: 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 -- VARIÁVEIS -- local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid msg = string.lower(msg) local id_item = 2160 -- ITEM QUE VAI GANHAR AO CONCLUIR A TASK local quantidade_item = 1 -- QUANTIDADE DE ITENS QUE VAI GANHAR local exp = 500000 -- EXPERIÊNCIA QUE VAI GANHAR local monstro = "Magmar" -- NOME DO MONSTRO local quantidade_monstro = 50 -- QUANTIDADE DE MONSTROS local storage = 32500 -- STORAGE DO NPC local storage_npc = 34900 -- STORAGE QUE O NPC DA PARA O PLAYER PARA COMEÇAR A TASK local storage_quantidade = 32510 -- STORAGE QUE CONTÉM A QUANTIDADE DE MONSTROS DERROTADOS PELO PLAYER local storage_task = 32600 -- STORAGE DE CONCLUSÃO DA TASK local storage_mensagem = 32505 -- STORAGE PARA DEIXAR O DIALOGO MAIS BONITO local restante = (quantidade_monstro - getPlayerStorageValue(cid, storage_quantidade)) + 1 ----------------------------------- [ DIALOGO COM NPC] ----------------------------------- if msgcontains(msg, 'task') then if getPlayerStorageValue(cid, storage) == 1 then selfSay("You have already done my task.", cid) talkState[talkUser] = 0 return true else if getPlayerStorageValue(cid, storage_npc) < 1 then selfSay("I need you kill " ..quantidade_monstro.. " " ..monstro.. ". Do you accept my task?", cid) else selfSay("Have you already finished my task?", cid) end talkState[talkUser] = 1 return true end elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, storage_mensagem) < 1 and getPlayerStorageValue(cid, storage_npc) < 1 then selfSay("Ok, go to complete my task.", cid) talkState[talkUser] = 0 setPlayerStorageValue(cid, storage_mensagem, 1) setPlayerStorageValue(cid, storage_npc, 1) setPlayerStorageValue(cid, storage_quantidade, 1) return true end if getPlayerStorageValue(cid, storage_task) < 1 then selfSay("You don't finish my task yet. You need to kill " ..restante.. " " ..monstro.. " yet." , cid) talkState[talkUser] = 0 return true else selfSay("Congratulations! You finished my task! Receive your reward.", cid) doSendMagicEffect(getThingPos(cid), 27) doPlayerAddExp(cid, exp) doPlayerAddItem(cid, id_item, quantidade_item) setPlayerStorageValue(cid, storage, 1) talkState[talkUser] = 0 return true end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Agora vai em Data/Creaturescripts/Scripts e crie um arquivo chamado task_billie e adicione o código dentro: local monstro = "Magmar" -- NOME DO MONSTRO local quantidade = 50 -- QUANTIDADE DO MONSTRO local storage_npc = 34900 -- NÃO MEXE local storage_quantidade = 32510 -- NÃO MEXE local storage_task = 32600 -- NÃO MEXE function onKill(cid, target, lasthit) if getPlayerStorageValue(cid, storage_npc) > 0 then if getPlayerStorageValue(cid, storage_task) < 1 then if getPlayerStorageValue(cid, storage_quantidade) < quantidade then if isPlayer(cid) and getCreatureName(target) == monstro then local restantes = quantidade - getPlayerStorageValue(cid, storage_quantidade) doPlayerSendTextMessage(cid, 27, "Billie: " ..restantes.. " " ..monstro.. " restantes para derrotar." ) setPlayerStorageValue(cid, storage_quantidade, getPlayerStorageValue(cid, storage_quantidade) + 1) return true end elseif getPlayerStorageValue(cid, storage_quantidade) == quantidade then doPlayerSendTextMessage(cid, 27, "Billie: You don't have more " ..monstro.. " to defeat. Come back to get your reward.") setPlayerStorageValue(cid, storage_quantidade, -1) setPlayerStorageValue(cid, storage_task, 1) return true end else return true end else return true end end Ainda em Data/Creaturescripts/Scripts abra o arquivo login.lua e vá procure pela parte onde fica os registros de eventos no código, e adicione a seguinte linha embaixo do último evento: registerCreatureEvent(cid, "task_billie") E por último, em Data/Creaturescripts abra o creaturescripts.xml e adicione a tag: <event type="kill" name="task_billie" script="task_billie.lua"/> Explicação: Deixei comentado as variáveis e cada parte, no arquivo Billie.lua coloque o nome do monstro na variável monstro e a quantidade na variável quantidade_monstro, e o coloque o id e quantidade do item que o player vai ganhar nas variáveis conforme deixei comentado, está bem simples de ver. No arquivo task_billie a mesma coisa, só que lá só vai precisar colocar nome do monstro e quantidade. O player irá ganhar o item conforme o id que está na variável, a quantidade e experiência definida no Billie.lua, só alterar lá as recompensas. O resto não precisa mexer. Eu testei aqui e funcionou normal, mas teste e me fale se der algum problema.
  15. Yan Oliveira

    Bau de recompensa

    Sim entendi. Bom, eu fiz outro script: local itens_grupo1 = { [1] = {id = 2152}, [2] = {id = 2160}, [3] = {id = 17214, quantidade = 1}, [4] = {id = 17215, quantidade = 1}, } local itens_grupo2 = { [1] = {id = 2152}, [2] = {id = 2466, quantidade = 1}, [3] = {id = 2497, quantidade = 1}, [4] = {id = 7730, quantidade = 1}, } local itens_grupo3 = { [1] = {id = 2152}, [2] = {id = 2195, quantidade = 1}, [3] = {id = 2492, quantidade = 1}, [4] = {id = 2498, quantidade = 1}, } local itens_grupo4 = { [1] = {id = 2392, quantidade = 1}, [2] = {id = 16116, quantidade = 1}, [3] = {id = 17214, quantidade = 1}, } local storage_time = 55000 ---------- CÓDIGO ---------- function onUse(cid, item, fromPosition, itemEx, toPosition) local index_item = 0 -- VARIÁVEL PARA PEGAR UM INDICE ALEATÓRIO DA TABELA NA VERIFICAÇÃO local random = 1 -- VARIÁVEL PARA GERAR O RANDOM DOS ITEMS QUE A QUANTIDADE É RANDOM if getPlayerStorageValue(cid, storage_time) <= os.time() then ------ SE FOR LEVEL MENOR QUE 25 NÃO PODERÁ RECEBER A RECOMPENSA ------ if getPlayerLevel(cid) < 25 then doPlayerSendTextMessage(cid, 27, "You need to be at least level 25 or more to open this chest.") return true ------ RECOMPENSA SE FOR LEVEL ENTRE 25 E 49 ------ elseif getPlayerLevel(cid) >= 25 and getPlayerLevel(cid) < 50 then index_item = math.random(1, #itens_grupo1) random = math.random(1, 20) if itens_grupo1[index_item].id == 2152 or itens_grupo1[index_item].id == 2160 then doPlayerAddItem(cid, itens_grupo1[index_item].id, random) doSendMagicEffect(getThingPos(cid), 27) if random > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..random.. " " ..getItemNameById(itens_grupo1[index_item].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo1[index_item].id).. ".") end doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, storage_time, os.time() + 24 * 60 * 60) return true else doPlayerAddItem(cid, itens_grupo1[index_item].id, itens_grupo1[index_item].quantidade) doSendMagicEffect(getThingPos(cid), 27) if itens_grupo1[index_item].quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..itens_grupo1[index_item].quantidade.. " " ..getItemNameById(itens_grupo1[index_item].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo1[index_item].id).. ".") end doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, storage_time, os.time() + 24 * 60 * 60) return true end ----- RECOMPENSA SE FOR LEVEL ENTRE 50 E 99 ----- elseif getPlayerLevel(cid) >= 50 and getPlayerLevel(cid) < 100 then index_item = math.random(1, #itens_grupo2) random = math.random(1, 50) if itens_grupo2[index_item].id == 2152 then doPlayerAddItem(cid, itens_grupo2[index_item].id, random) doSendMagicEffect(getThingPos(cid), 27) if random > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..random.. " " ..getItemNameById(itens_grupo2[index_item].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo2[index_item].id).. ".") end doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, storage_time, os.time() + 24 * 60 * 60) return true else doPlayerAddItem(cid, itens_grupo2[index_item].id, itens_grupo2[index_item].quantidade) doSendMagicEffect(getThingPos(cid), 27) if itens_grupo2[index_item].quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..itens_grupo2[index_item].quantidade.. " " ..getItemNameById(itens_grupo2[index_item].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo2[index_item].id).. ".") end doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, storage_time, os.time() + 24 * 60 * 60) return true end ----- RECOMPENSA SE FOR LEVEL ENTRE 100 E 200 ----- elseif getPlayerLevel(cid) >= 100 and getPlayerLevel(cid) < 200 then index_item = math.random(1, #itens_grupo3) random = math.random(20, 50) if itens_grupo3[index_item].id == 2152 then doPlayerAddItem(cid, itens_grupo3[index_item].id, random) doSendMagicEffect(getThingPos(cid), 27) if random > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..random.. " " ..getItemNameById(itens_grupo3[index_item].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo3[index_item].id).. ".") end doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, storage_time, os.time() + 24 * 60 * 60) return true else doPlayerAddItem(cid, itens_grupo3[index_item].id, itens_grupo3[index_item].quantidade) doSendMagicEffect(getThingPos(cid), 27) if itens_grupo3[index_item].quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..itens_grupo3[index_item].quantidade.. " " ..getItemNameById(itens_grupo3[index_item].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo3[index_item].id).. ".") end doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, storage_time, os.time() + 24 * 60 * 60) return true end ----- RECOMPENSA SE FOR LEVEL ACIMA DE 200 ----- else index_item = math.random(1, #itens_grupo4) doPlayerAddItem(cid, itens_grupo4[index_item].id, itens_grupo4[index_item].quantidade) doSendMagicEffect(getThingPos(cid), 27) if itens_grupo4[index_item].quantidade > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..itens_grupo4[index_item].quantidade.. " " ..getItemNameById(itens_grupo4[index_item].id).. ".") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(itens_grupo4[index_item].id).. ".") end doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, storage_time, os.time() + 24 * 60 * 60) return true end else doPlayerSendTextMessage(cid, 27, "You need to wait " ..getTime(getPlayerStorageValue(cid, storage_time) - os.time()).. " to get the reward again.") return true end end No PDA 1.9, na em Data/Lib nos arquivos de funções tem uma função chamada getTimeDiff que retorna o tempo restante (horas, minutos e segundos). Porém na concatenação a palavra horas, segundos e minutos estão grudados com os valores, então eu separei criando outra função para que fique mais fácil para você, então vá em Data/Lib/SomeFunctions ou outro arquivo contendo as funções e adicione essa função: function getTime(diff) local dateFormat = { {' hour', diff / 60 / 60}, {' minute', diff / 60 % 60}, {' second', diff % 60}, } local out = {} local prefix = '' for k, t in ipairs(dateFormat) do local v = math.floor(t[2]) if v > 0 then prefix = #out == 0 and '' or k < #dateFormat and ' ' or ' and ' table.insert(out, prefix .. v .. '' .. (v <= 1 and t[1] or t[1].."s")) end end return table.concat(out) end Ou se preferir, procure a getTimeDiff e dê um espaço nas strings: "hour, minute e second" que irá funcionar. Mas lembrando que se alterar na função getTimeDiff tem que ir nesta linha do script: doPlayerSendTextMessage(cid, 27, "You need to wait " ..getTime(getPlayerStorageValue(cid, storage_time) - os.time()).. " to get the reward again.") E trocar por: doPlayerSendTextMessage(cid, 27, "You need to wait " ..getTimeDiff(getPlayerStorageValue(cid, storage_time) - os.time()).. " to get the reward again.") Também reparei que na tabela do script que postou aqui, a última tabela estava com level mínimo 80, mas na tabela anterior o level mínimo era 100 e máximo 200, talvez poderia ser isso que estava bugando, já que provavelmente o char que estava testando devia ser level maior que 100. Mas eu testei aqui e está funcionando normalmente, já deixei também para o jogador poder pegar novamente a recompensa a cada 24 horas. Testa e se der alguma problema me fale.
  16. Yan Oliveira

    Bau de recompensa

    Entendi, você quer que a recompensa também seja um item aleatório de acordo com a tabela, igual no outro script que fiz para você?
  17. Yan Oliveira

    Bau de recompensa

    Só para entender, você quer um baú que dê recompensa uma vez por dia e a recompensa varia de acordo com o level do jogador? A quantidade também deve variar ou é fixa?
  18. local id_box = 16900 -- ID DA BOX local level = 10 -- LEVEL MINIMO PARA ABRIR A BOX -- ITENS -- local normal = {16901, 16902, 16903} local raro = {111} local epico = {222} local lendario = {333} ------------------------- CÓDIGO ------------------------- function onUse(cid, item, frompos, item2, topos) local chance = math.random(1, 100) local item_box = 0 if item.itemid == id_box then if getPlayerLevel(cid) < level then doPlayerSendTextMessage(cid, 27, "You need to be at least level " ..level.. " to open the box.") doPlayerSendCancel(cid, "You need to be at least level " ..level.. " to open the box.") return true else if chance >= 60 then item_box = normal[math.random(1, #normal)] doPlayerAddItem(cid, item_box) doSendMagicEffect(getThingPos(cid), 27) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(item_box).. ".") doRemoveItem(item.uid, 1) return true elseif chance >= 40 and chance < 60 then item_box = raro[math.random(1, #raro)] doPlayerAddItem(cid, item_box) doSendMagicEffect(getThingPos(cid), 27) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(item_box).. ".") doRemoveItem(item.uid, 1) return true elseif chance >= 20 and chance < 40 then item_box = epico[math.random(1, #epico)] doPlayerAddItem(cid, item_box) doSendMagicEffect(getThingPos(cid), 27) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(item_box).. ".") doRemoveItem(item.uid, 1) return true else item_box = lendario[math.random(1, #lendario)] doPlayerAddItem(cid, item_box) doSendMagicEffect(getThingPos(cid), 27) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You received " ..getItemNameById(item_box).. ".") doRemoveItem(item.uid, 1) return true end return true end end end Pelo que entendi você quer que tenha uma chance para que o item ganhado seja entre uma dessas tabelas, e dentro de cada tabela tenha outra chance para ganhar tal item. Está correto? Pois o script que fiz é baseado nesse entendimento, então se não for isso avise para eu refazer. Explicação: Pensei em trabalhar com random com chance pré-definida para que dentre uma as tabelas uma seja escolhida, e ao ser escolhida uma tabela, tenha uma outra chance para escolher o item de acordo com a tabela, porém essa chance é totalmente aleatória, não é pré-definida como as das tabelas. Caso queira chance do item pré-definida igual das tabelas, me avisa que faço. E você também pode alterar a chance das tabelas caso queira, está bem simples. Deixei 40% de chance para os itens normais e 20% para os três restante (raro, épico e lendário). Testei aqui e funcionou, mas qualquer problema só falar.
  19. Sei que está trabalhando com Digimon, mas por que no evolution.lua você colocou "[5/5]" na evolução do Digimon? Eu não entendo de Digimon, mas pode ser que isso esteja bugando, o que faz esse valor junto com o nome do monstro? [digiev] = {"Agumon[5/5]", "Greymon[5/5]", "Metal Greymon[5/5]"},
  20. Qual é o nome do pokémon que está tentando evoluir?
  21. Você criou a stone no ItemEditor (colocou como usável) e adicionou a Sprite dela no Object Builder? E qual ID dessa stone e quais pokémons não está conseguindo evoluir?
  22. Está abrindo as sprites no ObjectBuilder e ItemEditor com as opções Extend e Transparência? Se não tiver, pode ser esse o problema.
  23. Yan Oliveira

    Erro creaturescript.

    Poste o arquivo moveItem.lua em Data/Creaturescripts/Player.
  24. Haha que longe em, mas que bom que deu certo ?.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...