Jump to content
  • 0
fawkz12

bug Ditto Memory

Question

Bug : Coloquei um SISTEMA de Ditto Memory por Comando... mas quando eu transformo meu ditto no pokemon e uso /memory save 1

Fala - Coloque o seu DITTO no Slot do POKEMON '-'

 

Script -

 

local maxSlots = 3            --Quantia máxima de slots.
function getDittoSlots(item)
    if not item or item < 1 then
        return false
    elseif getItemAttribute(item, "poke") and getItemAttribute(item, "poke") ~= "Ditto" then
        return false
    end
    local slots = {}
    for i = 1, maxSlots do
        local attr = getItemAttribute(item, "memory"..i)
        if attr then
            slots[i] = attr
        end
    end
    return slots
end
function hasDittoSavedPokemon(item, name)
    if not item or item < 1 then
        return false
    elseif getItemAttribute(item, "poke") and getItemAttribute(item, "poke") ~= "Ditto" then
        return false
    end
    local check
    for i = 1, maxSlots do
        local attr = getItemAttribute(item, "memory"..i)
        if attr and attr == name then
            check = true
            break
        end
    end
    return check
end
function onSay(cid, words, param)
    local item = getPlayerSlotItem(cid, 8).uid
    if item < 1 then
        doPlayerSendCancel(cid, "Put a pokeball in the pokeball slot.")
    elseif getItemAttribute(item, "poke") ~= "Ditto" then
        doPlayerSendCancel(cid, "Put a pokeball with a Ditto in the pokeball slot.")
    elseif param == "" then
        doPlayerSendCancel(cid, "Especify a param.")
    else
        param = param:lower()
        if param == "check" then
            local str = ""
            for i = 1, maxSlots do
                local attr = getItemAttribute(item, "memory"..i) or "No memory"
                if str == "" then
                    str = i.." - "..attr
                else
                    str = str.."\n"..i.." - "..attr
                end
            end
            doPlayerPopupFYI(cid, "Ditto Memory:\n"..str.."")
        elseif param:find("forget") then
            local slot = tonumber(param:match("forget (.+)"))
            if slot and slot <= maxSlots and slot > 0 then
                if getDittoSlots(item)[slot] then
                    doItemSetAttribute(item, "memory"..slot, false)
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Ditto Memory] Slot "..slot.." deleted.")
                else
                    doPlayerSendCancel(cid, "This slot is empty.")
                end
            else
                doPlayerSendCancel(cid, "Invalid slot.")
            end
        else
            local summons = getCreatureSummons(cid)
            if #summons == 0 then
                doPlayerSendCancel(cid, "You don't have any pokemon out of the pokeball.")
            else
                if param:find("save") then
                    local transformedPoke = getItemAttribute(item, "transName")
                    if transformedPoke and type(transformedPoke) == "string" then
                        local slot = tonumber(param:match("save (.+)"))
                        if slot and slot <= maxSlots and slot > 0 then
                            if not getDittoSlots(item)[slot] and not hasDittoSavedPokemon(item, transformedPoke) then
                                doItemSetAttribute(item, "memory"..slot, transformedPoke)
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Ditto Memory] You saved at the slot "..slot..": "..transformedPoke..".")
                            else
                                doPlayerSendCancel(cid, "This slot isn't empty or your Ditto already has this pokemon saved in his memory.")
                            end
                        else
                            doPlayerSendCancel(cid, "Invalid slot.")
                        end
                    else
                        doPlayerSendCancel(cid, "Your Ditto isn't transformed in any pokemon.")
                    end
                else
                    local slot = tonumber(param)
                    local transformPoke = getDittoSlots(item)[slot]
                    if not slot then
                        doPlayerSendCancel(cid, "Invalid param.")
                    elseif slot <= 0 or slot > maxSlots then
                        doPlayerSendCancel(cid, "Use a valid slot.")
                    elseif not transformPoke then
                        doPlayerSendCancel(cid, "This slot is empty.")
                    elseif getPlayerStorageValue(summons[1], 1010) == transformPoke then
                        doPlayerSendCancel(cid, "Your Ditto is already transformed in this pokemon.")
                    else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Ditto Memory] Using the slot "..slot..", your Ditto transformed into a "..transformPoke..".")
                        setPlayerStorageValue(summons[1], 1010, transformPoke)
                        doSetCreatureOutfit(summons[1], {lookType = getPokemonXMLOutfit(transformPoke)}, -1)
                        doSendMagicEffect(getThingPos(summons[1]), 184)
                        doCreatureSay(summons[1], "TRANSFORM!", TALKTYPE_MONSTER)
                        doItemSetAttribute(item, "transName", transformPoke)
                        doItemSetAttribute(item, "transOutfit", getPokemonXMLOutfit(transformPoke))
                        if useKpdoDlls then
                            doUpdateMoves(cid)
                        end
                        if dittoCopiesStatusToo then
                           setPlayerStorageValue(summons[1], 1001, dittoBonus * pokes[transformPoke].offense * getPlayerLevel(cid))
                           setPlayerStorageValue(summons[1], 1002, dittoBonus * pokes[transformPoke].defense)
                           setPlayerStorageValue(summons[1], 1003, pokes[transformPoke].agility)
                           setPlayerStorageValue(summons[1], 1004, dittoBonus * pokes[transformPoke].vitality * getPlayerLevel(cid))
                           setPlayerStorageValue(summons[1], 1005, dittoBonus * pokes[transformPoke].specialattack * getPlayerLevel(cid))
                           local pct = getCreatureHealth(summons[1]) / getCreatureMaxHealth(summons[1])
                           local vit = getVitality(summons[1]) * getPlayerLevel(cid) / 100
                           setCreatureMaxHealth(summons[1], vit * HPperVITsummon)
                           doCreatureAddHealth(summons[1], pct * vit * HPperVITsummon)
                        end
                    end
                end
            end
        end
    end
    return true
