Ir para conteúdo

Yan Oliveira

Moderador
  • Total de itens

    2187
  • Registro em

  • Última visita

  • Dias Ganhos

    57

Histórico de Reputação

  1. Thanks
    Yan Oliveira recebeu reputação de KaboFlow em Revive Com Tempo   
    Entendi, troque o código por esse:
     
    local level = 200 -- LEVEL MÍNIMO PARA USAR O REVIVE local storage_time = 68789 -- STORAGE PARA VERIFICAR O TEMPO PARA USAR O REVIVE local minutes = 10 -- MINUTOS PARA USAR O REVIVE local message_color = MESSAGE_STATUS_CONSOLE_BLUE -- COR DO TEXTO --------------- CÓDIGO --------------- function onUse(cid, item, frompos, item2, topos) if getPlayerLevel(cid) < level then doPlayerSendCancel(cid, "You need to be at least level " .. level .. " to use this revive.") return doPlayerSendTextMessage(cid, message_color, "You need to be at least level " .. level .. " to use this revive.") else if getPlayerStorageValue(cid, storage_time) <= os.time() then if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendCancel(cid, "You can't use revive during gym battles.") return true end if getPlayerStorageValue(cid, 52481) >= 1 then return doPlayerSendCancel(cid, "You can't do that while a duel.") --alterado v1.6 end -- if item2.itemid <= 0 or not isPokeball(item2.itemid) then doPlayerSendCancel(cid, "Please, use revive only on pokeballs.") return true end for a, b in pairs (pokeballs) do if item2.itemid == b.on or item2.itemid == b.off then doTransformItem(item2.uid, b.on) doSetItemAttribute(item2.uid, "hp", 1) for c = 1, 15 do local str = "move"..c setCD(item2.uid, str, 0) end setCD(item2.uid, "control", 0) setCD(item2.uid, "blink", 0) --alterado v1.6 doSendMagicEffect(getThingPos(cid), 13) doRemoveItem(item.uid, 1) doCureBallStatus(item2.uid, "all") cleanBuffs2(item2.uid) setPlayerStorageValue(cid, storage_time, os.time() + (60 * minutes)) return true end end else doPlayerSendCancel(cid, "You need to wait " .. minutes .. " minutes to use this revive.") return doPlayerSendTextMessage(cid, message_color, "You need to wait " .. minutes .. " minutes to use this revive.") end end return true end  
  2. Amei
    Yan Oliveira recebeu reputação de KaboFlow em Potion de Pokemon Certa Porcentagem HP   
    Quando esse erro acontece? Ao puxar o pokémon quando está realizando a cura?
  3. Amei
    Yan Oliveira recebeu reputação de KaboFlow em (Pedido) Script de teletransporte em membros da party   
    Eu tinha pensado que o seu ot era um Tibia rs, mas como é Dragon Ball Tibia, faz sentido até. 
     
    Crie um arquivo na pasta Spells (se tiver uma subpasta de party adiciona dentro dela) chamado teleportation.lua e adiciona o código dentro:
     
    -- SCRIPT DE TELETRANSPORTE FEITO POR YAN18 -- local message_color = MESSAGE_STATUS_CONSOLE_BLUE -- COR DA MENSAGEM local effect = 36 -- EFEITO DO TELETRANSPORTE local mana = 150 -- TANTO DE MANA QUE VAI GASTAR PARA TELEPORTAR. SE QUISER SEM CUSTO, COLOQUE O VALOR 0 -- FUNÇÃO LOCAL PARA TELETRANSPORTAR -- local function Teleportation(cid, index) if not cid then return true end if not isInParty(cid) then return doPlayerSendTextMessage(cid, message_color, "You need to be in a party to teleport. But if you are in a party, please report this problem.") end if index < 1 then return doPlayerSendTextMessage(cid, message_color, "There are not players available in your party for you teleport to him.") else local player = getPartyMembers(cid)[index] if getCreatureName(cid) ~= getCreatureName(player) then if string.lower(getCreatureName(player)) == string.lower(getCreatureName(player)) then if not getTileInfo(getThingPos(player)).house then doSendMagicEffect(getThingPos(cid), effect) doTeleportThing(cid, getThingPos(player)) doSendMagicEffect(getThingPos(cid), effect) doCreatureSay(cid, "TELEPORTATION!") doPlayerSendTextMessage(cid, message_color, "You had been teleportation to " .. getCreatureName(player) .. ".") return true end end end addEvent(Teleportation, 10, cid, index - 1) end end --------------------- CÓDIGO --------------------- function onCastSpell(cid, var) if not cid then return true elseif not isInParty(cid) then return doPlayerSendTextMessage(cid, message_color, "You need to be in a party to teleport. But if you are in a party, please report this problem.") else if getCreatureMana(cid) >= mana then Teleportation(cid, #getPartyMembers(cid)) else return doPlayerSendTextMessage(cid, message_color, "You need to have " .. mana .. " mana to use this ability.") end end end  
    Agora abra o arquivo spells.xml e adicione a tag:
    <instant name="Teletransporte" words="teleportation" lvl="1" mana="1" prem="0" aggressive="0" selftarget="1" exhaustion="0" needlearn="0" event="script" value="party/teleportation.lua"> <vocation id="1"/> <vocation id="2"/> <vocation id="3"/> <vocation id="4"/> <vocation id="5"/> </instant>  
    Na tag xml da spell você configura certinho os atributos como custo de mana (eu deixei no próprio script um custo, se quiser deixar 0 no xml e configurar por lá, também dá!) se precisa de premium e as vocations que pode usar. E não esqueça de verificar o diretório.
     
    Eu testei aqui e funcionou! O teletransporte sempre vai para o último membro da lista de membros da party e se ele estiver dentro de uma house ele vai para o penúltimo e assim sucessivamente. O script vai fazer recursão até o primeiro membro da lista (tirando o próprio player que usa a spell) e se não encontrar nenhum disponível ele manda uma mensagem avisando.
     
    Não sei se tem a sprite do efeito de teletransporte no seu client, mas se não tiver, uma opção é nos poketibias, que tem uma sprite da passiva Evasion que tem um efeito similar ao teletransporte, é bem legal!
  4. Upvote
    Yan Oliveira recebeu reputação de KaboFlow em Potion de Pokemon que cura metade da vida do pokémon   
    Troque o código por esse:
     
    local function HealHealthPercent(cid, percent, effect) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end percent = percent / 100 doCreatureAddHealth(cid, percent > 0 and math.floor(percent * getCreatureHealth(cid)) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSay(cid, "Heal") end --- TABELA COM O ID DAS POTIONS, TANTO DE PORCENTAGEM QUE CURA BASEADO NA VIDA E EFEITO AO USAR A POÇÃO --- local potions = { [12347] = {percent = 25, effect = 13}, -- full restore [12348] = {percent = 50, effect = 13}, -- hyper potion [12346] = {percent = 75, effect = 13}, -- ultra potion [12345] = {percent = 100, effect = 13}, -- super potion } local storage = 47898 -- STORAGE PARA USAR NOVAMENTE A POTION APÓS O TEMPO DO VALOR DA VARIÁVEL MINUTOS local minutos = 3 -- MINUTOS PARA USAR A POTION NOVAMENTE ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) if getPlayerStorageValue(cid, storage) <= os.time() then local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getCreatureHealth(pokemon) == getCreatureMaxHealth(pokemon) then return doPlayerSendCancel(cid, "The health of your pokémon already is full.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealHealthPercent(pokemon, potions[item.itemid].percent, potions[item.itemid].effect) doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, storage, os.time() + (60 * minutos)) return true else return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to wait " .. minutos .. " minutes to use the potion again.") end end  
    Criei uma variável minutos para poder definir outro valor caso queira mudar futuramente, mas deixei 3 por padrão.
  5. Upvote
    Yan Oliveira recebeu reputação de KaboFlow em Potion de Pokemon Certa Porcentagem HP   
    Sobre erro, é porque eu escrevi errado o nome da função, digitei uma letra errada, troque o código por esse:
     
    local function HealPerTurn(cid, health, effect, seconds, time) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSay(cid, "Healing...") addEvent(HealPerTurn, duration, cid, health, effect, seconds, time - 1) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12343] = {health = 1000, effect = 14}, -- full restore [12345] = {health = 3500, effect = 14}, -- hyper potion [12346] = {health = 5000, effect = 12}, -- ultra potion [12347] = {health = 8000, effect = 13}, -- super potion [12348] = {health = 10000, effect = 13}, -- great potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid].health, potions[item.itemid].effect, vezes_repete, segundos) return true end  
    E sobre só curar uma vez, foi erro meu, eu havia esquecido de fazer recursão.
  6. Amei
    Yan Oliveira recebeu reputação de KaboFlow em Potion de Pokemon Certa Porcentagem HP   
    Sim, eu entendi o que você quer. É estranho, pois eu testei aqui e está funcionando normal. Troque o código por esse:
     
    local function HealPerTurn(cid, health, effect, time, seconds) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSay(cid, "Healing...") addEvent(HealPerTurn, duration, cid, health, effect, time - 1, seconds) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12347] = {health = 1000, effect = 13}, -- full restore [12348] = {health = 3500, effect = 13}, -- hyper potion [12346] = {health = 5000, effect = 13}, -- ultra potion [12345] = {health = 8000, effect = 13}, -- super potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid].health, potions[item.itemid].effect, vezes_repete, segundos) return true end Já está configurado para curar o tanto de health que tem em cada potion na tabela das potions por 10 segundos.
  7. Amei
    Yan Oliveira recebeu reputação de KaboFlow em Potion de Pokemon Certa Porcentagem HP   
    Você precisa explicar melhor, pois quando falou que está usando infinito, eu entendi que a cura estava sendo infinita, e não o uso. E sim, realmente esqueci de remover o item.
     
    Sobre esse erro, nos testes que fiz aqui não deu. Você está usando em summon ou player?
     
    Arrumei e agora está removendo o item:
     
    local function HealPerTurn(cid, health, effect, time, seconds) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSay(cid, "Healing...") addEvent(HealPerTurn, duration, cid, health, effect, time - 1, seconds) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12347] = {health = 1000, effect = 13}, -- full restore [12348] = {health = 3500, effect = 13}, -- hyper potion [12346] = {health = 5000, effect = 13}, -- ultra potion [12345] = {health = 8000, effect = 13}, -- super potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid].health, potions[item.itemid].effect, vezes_repete, segundos) doRemoveItem(item.uid, 1) return true end  
  8. Thanks
    Yan Oliveira recebeu reputação de Sugismundo em Como fazer um bau de donate?   
    Se tivesse explicado isso desde o começo, teria sido mais fácil rsrs. Pois, não precisaria de todos esses scripts. Do jeito que você quer é mais fácil do que eu pensei.
     
    Eu pensei em falar para você excluir os scripts que tinha feito, mas deixa caso queira usar em outra coisa, como loteria, quests ou recompensa por exemplo.
     
    Vá em Data/Talkactions/Scripts e crie o arquivo chamado add_points.lua e adicione o código:
     
    local item_id = 2160 -- ID DOS POINTS local effect = false -- SE QUISER COM EFEITO AO RECEBER O ITEM MUDE PARA TRUE local effect_id = 27 -- EFEITO DO ID AO RECEBER O ITEM local level_acess = 4 -- ACESSO DO PLAYER (PLAYER - TUTOR - GM - CM - ADM), DEIXE 4 OU MAIS PARA STAFF E 6 PARA ADM function onSay(cid, words, param) local command = string.explode(param, ",") local name = string.lower(command[1]) -- SCRIPT SOMENTE PARA STAFF -- if getPlayerAccess(cid) < level_acess then return true end if param == nil or param == "" then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa informar o nome do player para receber os pontos.") elseif string.len(param) < 3 then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa informar um nome válido do player para receber os pontos.") elseif tonumber(command[2]) == nil or tonumber(command[2]) <= 0 then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa informar uma quantia válida de pontos.") else if #getPlayersOnline() > 1 then for index, player in pairs(getPlayersOnline()) do local player_name = string.lower(getCreatureName(player)) if name == player_name then local points = tonumber(command[2]) local message = "" if points > 1 then message = "Obrigado por ter donatado! Como recompensa, você recebeu " .. points .. " points." -- MENSAGEM QUE O PLAYER VAI RECEBER NO CHAT elseif points == 1 then message = "Obrigado por ter donatado! Como recompensa, você recebeu " .. points .. " point." -- MENSAGEM QUE O PLAYER VAI RECEBER NO CHAT end doPlayerAddItem(player, item_id, points) doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_BLUE, message) -- VERIFICA SE VAI RECEBER EFEITO -- if effect then doSendMagicEffect(getThingPos(player), effect_id) end return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "O player " .. command[1] .. " recebeu a recompensa.") end if index == #getPlayersOnline() and name ~= player_name then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O player " .. command[1] .. " não está online.") end end else return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Não há jogadores online!") end end end  
    Agora abra o talkactions.xml e adicione a tag:
    <talkaction words="!addpoints" acess="6" event="script" value="add_points.lua"/>  
    Continua via comando (talkaction), e para utilizar, funciona assim, você precisa digitar o comando !addpoints nome do player, quantidade de points:
     
    !addpoints Administrador, 50  
    E todas as variáveis estão comentadas, e segue o mesmo padrão do script antigo, porém a mensagem do player está dentro do for, então se quiser mudar está lá. Só mudar o id do item na primeira variável e lembrando que coloquei restrição de acesso, ou seja, somente membros da staff pode usar, no caso deixei nível de acesso 4, então GM, CM e ADM conseguiram usar o comando, se quiser só ADM, mude para 6 a variável level_acess.
     
    Eu testei aqui e está funcionando certinho, só não esqueça de comentar a tag xml da talkaction antiga se não for usar, pois esqueci de fazer verificação de acesso nela e qualquer player consegue usar. E fica seu critério excluir o script da box na pasta Actions também.
  9. Upvote
    Yan Oliveira recebeu reputação de manojl em [Resolvido] Mudar Itens iniciais Base Psoul   
    Vai na pasta Data/Actions/Script e veja se tem o arquivo starter.lua ou inicias.lua e se tiver, posta ele. 
     
    Mas, basicamente, nesses arquivos tem a função:
     
    doPlayerAddItem(id, quantidade)  
    Nessa função você adiciona os itens, só mudar id e colocar quantidade. Mas, caso não consiga, poste o script. 
  10. Amei
    Yan Oliveira recebeu reputação de KaboFlow em Potion de Pokemon Certa quantidade de HP [Resolvido]   
    Opa, foi bobeira minha, mas eu refiz o código, testei e agora está funcionando:
    -- REFEITO POR YAN18 PARA RESTAURAR VIDA POR VALOR CONSTANTE -- function doHealOverTime(cid, hp, effect) if not isCreature(cid) then return true end doSendMagicEffect(getThingPos(cid), effect) doCreatureAddHealth(cid, math.floor(hp)) end local potions = { [1456] = {effect = 13, hp = 50000}, -- super potion [1451] = {effect = 13, hp = 50000}, -- great potion [384] = {effect = 12, hp = 50000}, -- ultra potion [385] = {effect = 14, hp = 50000}, -- hyper potion [392] = {effect = 14, hp = 50000}, -- full restore [667] = {effect = 14, hp = 50000}, -- full restore [668] = {effect = 14, hp = 50000}, -- full restore [669] = {effect = 14, hp = 50000}, -- full restore [670] = {effect = 14, hp = 50000}, -- full restore [671] = {effect = 14, hp = 50000}, -- full restore } function onUse(cid, item, frompos, item2, topos) local pid = getThingFromPosWithProtect(topos) if not isSummon(pid) or getCreatureMaster(pid) ~= cid then return doPlayerSendCancel(cid, "You can only use potions on your own Pokemons!") end if getCreatureHealth(pid) == getCreatureMaxHealth(pid) then return doPlayerSendCancel(cid, "This pokemon is already at full health.") end if getPlayerStorageValue(pid, 173) >= 1 then setPlayerStorageValue(pid, 173, -1) end if getPlayerStorageValue(cid, 52481) >= 1 then return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendCancel(cid, "You can't use potion during gym battles.") return true end doCreatureSay(cid, "".. getCreatureName(pid)..", take this potion!", TALKTYPE_MONSTER) doSendMagicEffect(getThingPos(pid), 0) setPlayerStorageValue(pid, 173, 1) doRemoveItem(item.uid, 1) local a = potions[item.itemid] doHealOverTime(pid, a.hp, a.effect) doPlayerSendCancel(cid, "Your monsters recovered " ..a.hp.. " of HP.") return true end Ai para configurar o HP, você precisa mudar os valores na variável hp de cada potion (item) na tabela potions onde está 50000 para todos.
  11. Amei
    Yan Oliveira recebeu reputação de KaboFlow em PokeMasterX Crear Map PXG Free   
    Eu acho legal a admiração que muitos tem pela PXG e pelo seu mapa (eu também tenho). Mas, acho que é um esforço grande para uma baixa recompensa, pois, você vai gastar muito tempo para copiar, sendo que seu server não vai conter os mesmos sistemas, balanceamento e funcionalidades que a PXG tem. O diferencial de um Open Tibia é os sistemas e o mapa, e se você fizer um mapa igual da PXG, sendo que já tem o da própria PXG, que tem o jogo à muitos anos, com muitos sistemas e um jogo estabilizado, por que alguém jogaria o seu com o mesmo mapa deles se tem o jogo deles? Talvez você possa me falar ou pensar que não vai colocar online, vai copiar por ser fã, ou querer brincar sozinho, mas o legal é a criatividade. Seja criativo, cria áreas, hunts e cidades diferente, pode até se basear ou usar os da PXG como inspiração, mas copiar o mundo todo de Kanto vai levar muito tempo, eu falo isso porque à anos atrás para brincar eu copiei Saffron e fiz o CP de Pewter, e eu gastei muito tempo. Fora que precisa das sprites deles.
  12. Thanks
    Yan Oliveira recebeu reputação de Inthebang em Script para aumentar em +30 de mana a cada vez que usar mana rune ou potion   
    Opa, é porque faltou verificar se existe item no slot. 
     
    Substitui o código por esse:
     
    local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_MANADRAIN) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, 250, 0, 320) local id_magic_plate_armor = 2472 -- ID DO MAGIC PLATE ARMOR local message = false -- SE QUISER QUE TENHA UMA MENSAGEM PARA O PLAYER SABER QUE FOI CURADO A MAIS POR ESTAR EQUIPADO COM MAGIC PLATE ARMOR, MUDE PARA true -------- CÓDIGO --------- function onCastSpell(cid, var) local item = getPlayerSlotItem(cid, CONST_SLOT_ARMOR) -- PEGA O ITEM DO SLOT (PARA VERIFICAR SE TEM ITEM) local mana_magic_plate_armor = math.random(20, 30) -- O TANTO DE MANA QUE VAI CURAR SE TIVER EQUIPADO COM MAGIC PLATE ARMOR. ESTÁ ENTRE 20-30 A MAIS DE CURA DA MANA local id_item_slot_armor = getItemIdByName(getItemName(getPlayerSlotItem(cid, CONST_SLOT_ARMOR).uid)) -- NÃO MEXER, ESSA VARIÁVEL PEGA O ID DO ITEM EQUIPADO NO SLOT DE ARMOR local text = "Você teve +" .. mana_magic_plate_armor .. " de cura por estar equipado com " .. getItemName(getPlayerSlotItem(cid, CONST_SLOT_ARMOR).uid) .. "." -- TEXTO CASO TENHA MENSAGEM if getPlayerLevel(cid) > 200 then doSendAnimatedText(getPlayerPosition(cid), "Aaaaah...", TEXTCOLOR_BLUE) end if (((getPlayerLevel(cid))%10) == 0) then manaextra = (((getPlayerLevel(cid))/10)*3) else manaextra = ((((getPlayerLevel(cid))/10)+0.5)*3) end if item and id_magic_plate_armor == id_item_slot_armor then doCreatureAddMana(cid, math.floor(manaextra + mana_magic_plate_armor)) if message then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, text) end else doCreatureAddMana(cid, manaextra) end return doCombat(cid, combat, var) end  
    Testa e se der problema me avisa.
  13. Amei
    Yan Oliveira recebeu reputação de Inthebang em Script para aumentar em +30 de mana a cada vez que usar mana rune ou potion   
    Seu script parecia estar com erro, estava duplicado a função onCastSpel().
     
    Substitui o código por esse:
     
    local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_MANADRAIN) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, 250, 0, 320) local id_magic_plate_armor = 2472 -- ID DO MAGIC PLATE ARMOR local message = false -- SE QUISER QUE TENHA UMA MENSAGEM PARA O PLAYER SABER QUE FOI CURADO A MAIS POR ESTAR EQUIPADO COM MAGIC PLATE ARMOR, MUDE PARA true local text = "Você teve +" .. mana_magic_plate_armor .. " de cura por estar equipado com " .. getItemName(getPlayerSlotItem(cid, CONST_SLOT_ARMOR).uid) .. "." -- TEXTO CASO TENHA MENSAGEM -------- CÓDIGO --------- function onCastSpell(cid, var) local mana_magic_plate_armor = math.random(20, 30) -- O TANTO DE MANA QUE VAI CURAR SE TIVER EQUIPADO COM MAGIC PLATE ARMOR. ESTÁ ENTRE 20-30 A MAIS DE CURA DA MANA local id_item_slot_armor = getItemIdByName(getItemName(getPlayerSlotItem(cid, CONST_SLOT_ARMOR).uid)) -- NÃO MEXER, ESSA VARIÁVEL PEGA O ID DO ITEM EQUIPADO NO SLOT DE ARMOR if getPlayerLevel(cid) > 200 then doSendAnimatedText(getPlayerPosition(cid), "Aaaaah...", TEXTCOLOR_BLUE) end if (((getPlayerLevel(cid))%10) == 0) then manaextra = (((getPlayerLevel(cid))/10)*3) else manaextra = ((((getPlayerLevel(cid))/10)+0.5)*3) end if id_magic_plate_armor == id_item_slot_armor then doCreatureAddMana(cid, math.floor(manaextra + mana_magic_plate_armor)) if message then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, text) end else doCreatureAddMana(cid, manaextra) end return doCombat(cid, combat, var) end  
     
    Deixei tudo comentado, mas praticamente você vai precisar mexer no id do Magic Plate Armor, olhei aqui em uma base de Tibia e estava com esse ID 2472, precisa ver no itens.xml se é esse ID mesmo. Caso queira que tenha mensagem, só mudar a variável message de false para true e se quiser mudar o texto, só alterar na variável text, mas cuidado para não apagar os dois hífen (que é assim para se comentar em lua) que vai dar ruim kk. Você também pode alterar a quantidade mínima e máxima de cura extra alterando o valor entre parênteses da variável mana_magic_plate_armor mudando o valor dentro da função math.random. 
     
    Procurei deixar o mais intuitivo possível, eu testei e funcionou, mas, qualquer problema me avisa. 
  14. Upvote
    Yan Oliveira recebeu reputação de Yan Liima em [Resolvido] Ajuda com Mensagem   
    Substitui o código por esse e testa:
     
    Se der algum problema ou erro me avisa.
  15. Thanks
    Yan Oliveira recebeu reputação de jenison06 em [Resolvido] Ajuda com Mensagem   
    Substitui o código por esse e testa:
     
    Se der algum problema ou erro me avisa.
  16. Thanks
    Yan Oliveira recebeu reputação de vitorelias em Talkaction para verificar a quantidade de skills   
    Substitui o código por esse:
     
    function onSay(player, words, param) local total_players_online = #getOnlinePlayers() if total_players_online > 0 then if param == '' then return player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Seu Skill Club é " .. player:getSkillLevel(SKILL_CLUB) .. ".") else if player:isPremium() then if player:isInGhostMode() then return player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Não foi encontrado nenhum jogador online com esse nome.") else for index, name in pairs(getOnlinePlayers()) do if index <= total_players_online then if param == name then return player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Skill Club de [" .. name .. "] é " .. player:getSkillLevel(SKILL_CLUB) .. ".") else if index == total_players_online then return player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Não foi encontrado nenhum jogador online com esse nome.") end end end end end else return player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Somente jogadores VIP podem utilizar este comando para visualizar informações de outros jogadores.") end end else return true end end  
    Testa e veja se continua dando problema ao tentar pegar skill de outro player online. Lembrando que ele tem que estar online e não pode estar em modo ghost (invisível).
  17. Upvote
    Yan Oliveira recebeu reputação de 880123 em Event Boss   
    Olá, vá na pasta Data/Globalevents/Scripts e crie um arquivo lua chamado boss e adicione o código dentro:
    ----------------------------------- EVENTO SUMMON BOSS FEITO POR YAN18 ----------------------------------------- local minutos = 20 ---- COLOCA OS MINUTOS AQUI PARA OS BOSS SUMIREM CASO NINGUÉM OS MATE ---- NOME DOS MONTROS ---- local monsters = { [1] = "Magmar" , [2] = "Electabuzz", [3] = "Scizor", } ---- POSIÇÃO DA ARENA ONDE APARECERÁ OS MONSTROS ---- local position_arena = { from_pos = {x= 964, y = 993, z= 7}, -- VARIÁVEL QUE TEM A COORDENADA INICIAL DO LUGAR ONDE VAI APARECER OS MONSTROS to_pos = {x= 978, y = 1009, z= 7}, -- VARIÁVEL QUE TEM A COORDENADA FINAL DO LUGAR ONDE VAI APARECER OS MONSTROS } ---------------------------------- CÓDIGO ---------------------------------------------- function onThink(cid, words, interval, lastExecution) ----- CRIA OS BOSS ----- for i, j in ipairs(monsters) do ----- VARIÁVEL RANDOM_POSITION GERA O SPAWN ALEATÓRIO DOS BOSS ----- local random_position = {x= math.random(position_arena.from_pos.x, position_arena.to_pos.x), y= math.random(position_arena.from_pos.y, position_arena.to_pos.y), z= math.random(position_arena.from_pos.z, position_arena.to_pos.z)} doSummonCreature(j, random_position) end doBroadcastMessage(#monsters == 1 and "A monster have been arrived in this world. Don't arrive near!" or "Some monsters have been arrived in this world. Don't arrive near by them!", 22) ---- VERIFICAÇÃO SE TEM MONSTROS NA ARENA PARA REMOVER ---- addEvent(function() local position = {} for i = position_arena.from_pos.x, position_arena.to_pos.x do for j = position_arena.from_pos.y, position_arena.to_pos.y do position[#position+1] = {x= i, y = j, z= position_arena.from_pos.z, stackpos = 0} end end for i= 1, #position do for j = 0, 255 do position[i].stackpos = j local monster = getTileThingByPos(position[i]) if isMonster(monster.uid) then for d, n in ipairs(monsters) do if getCreatureName(monster.uid) == n then doRemoveCreature(monster.uid) if d == #monsters then doBroadcastMessage(#monsters == 1 and "The monster left this world. But it will return soon...." or "The monsters left this world. But they will return soon....", 22) end end end end end end end, minutos * 60 * 1000) return true end Agora em Data/Globalevents abra o globalevents.xml e adicione a tag:
    <globalevent name="boss" interval="3600" event="script" value="boss.lua"/> <!-- TEMPO EM SEGUNDOS, JÁ DEIXEI 1 HORA --> Explicação: No código, eu criei 3 monstros genéricos para testar, só adicionar o nome deles igual está na tabela, e se quiser só 1 monstro, apague os outros dois e insira o desejado (lembrando de colocar a vírgula no final igual como está).
     
    Na variável minutos já deixei 20 como pediu, mas caso queira trocar, só alterar o valor dela (lembrando que o valor dela tem que ser menor que o intervalo do evento no xml).
     
    E na tabela position_arena, precisa colocar as coordenadas iniciais e finais da arena, já deixei pronto ali também e é só substituir.
     
    Deixei para eles nascerem em posições aleatórias dentro das coordenadas da arena, caso queira spawns fixos, só ir na variável random_position e colocar x, y e z desejados.
     
    Agora na parte do Xml como deixei o comentário na tag, já deixei 1 hora como pediu (3600 segundos), caso queira outro valor só alterar lá, lembrando que ali é em segundos.
     
    Deixei tudo comentado e explicadinho, mas qualquer dúvida só falar. Eu testei muito aqui e deu certo, mas qualquer problema só me dizer.
  18. Upvote
    Yan Oliveira recebeu reputação de M i s s em [Resolvido] [PEDIDO] Scripts de spawn no mapa   
    Foi erro meu, bobiei.
     
    Arrumei o código e agora está funcionando normal:
     

     
    Substitua o código por esse:
     
    local pokemon_derrotar = "Charizard" -- NOME DO POKÉMON QUE PRECISA DERROTAR NA TASK local total = 50 -- TOTAL DE POKEMON QUE PRECISA DERROTAR local random_porcentagem = 50 -- PORCENTAGEM QUE TEM DO POKEMON SPAWNAR AO TERMINAR A TASK -- TABELA COM OS POKEMONS QUE APARECERÃO AO DERROTAR A QUANTIDADE DO POKÉMON QUE COLOCOU NA VARIÁVEL pokemon_derrotar -- local pokemons_spawn = { {pokemon = "Mewtwo", position = {x= 1000, y= 1000, z= 7}}, {pokemon = "Mew", position = {x= 1000, y= 1000, z= 7}}, {pokemon = "Articuno", position = {x= 1000, y= 1000, z= 7}}, {pokemon = "Zapdos", position = {x= 1000, y= 1000, z= 7}}, {pokemon = "Moltres", position = {x= 1000, y= 1000, z= 7}}, } ------------------------------- CÓDIGO ----------------------------- function onKill(cid, target) local random_chance = math.random(100) -- VARIÁVEL QUE GERA VALOR ALEATÓRIO local storage_contador = 336699 -- STORAGE QUE ARMAZENA QUANTAS VEZES O POKEMON FOI DERROTADOS local restante = total - getGlobalStorageValue(storage_contador) -- VARIÁVEL QUE GERA A DIFERENÇA ENTRE O TOTAL E O CONTADOR DOS POKEMONS DERROTADOS if getCreatureName(target) == pokemon_derrotar then if getGlobalStorageValue(storage_contador) < 1 then setGlobalStorageValue(storage_contador, 1) end setGlobalStorageValue(storage_contador, getGlobalStorageValue(storage_contador) + 1) if restante == 0 then if (random_chance >= random_porcentagem) then for _, pokes in pairs(pokemons_spawn) do doCreateMonster(pokes.pokemon, pokes.position) end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você despertou a fúria de alguns pokémons, fuja para sobreviver!") setGlobalStorageValue(storage_contador, 1) return true else setGlobalStorageValue(storage_contador, 1) return true end else return true end else return true end end  
    Mesmo esquema das outras vezes, só alterar os valores das variáveis, mas para te facilitar, recomendo copiar o código somente a partir da linha function onKill(cid, target).
     
    Conforme a imagem acima, está funcionando normal, mas qualquer problema só me avisar.
  19. Thanks
    Yan Oliveira recebeu reputação de Starliks em [Resolvido] (erro) criature.lua console   
    Eu estava dando uma olhada na fonte de onde você pegou esse script, e parece que estava faltando uma verificação.
     
    Substitui o código por esse:
     
    function Creature:onChangeOutfit(outfit) return true end function Creature:onAreaCombat(tile, isAggressive) return RETURNVALUE_NOERROR end function Creature:onTargetCombat(target) target:registerEvent("ItemSetsHealth") target:registerEvent("UpgradeSystemHealth") target:registerEvent("UpgradeSystemDeath") --[[if (self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == nil) or (self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == nil) then print("There was an error, please verify the value of the storage [STORAGEVALUE_WAR_GREENPLAYER_BOOL] or [STORAGEVALUE_WAR_REDPLAYER_BOOL] because it them are nil.") return false end]]-- if self:isPlayer() then if self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then if target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then return RETURNVALUE_NOERROR elseif target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 0 then self:sendCancelMessage("You cannot attack someone that is on your team.") return false end elseif self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then if target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then return RETURNVALUE_NOERROR elseif target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 0 then self:sendCancelMessage("You cannot attack someone that is on your team.") return false end end end end Testa e fala se deu problema.
  20. Thanks
    Yan Oliveira recebeu reputação de wenderotpoke em Ajuda com Efeito em buff de xp   
    Descobri o problema, troca o script do buff da pasta actions por esse código:
    local function buffEffect(cid, time, effect, duration) duration = math.floor(duration) if not isCreature(cid) then return true end if duration > os.time() then return doSendMagicEffect(getThingPos(cid), effect) and addEvent(buffEffect, 1000 * time, cid, time, effect, duration) else return true end end local items = { [19268] = {percentExtra = 50, timeType = "hours", time = 1}, -- 1 hora [19269] = {percentExtra = 100, timeType = "hours", time = 1}, -- 1 hora [19270] = {percentExtra = 50, timeType = "days", time = 7}, -- 1 semana [19271] = {percentExtra = 100, timeType = "days", time = 7}, -- 1 semana [19272] = {percentExtra = 50, timeType = "days", time = 30}, -- 1 Mês [19273] = {percentExtra = 100, timeType = "days", time = 30}, -- 1 Mês } local effect = 28 -- EFEITO QUE SAI NO PLAYER AO USAR O ITEM local storage_time = 45144 -- STORAGE QUE ARMAZENA O TEMPO QUE O BUFF VAI DURAR function onUse(cid, item, fromPosition, itemEx, toPosition) loop_effect_segundos = math.floor(loop_effect_segundos) local expItem = items[item.itemid] if not expItem then return true end local tempo = 0 local death = false if expItem.timeType == "days" then tempo = expItem.time * 60 * 60 * 24 else -- Hours tempo = expItem.time * 60 * 60 end if getPlayerStorageValue(cid, storage_time) - os.time() > 1 then doPlayerSendTextMessage(cid, 20, "Você ainda tem um Experience Booster ativo de "..getPlayerStorageValue(cid, 45145).."%. Ele irá acabar em "..convertTime(getPlayerStorageValue(cid, 45144) - os.time())..".") return false end doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, storage_time, tempo + os.time()) buffEffect(cid, loop_effect_segundos, effect, getPlayerStorageValue(cid, storage_time)) -- FUNÇÃO QUE SAI EFEITO NO PLAYER ENQUANTO ELE ESTÁ COM BUFF setPlayerStorageValue(cid, 45145, expItem.percentExtra) doPlayerSendTextMessage(cid, 20, "Você ativou um Experience Booster de "..expItem.percentExtra.."% a mais, que durará "..(death and "até morrer" or convertTime(tempo))..".") return true end  
     
    E troca o login.lua por esse (já arrumei para você, só substituir):
    local config = { loginMessage = getConfigValue('loginMessage'), useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')) } function AutoLootinit(cid) if getPlayerStorageValue (cid, storages.AutoLootCollectAll) == -1 then setPlayerStorageValue(cid, storages.AutoLootCollectAll, "no") end return true end function setVipSkull(cid) if isPremium(cid) and not isInArray({SKULL_WHITE, 1, 2, 3, 5}, getCreatureSkullType(cid)) then doCreatureSetSkullType(cid, 5) end end function getPlayerClanName(cid) local clanByNum = { [4] = "wingeon", [1] = "volcanic", [2] = "seavel", [9] = "raibolt", [7] = "psycraft", [3] = "orebound", [8] = "naturia", [5] = "malefic", [6] = "gardestrike", } local clan = clanByNum[getPlayerClanNum(cid)] if clan then return clan end return "pokemon trainer" end -- FUNÇÃO QUE SAI EFEITO AO USAR BUFF -- local function buffEffect(cid, time, effect, duration) duration = math.floor(duration) if not isCreature(cid) then return true end if duration > os.time() then return doSendMagicEffect(getThingPos(cid), effect) and addEvent(buffEffect, 1000 * time, cid, time, effect, duration) else return true end end local storage_buff = 45144 -- STORAGE QUE ARMAZENA O TEMPO QUE O BUFF VAI DURAR local effect_buff = 903 -- ID DO EFEITO function onLogin(cid) if getPlayerStorageValue(cid, storage_buff) > os.time() then buffEffect(cid, 3, effect_buff, getPlayerStorageValue(cid, storage_buff)) end local accountManager = getPlayerAccountManager(cid) if(accountManager == MANAGER_NONE) then local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage if(lastLogin > 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) str = "Seu último login foi em "..os.date("%d", getPlayerLastLoginSaved(cid)).."/"..os.date("%m", getPlayerLastLoginSaved(cid)).."/".. os.date("%Y", getPlayerLastLoginSaved(cid)).." ás "..os.date("%H", getPlayerLastLoginSaved(cid))..":"..os.date("%M", getPlayerLastLoginSaved(cid)).."." else str = str end doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) elseif(accountManager == MANAGER_NAMELOCK) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hello, it appears that your character has been namelocked, what would you like as your new name?") elseif(accountManager == MANAGER_ACCOUNT) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hello, type 'account' to create an account or type 'recover' to recover an account.") end if getCreatureName(cid):lower():find("account manager") then return false end if getPlayerVocation(cid) == 0 then setPlayerStorageValue(cid, 19898, 0) if getCreatureOutfit(cid).lookType == 128 then outfit = {lookType = 510, lookHead = math.random(0, 132), lookBody = math.random(0, 132), lookLegs = math.random(0, 132), lookFeet = math.random(0, 132)} elseif getCreatureOutfit(cid).lookType == 136 then outfit = {lookType = 511, lookHead = math.random(0, 132), lookBody = math.random(0, 132), lookLegs = math.random(0, 132), lookFeet = math.random(0, 132)} end doCreatureChangeOutfit(cid, outfit) end if getPlayerGroupId(cid) > 3 and doConvertIntegerToIp(getPlayerIp(cid)) ~= "170.79.169.130" then print("[LOG / ["..isHour().."]: "..getCreatureName(cid).." com o IP: "..doConvertIntegerToIp(getPlayerIp(cid))..".") end doSendPlayerExtendedOpcode(cid, 126, "nao") doResetPlayerTVSystem(cid) doRegainSpeed(cid) if getPlayerStorageValue(cid, 76001) ~= 1 then setPlayerStorageValue(cid, 76001, 1) db.executeQuery(string.format('INSERT INTO `player_pokedex` (player_id) VALUES (%s)', db.escapeString(getPlayerGUID(cid)))) end if getPlayerStorageValue(cid, 1614000) >= 1 and getPlayerStorageValue(cid, 1614001) >= 1 and getPlayerStorageValue(cid, 1614002) >= 1 and getPlayerStorageValue(cid, 1614003) >= 1 and getPlayerStorageValue(cid, 1614004) >= 1 and getPlayerStorageValue(cid, 1614005) >= 1 and getPlayerStorageValue(cid, 1614006) >= 1 and getPlayerStorageValue(cid, 1614007) >= 1 then setPlayerStorageValue(cid, 62365, 5) setGlobalStorageValue(getPlayerIp(cid), 5) setGlobalStorageValue(getPlayerAccountId(cid)+80000, 5) end --////// storages \\\\\\-- doEreaseDuel(cid) setPlayerStorageValue(cid, 500, -1) setPlayerStorageValue(cid, 2152525, -1) setPlayerStorageValue(cid, 8085, 0) setPlayerStorageValue(cid, 4875498, -1) setPlayerStorageValue(cid, 54798, 0) setPlayerStorageValue(cid, 58496, 0) setPlayerStorageValue(cid, 42368, -1) setPlayerStorageValue(cid, 465456701, -1) --// duel setPlayerStorageValue(cid, storages.requestCountPlayer, 0) setPlayerStorageValue(cid, storages.requestCountPokemon, 0) setPlayerStorageValue(cid, storages.requestedPlayer, 0) --// duel --////// storages \\\\\\-- checkOfflineMessage2(cid) --////// Eventos \\\\\\-- registerCreatureEvent(cid, "channel") registerCreatureEvent(cid, "tvcam") registerCreatureEvent(cid, "sendStats") registerCreatureEvent(cid, "ShowPokedex") registerCreatureEvent(cid, "ClosePokedex") registerCreatureEvent(cid, "Mail") registerCreatureEvent(cid, "WildAttack") registerCreatureEvent(cid, "GuildMotd") registerCreatureEvent(cid, "Idle") registerCreatureEvent(cid, "ReportBug") registerCreatureEvent(cid, "AdvanceSave") --Adicionados \/ registerCreatureEvent(cid, "PlayerLogout") registerCreatureEvent(cid, "LookSystem") registerCreatureEvent(cid, "Opcode") registerCreatureEvent(cid, "EmeraldShop") registerCreatureEvent(cid, "PokeStats") registerCreatureEvent(cid, "PokeWalk") registerCreatureEvent(cid, "PokeSleep") registerCreatureEvent(cid, "MoveItem") registerCreatureEvent(cid, "task_count") registerCreatureEvent(cid, "UpLevel") registerCreatureEvent(cid, "BlockWords") registerCreatureEvent(cid, "PartySystem") registerCreatureEvent(cid, "Target") registerCreatureEvent(cid, "GeneralConfiguration") registerCreatureEvent(cid, "EffectOnAdvance") registerCreatureEvent(cid, "TradeRequest") registerCreatureEvent(cid, "TradeAccpet") registerCreatureEvent(cid, "KillTask") registerCreatureEvent(cid, "onTalk") registerCreatureEvent(cid, "onAdvance") registerCreatureEvent(cid, "Effects") registerCreatureEvent(cid, "pLoot") registerCreatureEvent(cid, "vaultLook") if isBiking(cid) then cancelBike(cid) end --////// Eventos \\\\\\-- if(not isPlayerGhost(cid)) then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) end local legs = getPlayerSlotItem(cid, CONST_SLOT_LEGS) local ball = getPlayerSlotItem(cid, ? if getPlayerSlotItem(cid, CONST_SLOT_FEET).uid ~= 0 then doItemEraseAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, "healthChanged") end doSendPlayerExtendedOpcode(cid, 71, getPlayerClanName(cid)) doSendPlayerExtendedOpcode(cid, 72, getPlayerSex(cid)) if getPlayerStorageValue(cid, 141414) ~= 1 then resetDaily(cid) resetDailyItens(cid) setPlayerStorageValue(cid, 141414, 1) end if getPlayerStorageValue(cid, 154585) >= 1 then setPlayerStorageValue(cid, 144585, -1) doRemoveCondition(cid, CONDITION_OUTFIT) end if getPlayerStorageValue(cid, 245678) >= 1 then for _, oid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(oid, 245678) >= 1 then setPlayerStorageValue(oid, 245678, -1) setGlobalStorageValue(254000, 0) doTeleportThing(oid, {x = 606, y = 1172, z = 8}, true) setPlayerStorageValue(oid, 245680, 2 * 24 * 60 * 60 + os.time()) doPlayerSendTextMessage(oid, 20, "[Clones]: O player "..getCreatureName(cid).." saiu durante a quest tente novamente em 2 dias!") end end end if getPlayerStorageValue(cid, 245681) >= 1 then for _, oid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(oid, 245681) >= 1 then setPlayerStorageValue(oid, 245681, -1) doTeleportThing(oid, {x = 645, y = 722, z = 15}, true) setPlayerStorageValue(oid, 245682, 1 * 24 * 60 * 60 + os.time()) doPlayerSendTextMessage(oid, 20, "[Brotherhood]: O player "..getCreatureName(cid).." saiu durante a quest tente novamente em 1 dias!") end end end if getPlayerStorageValue(cid, 2154600) >= 1 then doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) setPlayerStorageValue(cid, 2154600, -1) setPlayerStorageValue(cid, 1654987, -1) setPlayerStorageValue(cid, 2154601, -1) end if getPlayerInTower(cid) then removeCondTower(cid) setPlayerStorageValue(cid, 252525, -1) doTeleportThing(cid, {x=2506, y=243, z=7}) end if getPlayerInGolden(cid) then removeConditionArena(cid) end if getPlayerStorageValue(cid, 2525252525) >= 1 then setPlayerStorageValue(cid, 2525252525, -1) setPlayerStorageValue(cid, 465456701, -1) -- proteção para não usar o card doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) end if isRiderOrFlyOrSurf(cid) and ball.uid ~= 0 then local pokeName = getItemAttribute(ball.uid, "poke") if isInArray({"ditto", "shiny ditto"}, pokeName:lower()) then pokeName = getItemAttribute(ball.uid, "copyName") end local outfit = getPokemonOutfitToSkill(pokeName) local speed = getPokemonSpeedToSkill(pokeName) local addon = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "addon") if flys[pokeName] then if addon and PokeAddons[pokeName][addon].fly then doSetCreatureOutfit(cid, {lookType = PokeAddons[pokeName][addon].fly}, -1) else doSetCreatureOutfit(cid, {lookType = outfit}, -1) end else if addon and PokeAddons[pokeName][addon].ride then doSetCreatureOutfit(cid, {lookType = PokeAddons[pokeName][addon].ride}, -1) else doSetCreatureOutfit(cid, {lookType = outfit + 351}, -1) end end doChangeSpeed(cid, -getCreatureSpeed(cid)) doChangeSpeed(cid, speed) if isRider(cid) then setPlayerStorageValue(cid, orderTalks["ride"].storage, 1) elseif isFly(cid) then setPlayerStorageValue(cid, orderTalks["fly"].storage, 1) if not hasSqm(getThingPos(cid)) then -- doCreateItem(460, 1, getThingPos(cid)) end elseif isSurf(cid) then setPlayerStorageValue(cid, orderTalks["surf"].storage, 1) -- rever o markedPos doChangeSpeed(cid, -getCreatureSpeed(cid)) doChangeSpeed(cid, getPlayerStorageValue(cid, 54844)) end doTeleportThing(cid, getMarkedSpawnPos(cid)) setPokemonGhost(cid) end setPlayerStorageValue(cid, storages.gobackDelay, -1) setPlayerStorageValue(cid, storages.pokedexDelay, -1) setPlayerStorageValue(cid, 154585, -1) setPlayerStorageValue(cid, 174529, -1) AutoLootinit(cid) --doAddShoppingItem(cid) -- otclient life doSendLifePokeToOTC(cid) -- otclient life local percent = getPlayerTotalExtraExperience(cid) - (isPremium(cid) and 1.5 or 1) if not isPremium(cid) then doPlayerSendTextMessage(cid, 20, "Players Vip tem 25% a mais de experiência, seja um e colabore com nosso servidor!") else doPlayerSendTextMessage(cid, 20, "Você tem "..getPlayerPremiumDays(cid).." dia"..(getPlayerPremiumDays(cid) > 1 and "s" or "").." VIP e 25% a mais de experiência.") end if percent > 0 then doPlayerSendTextMessage(cid, 20, "[Experience Booster]: ".. percent * 50 .."% a mais de experiência durante " ..convertTime(getPlayerStorageValue(cid, 45144) - os.time()).." restantes.") end if getPlayerStorageValue(cid, 4125) - os.time() > 0 then doPlayerSendTextMessage(cid, 20, "[Shiny Charm]: "..convertTime(getPlayerStorageValue(cid, 4125) - os.time()).." restantes.") end if getPlayerStorageValue(cid, 43144) - os.time() > 1 then doPlayerSendTextMessage(cid, 20, "[Clan Booster]: "..convertTime(getPlayerStorageValue(cid, 43144) - os.time()).." restantes.") end if getPlayerStorageValue(cid, 9134) ~= -1 then doPlayerSendTextMessage(cid, 20, "Você mudou seu antigo nome ("..getPlayerStorageValue(cid, 9134)..") para ("..getCreatureName(cid)..") com êxito.") setPlayerStorageValue(cid, 9134, -1) end return true end  
    Eu testei aqui e funcionou, mas qualquer problema me avisa.
  21. Amei
    Yan Oliveira recebeu reputação de wenderotpoke em Ajuda com Efeito em buff de xp   
    Considerando que esse script está funcionando é só substituir o código por esse:
     
    local items = { [19268] = {percentExtra = 50, timeType = "hours", time = 1}, -- 1 hora [19269] = {percentExtra = 100, timeType = "hours", time = 1}, -- 1 hora [19270] = {percentExtra = 50, timeType = "days", time = 7}, -- 1 semana [19271] = {percentExtra = 100, timeType = "days", time = 7}, -- 1 semana [19272] = {percentExtra = 50, timeType = "days", time = 30}, -- 1 Mês [19273] = {percentExtra = 100, timeType = "days", time = 30}, -- 1 Mês } local effect = 28 -- EFEITO QUE SAI NO PLAYER AO USAR O ITEM function onUse(cid, item, fromPosition, itemEx, toPosition) local expItem = items[item.itemid] if not expItem then return true end local tempo = 0 local death = false --[[if expItem.timeType == "death" then tempo = "death" death = true else]] if expItem.timeType == "days" then tempo = expItem.time * 60 * 60 * 24 else -- Hours tempo = expItem.time * 60 * 60 end if getPlayerStorageValue(cid, 45144) - os.time() > 1 then doPlayerSendTextMessage(cid, 20, "Você ainda tem um Experience Booster ativo de "..getPlayerStorageValue(cid, 45145).."%. Ele irá acabar em "..convertTime(getPlayerStorageValue(cid, 45144) - os.time())..".") return false end doSendMagicEffect(getThingPos(cid), effect) -- FUNÇÃO QUE SAI EFEITO NO PLAYER AO USAR O ITEM doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, 45144, tempo + os.time()) setPlayerStorageValue(cid, 45145, expItem.percentExtra) doPlayerSendTextMessage(cid, 20, "Você ativou um Experience Booster de "..expItem.percentExtra.."% a mais, que durará "..(death and "até morrer" or convertTime(tempo))..".") return true end Só colocar o id do efeito na variável effect que coloquei lá em cima.
     
    Avisa se der algum erro
  22. Thanks
    Yan Oliveira recebeu reputação de Gengo em [OTClient] Sistema de Dialogo Otpokemon   
    Parabéns pelo conteúdo! Vai ser muito útil para vários servidores.
     
    Fico feliz que em pleno 2020 ainda há membros como você que trazem conteúdos e recursos novos para a comunidade do Xtibia, pois, muitas pessoas não ajudam em nada e não trazem conteúdos/recursos algum para o fórum, mas, para vir pegar conteúdos novos, aparecem rapidinho! Sendo que muitos desses, tem capacidade para contribuir. 
     
    Enfim, fico feliz que ainda contribuam para a comunidade.
  23. Amei
    Yan Oliveira deu reputação a Gengo em [OTClient] Sistema de Dialogo Otpokemon   
    [OTClient] Sistema de Dialogo Otpokemon
     
    Venho através desse tópico contribuir para a comunidade, um simples modulo de dialogo no estilo do Otpokemon,
    não é um sistema de dialogo avançado é algo simples que deixa seu servidor intuitivo.
     
    1) Faça o download do modulo no qual se encontra no final do tópico e abrindo a pasta do seu client, extraia e coloque o modulo na pasta modules.
     
    2) O módulo utiliza uma função chamada switch que não é comum ter no otclient, porem podemos colocar sem muito esforço, na pasta do otclient abra o arquivo util.lua que se encontra em modules/corelib/ e no final do arquivo coloque o seguinte código:
     
    Feito o passo 1 e 2, vamos para a parte do servidor.
     
    1) Crie um arquivo na pasta data/lib/ podendo ter o nome de npcdialog_lib.lua e coloque o seguinte código:
     
    2) O arquivo que acabamos de criar utiliza uma função chamada table.serialize que não é comum ter nos servidores, para que funcione sem erros vamos adicionar, abra o arquivo 012-table.lua que fica na pasta do seu servidor em data/lib/ ou você pode criar o arquivo e adicionar o seguinte código:
     
     
    Feito todo esse procedimento, estarei disponibilizando um npc para que vocês possam ter uma noção de como utilizar esse sistema de dialogo.
     
    1) Crie um arquivo na pasta do servidor em data/npc/ chamado Gengo.xml e adicione o seguinte código:
     
    2) Crie um arquivo na pasta do servidor em data/npc/lib/ com o nome gengo.lua e adicione o seguinte código:
     
     
    O npc é algo simples, porem serve para que você possa ter uma noção de como utilizar as funções do npc.
     
    Demostrativo dentro do game:

     
    Arquivos para download e o scan:
     
  24. Thanks
    Yan Oliveira recebeu reputação de Icaro Simoes em Alavanca Boss Room   
    Que bom que funcionou. Obrigado ?.
  25. Thanks
    Yan Oliveira recebeu reputação de GamerGoiano em Alavanca Boss Room   
    Vai em Data/Actions/Scripts e crie o arquivo quest_alavanca.lua (ou um nome que preferir), e adicione o código:
    local id_alavanca = 1945 -- ID DA ALAVANCA local action_id = 6542 -- ACTION ID QUE COLOCOU NA ALAVANCA NO REMERES -- POSIÇÃO QUE OS PLAYERS TEM QUE ESTAR AO CLICAR NA ALAVANCA -- local position_players = { {x= 1000, y= 1000, z=7}, {x= 1001, y= 1001, z=7}, {x= 1002, y= 1002, z=7}, {x= 1003, y= 1003, z=7}, {x= 1004, y= 1004, z=7} } -- TABELA DOS MONSTROS E SUAS RESPECTIVAS POSIÇÕES DE ACORDO COM A QUANTIDADE DE PLAYERS TELEPORTADOS local monsters = { {nome = "Ferumbras", pos = {x= 1500, y= 1050, z=7}}, -- MONSTRO QUE VAI NASCER SE SÓ 1 PLAYER FOR TELEPORTADO {nome = "Goblins", pos = {x= 1500, y= 1050, z=7}}, -- MONSTRO QUE VAI NASCER SE 2 PLAYERS FOR TELEPORTADO {nome = "Medusa", pos = {x= 1500, y= 1050, z=7}}, -- MONSTRO QUE VAI NASCER SE 3 PLAYERS FOR TELEPORTADO {nome = "Mage", pos = {x= 1500, y= 1050, z=7}}, -- MONSTRO QUE VAI NASCER SE 4 PLAYERS FOR TELEPORTADO {nome = "Skull", pos = {x= 1500, y= 1050, z=7}} -- MONSTRO QUE VAI NASCER SE 5 PLAYERS FOR TELEPORTADO } local position_destino = {x= 1500, y= 1020, z= 7} -- POSIÇÃO ONDE OS PLAYERS SERÃO TELEPORTADOS storage_global_quest = 87898 -- STORAGE GLOBAL, NÃO PODE SER USADO ESSE VALOR PARA OUTRA STORAGE E NEM PARA PLAYER local cooldown_alavanca = 3 -- TEMPO EM MINUTOS PARA O COOLDOWN DA ALAVANCA ----------------------------------------- CÓDIGO ----------------------------------------- function onUse(cid, item, fromPos, itemEx, toPos) local player = nil local count_players = 0 if (item.itemid == id_alavanca) and (item.actionid == action_id) then if getGlobalStorageValue(storage_global_quest) <= os.time() then for i = 1, #position_players do player = getTileThingByPos(position_players[i]) if isPlayer(player.uid) then doTeleportThing(player.uid, position_destino) count_players = count_players + 1 end if (i == #position_players) and (count_players == 0) then return true end end if count_players == 1 then doCreateMonster(monsters[1].nome, monsters[1].pos) elseif count_players == 2 then doCreateMonster(monsters[2].nome, monsters[2].pos) elseif count_players == 3 then doCreateMonster(monsters[3].nome, monsters[3].pos) elseif count_players == 4 then doCreateMonster(monsters[4].nome, monsters[4].pos) elseif count_players == 5 then doCreateMonster(monsters[5].nome, monsters[5].pos) end doPlayerSendTextMessage(player.uid, MESSAGE_STATUS_CONSOLE_BLUE, "Good lucky!") setGlobalStorageValue(storage_global_quest, os.time() + (60 * cooldown_alavanca)) return true else return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The switch is in cooldown. You need to wait.") end end end Deixei tudo comentado, então está bem fácil de identificar, coloquei variável para determinar tempo de cooldown em minutos da alavanca ao clicar novamente (lembrando que tem que colocar uma storage ali que não foi usada ainda, e nem pode ser usada para outra coisa, pois, ela é global). Você também precisa arrumar as coordenadas das posições e o nome dos monstros (igual está no xml dele).
     
    Agora abre o actions.xml e adicione a tag:
    <action actionid="6542" event="script" value="quest_alavanca.lua"/> Coloquei verificação por actionid porque provavelmente essa alavanca deve ser usada em outras quests, então, você tem que colocar uma actionid (ou a mesma que coloquei ali de exemplo, caso não esteja em uso) nessa alavanca no Remere's (mapa). Após colocar no mapa, arrume o id da action na tag xml e na variável action_id no script.lua.
     
    Então, o script vai criar os monstros de acordo com a quantidade de players, deixei o limite de 5, e não esqueça de arrumar as coordenadas, deixei tudo genérico.
     
    Teste e fale se der algum erro.
  • Quem Está Navegando   0 membros estão online

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