end

 

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Eulleererrrr
      Aí pessoal minha a tela do meu jogo tá toda bugada depois de eu compilar mesmo sem fazer mudanças... eu compilo pelo visual studio 2013 o client do poketibia com a source do mesmo e ainda assim dá erro. Alguém pode dar um Help?
       
       

      Please login or register to see this attachment.
    • By Eulleererrrr
      Seguinte pessoal troquei o .spr e .dat pra um client que quero usar mais ficou tudo bugado.
      Eu já esperava por isso mas o problema é que esse client que quero usar tem as sources mas o que veio junto com o server não tem  --- é o client do mesmo server também só que mais atualizado e não possui OpenGL, o antigo tem source e OpenGL o novo não.
      Como proceder?

      Please login or register to see this attachment.
    • By devilsux
      Fala galera beleza?
      Então to com um problema aqui que surgiu do nada!
      Eu usava o map editor certinho e tal hoje eu fui abri

      aparece esse erro ao abrir:
      couldn't load items.xml: could not read item id from item node.
       
      E as sprites ficam todas bugadas no mapa...
       
      obs: ja tava tudo certinho, o items.xml e items.otb na pasta do Remeres do nada deu esse bug e bugou tudo as sprites do Remers, alguem sabe como arrumo isso?
    • By devilsux
      Versão do Servidor: TFS - 0.3.5 Tipo de Script: actions Código: Please login or register to see this spoiler.
      Fala galera beleza?  estou com um problemão aqui
      Eu estou usando a base pokeroxy
      o problema é: depois que coloquei o icon system, ao evoluir um pokemon da pra jogar ele no chão sendo usado. 
      ex: Eu peguei evolui um charmander para charmeleon, quando eu evoluo o pokemon o icone transforma para um 

      12:45 You see a Icone dead.
      It contains a Charmeleon.
      It is male.

      ao invés de :
       
      12:46 You see a Icone using.
      It contains a Charmeleon.
      It is male.
       


      Valeu pela a atenção, quem passou por isso ou sabe como resolver por favor da uma ajuda aqui.
    • By giovani27
      Versão do Servidor: TFS - 1.0 Tipo de Script: actions Código: Please login or register to see this spoiler.
      [24/02/2020 21:19:57] [Error - Action Interface]
      [24/02/2020 21:19:57] In a timer event called from:
      [24/02/2020 21:19:57] data/actions/scripts/catch.lua:onUse
      [24/02/2020 21:19:57] Description:
      [24/02/2020 21:19:57] data/lib/catch system.lua:22: attempt to perform arithmetic on local 'g' (a string value)
      [24/02/2020 21:19:57] stack traceback:
      [24/02/2020 21:19:57] data/lib/catch system.lua:22: in function 'doBrokesCount'
      [24/02/2020 21:19:57] data/lib/catch system.lua:277: in function <data/lib/catch system.lua:243>
       
      ALGUEM SABE RESOLVER ESSE ERRO PORFAVOR?  SEMPRE QUE VOU USAR COMANDO !POKEBALLS (PRA VER QUANTAS BALLS GASTEI) DA  ESSE ERRO 
      O CATCH SYSTEM TA AI 
×
×
  • Create New...