Ir para conteúdo
  • 0

Erro Heal.lua


elias vieira alves

Pergunta

[30/01/2016 20:37:59] [Error - Npc interface] 
[30/01/2016 20:37:59] data/npc/scripts/heal.lua:onCreatureSay
[30/01/2016 20:37:59] Description: 
[30/01/2016 20:37:59] (luaDoItemSetAttribute) Item not found

-------------------------------------

Já tentei de tudo 4 meses ja tentando arrumar esse erro mas não consigo ja tentei trocar de script mas o erro insiste 

Talves seja por causa dos ids das ball do meu cliente não se se e isso auguem pode me ajudar ? dou rep

o id das bals no meu server está assim

-----------------------------------------

pokeballs = {
["normal"] = {effect = 188, on = 11826, use = 11827, off = 11828, all = {11826, 11827, 11828}},
["great"] = {effect = 189, on = 11832, use = 11833, off = 11834, all = {11832, 11833, 11834}},
["super"] = {effect = 190, on = 11835, use = 11836, off = 11837, all = {11835, 11836, 11837}},
["ultra"] = {effect = 191, on = 11829, use = 11830, off = 11831, all = {11829, 11830, 11831}},
["saffari"] = {effect = 195, on = 10975, use = 10976, off = 10977, all = {10975, 10976, 10977}},    --alterado v1.9

["shinynormal"] = {effect = 188, on = 11737, use = 11738, off = 11739, all = {11737, 11738, 11739}},
["shinygreat"] = {effect = 189, on = 11740, use = 11741, off = 11742, all = {11740, 11741, 11742}},
["shinysuper"] = {effect = 190, on = 11743, use = 11744, off = 11745, all = {11743, 11744, 11745}},
["shinyultra"] = {effect = 191, on = 11746, use = 11747, off = 11748, all = {11746, 11747, 11748}},
["shinysaffari"] = {effect = 195, on = 12621, use = 12622, off = 12623, all = {12621, 12622, 12623}},   --alterado v1.9
}

-----------------------------------------------

Meu script Heal.lua \/\/\/\/

 

Spoiler

local posis = {   --[storage da city] = {pos da nurse na city},
[897530] = {x = 1038, y = 1033, z = 7},   --saffron                   --alterado v1.9 \/                  
[897531] = {x = 1045, y = 880, z = 7},    --cerulean
[897532] = {x = 1189, y = 1021, z = 7},    --lavender
[897533] = {x = 1199, y = 1475, z = 7},    --fuchsia
[897534] = {x = 847, y = 1011, z = 6},    --celadon
[897535] = {x = 691, y = 1064, z = 7},    --viridian
[897536] = {x = 1029, y = 1224, z = 7},    --vermilion
[897537] = {x = 703, y = 834, z = 7},    --pewter
[897538] = {x = 744, y = 1325, z = 7},    --cinnabar
[897539] = {x = 1633, y = 1664, z = 6},    --Hunter Village
[897540] = {x = 2555, y = 2692, z = 7},    --Blackthorn
[897541] = {x = 1492, y = 1820, z = 7},    --Sunshine
[897542] = {x = 2387, y = 2698, z = 7},    --Mahogany
[897543] = {x = 1014, y = 1023, z = 3},    --Pvp
[897544] = {x = 2431, y = 1507, z = 7},    --Orre
[897545] = {x = 2456, y = 1642, z = 7},    --LaRosse
[897546] = {x = 2441, y = 1739, z = 6},    --Canavale
[897547] = {x = 1927, y = 2793, z = 7},    --Olivine
[897548] = {x = 1514, y = 1009, z = 7},    --Battle City
[897549] = {x = 734, y = 1162, z = 7},    --Pallet
[897550] = {x = 2274, y = 2792, z = 7},    --Violet
[897551] = {x = 2169, y = 2699, z = 7},    --Ecruteak
[897552] = {x = 1631, y = 1055, z = 6},    --Singer
}

function onThingMove(creature, thing, oldpos, oldstackpos)
end

function onCreatureAppear(creature)
end

function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Ate mais treinador!')
focus = 0
talk_start = 0
end
end

function onCreatureTurn(creature)
end

function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end

function onCreatureSay(cid, type, msg)
local msg = string.lower(msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

for a, b in pairs(gobackmsgs) do
    local gm = string.gsub(b.go, "doka!", "")
    local bm = string.gsub(b.back, "doka!", "")
if string.find(string.lower(msg), string.lower(gm)) or string.find(string.lower(msg), string.lower(bm)) then
return true
end
end

if((msgcontains(msg, 'hi') or msgcontains(msg, 'heal') or msgcontains(msg, 'help')) and (getDistanceToCreature(cid) <= 3)) then

     if exhaustion.get(cid, 9211) then
    selfSay('Please wait a few moment before asking me to heal your pokemons again!')
    return true
       end

    if not getTileInfo(getThingPos(cid)).protection and nurseHealsOnlyInPZ then
        selfSay("Please, get inside the pokémon center to heal your pokemons!")
    return true
    end
    
    for e, f in pairs(posis) do
        local pos = getThingPos(getNpcCid())
        if isPosEqual(pos, f) then
           if getPlayerStorageValue(cid, e) <= -1 then           --alterado v1.7
              setPlayerStorageValue(cid, e, 1)
           end
        end
    end 

    exhaustion.set(cid, 9211, 5)

    doCreatureAddHealth(cid, getCreatureMaxHealth(cid)-getCreatureHealth(cid))
    doCureStatus(cid, "all", true)
    doSendMagicEffect(getThingPos(cid), 14)

    local mypb = getPlayerSlotItem(cid, 8):

    if #getCreatureSummons(cid) >= 1 then

        if not nurseHealsPokemonOut then
            selfSay("Please, return your pokemon to his ball!")
        return true
        end

        local s = getCreatureSummons(cid)[1]
        doCreatureAddHealth(s, getCreatureMaxHealth(s))
        doSendMagicEffect(getThingPos(s), 14)
        doCureStatus(s, "all", false)
        if getPlayerStorageValue(s, 1008) < baseNurseryHappiness then
            setPlayerStorageValue(s, 1008, baseNurseryHappiness)
        end
        if getPlayerStorageValue(s, 1009) > baseNurseryHunger then
            setPlayerStorageValue(s, 1009, baseNurseryHunger)
        end
    else
        if mypb.itemid ~= 0 and isPokeball(mypb.itemid) then  --alterado v1.3
            doItemSetAttribute(mypb.uid, "hp", 1)
            if getItemAttribute(mypb.uid, "hunger") and getItemAttribute(mypb.uid, "hunger") > baseNurseryHunger then
                doItemSetAttribute(mypb.uid, "hunger", baseNurseryHunger)
            end
            for c = 1, 15 do
                local str = "move"..c
                setCD(mypb.uid, str, 0)
            end
            if getItemAttribute(mypb.uid, "happy") and getItemAttribute(mypb.uid, "happy") < baseNurseryHappiness then
                doItemSetAttribute(mypb.uid, "happy", baseNurseryHappiness)
            end
            if getPlayerStorageValue(cid, 17000) <= 0 and getPlayerStorageValue(cid, 17001) <= 0 and getPlayerStorageValue(cid, 63215) <= 0 then
                for a, b in pairs (pokeballs) do
                    if isInArray(b.all, mypb.itemid) then
                       doTransformItem(mypb.uid, b.on)
                    end
                end
            end
        end
    end

    local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)

    local balls = getPokeballsInContainer(bp.uid)
    if #balls >= 1 then
       for _, uid in ipairs(balls) do
           doItemSetAttribute(uid, "hp", 1)
           for c = 1, 15 do
               local str = "move"..c
               setCD(uid, str, 0)   
           end
           if getItemAttribute(uid, "hunger") and getItemAttribute(uid, "hunger") > baseNurseryHunger then
              doItemSetAttribute(uid, "hunger", baseNurseryHunger)
           end
           if getItemAttribute(uid, "happy") and getItemAttribute(uid, "happy") < baseNurseryHappiness then
              doItemSetAttribute(uid, "happy", baseNurseryHappiness)
           end
           local this = getThing(uid)
           for a, b in pairs (pokeballs) do
               if isInArray(b.all, this.itemid) then
                  doTransformItem(uid, b.on)
               end
           end
        end
    end
    selfSay('There you go! You and your pokemons are healthy again.')
    if useKpdoDlls then  --alterado v1.7
       doUpdateMoves(cid)
    end
end
end

 

Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts Recomendados

  • 0
  • 0

Eu preciso saber o que está escrito aqui, pois o Xt ta com essa veadagem.

Citar

local mypb = getPlayerSlotItem(cid, 8):

 

Link para o comentário
Compartilhar em outros sites

  • 0
  • Diretor
8 horas atrás, Poccnn disse:

Eu preciso saber o que está escrito aqui, pois o Xt ta com essa veadagem.

 

Quando for assim é só passar o mouse em cima do emoticon... Nesse seria 8 ).

Mais está errado o emoticon se ativar automaticamente em spoiler ou em código.

 

@elias vieira alves vou ver se posso ajudar...

TENTE ASSIM:

Spoiler

local pokeballs = {

[1] = {effect = 188, on = 11826, use = 11827, off = 11828, all = {11826, 11827, 11828}},

[2] = {effect = 189, on = 11832, use = 11833, off = 11834, all = {11832, 11833, 11834}},

[3] = {effect = 190, on = 11835, use = 11836, off = 11837, all = {11835, 11836, 11837}},

[4] = {effect = 191, on = 11829, use = 11830, off = 11831, all = {11829, 11830, 11831}},

[5] = {effect = 195, on = 10975, use = 10976, off = 10977, all = {10975, 10976, 10977}},    

[6] = {effect = 188, on = 11737, use = 11738, off = 11739, all = {11737, 11738, 11739}},

[7] = {effect = 189, on = 11740, use = 11741, off = 11742, all = {11740, 11741, 11742}},

[8] = {effect = 190, on = 11743, use = 11744, off = 11745, all = {11743, 11744, 11745}},

[9] = {effect = 191, on = 11746, use = 11747, off = 11748, all = {11746, 11747, 11748}},

[10] = {effect = 195, on = 12621, use = 12622, off = 12623, all = {12621, 12622, 12623}},   

local posis = {   --[storage da city] = {pos da nurse na city},

[897530] = {x = 1038, y = 1033, z = 7},   --saffron                   --alterado v2.9 TUDO!! \/                  

[897531] = {x = 1044, y = 879, z = 7},    --cerulean

[897532] = {x = 1189, y = 1021, z = 7},    --lavender

[897533] = {x = 1199, y = 1475, z = 7},    --fuchsia

[897534] = {x = 847, y = 1011, z = 6},    --celadon

[897535] = {x = 689, y = 1065, z = 7},    --viridian

[897536] = {x = 1029, y = 1224, z = 7},    --vermilion

[897537] = {x = 703, y = 834, z = 6},    --pewter

[897538] = {x = 744, y = 1325, z = 7},    --cinnabar

[897539] = {x = 1630, y = 1664, z = 7},    --Hunter Village

[897540] = {x = 2555, y = 2693, z = 7},    --Blackthorn

[897541] = {x = 1492, y = 1820, z = 7},    --Sunshine

[897542] = {x = 2387, y = 2698, z = 7},    --Mahogany

[897543] = {x = 1014, y = 1023, z = 3},    --Pvp

[897544] = {x = 2431, y = 1507, z = 7},    --Orre

[897545] = {x = 2456, y = 1642, z = 7},    --LaRosse

[897546] = {x = 2441, y = 1739, z = 6},    --Canavale

[897547] = {x = 1927, y = 2793, z = 7},    --Olivine

[897548] = {x = 1514, y = 1009, z = 7},    --Battle City

[897549] = {x = 731, y = 1162, z = 7},    --Pallet

[897550] = {x = 2274, y = 2792, z = 7},    --Violet

[897551] = {x = 2169, y = 2699, z = 7},    --Ecruteak

[897552] = {x = 1631, y = 1055, z = 6},    --Singer

[897553] = {x = 1305, y = 477, z = 7},    --Pvp2

[897554] = {x = 1491, y = 1817, z = 7},    --Newcity

}

function onThingMove(creature, thing, oldpos, oldstackpos)

end

function onCreatureAppear(creature)

end

function onCreatureDisappear(cid, pos)

if focus == cid then

selfSay('Ate mais treinador!')

focus = 0

talk_start = 0

end

end

function onCreatureTurn(creature)

end

function msgcontains(txt, str)

return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))

end

function onCreatureSay(cid, type, msg)

local msg = string.lower(msg)

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

for a, b in pairs(gobackmsgs) do

    local gm = string.gsub(b.go, "doka!", "")

    local bm = string.gsub(b.back, "doka!", "")

if string.find(string.lower(msg), string.lower(gm)) or string.find(string.lower(msg), string.lower(bm)) then

return true

end

end

if((msgcontains(msg, 'hi') or msgcontains(msg, 'heal') or msgcontains(msg, 'help')) and (getDistanceToCreature(cid) <= 3)) then

     if exhaustion.get(cid, 9211) then

    selfSay('Please wait a few moment before asking me to heal your pokemons again!')

    return true

       end

    if not getTileInfo(getThingPos(cid)).protection and nurseHealsOnlyInPZ then

        selfSay("Please, get inside the pokémon center to heal your pokemons!")

    return true

    end

    

    

    for e, f in pairs(posis) do

        local pos = getThingPos(getNpcCid())

        if isPosEqual(pos, f) then

           if getPlayerStorageValue(cid, e) <= -1 then           --alterado v1.7

              setPlayerStorageValue(cid, e, 1)

           end

        end

    end 

    exhaustion.set(cid, 9211, 5)

    doCreatureAddHealth(cid, getCreatureMaxHealth(cid)-getCreatureHealth(cid))

    doCureStatus(cid, "all", true)

    doSendMagicEffect(getThingPos(cid), 14)

    local mypb = getPlayerSlotItem(cid, 8):

    if #getCreatureSummons(cid) >= 1 then

        if not nurseHealsPokemonOut then

            selfSay("Please, return your pokemon to his ball!")

        return true

        end

        local s = getCreatureSummons(cid)[1]

        doCreatureAddHealth(s, getCreatureMaxHealth(s))

        doSendMagicEffect(getThingPos(s), 14)

        doCureStatus(s, "all", false)

        if getPlayerStorageValue(s, 1008) < baseNurseryHappiness then

            setPlayerStorageValue(s, 1008, baseNurseryHappiness)

        end

        if getPlayerStorageValue(s, 1009) > baseNurseryHunger then

            setPlayerStorageValue(s, 1009, baseNurseryHunger)

        end

    else

        if mypb.itemid ~= 0 and isPokeball(mypb.itemid) then  --alterado v1.3

            doItemSetAttribute(mypb.uid, "hp", 1)

            if getItemAttribute(mypb.uid, "hunger") and getItemAttribute(mypb.uid, "hunger") > baseNurseryHunger then

                doItemSetAttribute(mypb.uid, "hunger", baseNurseryHunger)

            end

            for c = 1, 15 do

                local str = "move"..c

                setCD(mypb.uid, str, 0)

            end

            if getItemAttribute(mypb.uid, "happy") and getItemAttribute(mypb.uid, "happy") < baseNurseryHappiness then

                doItemSetAttribute(mypb.uid, "happy", baseNurseryHappiness)

            end

            if getPlayerStorageValue(cid, 17000) <= 0 and getPlayerStorageValue(cid, 17001) <= 0 and getPlayerStorageValue(cid, 63215) <= 0 then

                for a, b in pairs (pokeballs) do

                    if isInArray(b.all, mypb.itemid) then

                       doTransformItem(mypb.uid, b.on)

                    end

                end

            end

        end

    end

    local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)

    local balls = getPokeballsInContainer(bp.uid)

    if #balls >= 1 then

       for _, uid in ipairs(balls) do

           doItemSetAttribute(uid, "hp", 1)

           for c = 1, 15 do

               local str = "move"..c

               setCD(uid, str, 0)   

           end

           if getItemAttribute(uid, "hunger") and getItemAttribute(uid, "hunger") > baseNurseryHunger then

              doItemSetAttribute(uid, "hunger", baseNurseryHunger)

           end

           if getItemAttribute(uid, "happy") and getItemAttribute(uid, "happy") < baseNurseryHappiness then

              doItemSetAttribute(uid, "happy", baseNurseryHappiness)

           end

           local this = getThing(uid)

           for a, b in pairs (pokeballs) do

               if isInArray(b.all, this.itemid) then

                  doTransformItem(uid, b.on)

               end

           end

        end

    end

    selfSay('There you go! You and your pokemons are healthy again.')

    if useKpdoDlls then  --alterado v1.7

       doUpdateMoves(cid)

    end

end

end

Se não der certo tente este outro:

Spoiler

local pokeballs = {

[1] = {effect = 188, on = 11826, use = 11827, off = 11828, all = {11826, 11827, 11828}},

[2] = {effect = 189, on = 11832, use = 11833, off = 11834, all = {11832, 11833, 11834}},

[3] = {effect = 190, on = 11835, use = 11836, off = 11837, all = {11835, 11836, 11837}},

[4] = {effect = 191, on = 11829, use = 11830, off = 11831, all = {11829, 11830, 11831}},

[5] = {effect = 195, on = 10975, use = 10976, off = 10977, all = {10975, 10976, 10977}},    

[6] = {effect = 188, on = 11737, use = 11738, off = 11739, all = {11737, 11738, 11739}},

[7] = {effect = 189, on = 11740, use = 11741, off = 11742, all = {11740, 11741, 11742}},

[8] = {effect = 190, on = 11743, use = 11744, off = 11745, all = {11743, 11744, 11745}},

[9] = {effect = 191, on = 11746, use = 11747, off = 11748, all = {11746, 11747, 11748}},

[10] = {effect = 195, on = 12621, use = 12622, off = 12623, all = {12621, 12622, 12623}},   

function onThingMove(creature, thing, oldpos, oldstackpos)

end

function onCreatureAppear(creature)

end

function onCreatureDisappear(cid, pos)

if focus == cid then

selfSay('Good bye sir!')

focus = 0

talk_start = 0

end

end

function onCreatureTurn(creature)

end

function msgcontains(txt, str)

return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))

end

function onCreatureSay(cid, type, msg)

local msg = string.lower(msg)

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

for a, b in pairs(gobackmsgs) do

    local gm = string.gsub(b.go, "doka!", "")

    local bm = string.gsub(b.back, "doka!", "")

if string.find(string.lower(msg), string.lower(gm)) or string.find(string.lower(msg), string.lower(bm)) then

return true

end

end

if((msgcontains(msg, 'hi') or msgcontains(msg, 'heal') or msgcontains(msg, 'help')) and (getDistanceToCreature(cid) <= 3)) then

     if exhaustion.get(cid, 9211) then

    selfSay('Please wait a few moment before asking me to heal your pokemons again!')

    return true

       end

    if not getTileInfo(getThingPos(cid)).protection and nurseHealsOnlyInPZ then

        selfSay("Please, get inside the pokémon center to heal your pokemons!")

    return true

    end

    exhaustion.set(cid, 9211, 5)

    doCreatureAddHealth(cid, getCreatureMaxHealth(cid)-getCreatureHealth(cid))

    doCureStatus(cid, "all", true)

    doSendMagicEffect(getThingPos(cid), 132)

    local mypb = getPlayerSlotItem(cid, 8):

    if #getCreatureSummons(cid) >= 1 then

        if not nurseHealsPokemonOut then

            selfSay("Please, return your pokemon to his ball!")

        return true

        end

        local s = getCreatureSummons(cid)[1]

        doCreatureAddHealth(s, getCreatureMaxHealth(s))

        doSendMagicEffect(getThingPos(s), 13)

        doCureStatus(s, "all", false)

        if getPlayerStorageValue(s, 1008) < baseNurseryHappiness then

            setPlayerStorageValue(s, 1008, baseNurseryHappiness)

        end

        if getPlayerStorageValue(s, 1009) > baseNurseryHunger then

            setPlayerStorageValue(s, 1009, baseNurseryHunger)

        end

    else

        if mypb.itemid >= 1 then

        doItemSetAttribute(mypb.uid, "hp", 1)

            if getItemAttribute(mypb.uid, "hunger") and getItemAttribute(mypb.uid, "hunger") > baseNurseryHunger then

                doItemSetAttribute(mypb.uid, "hunger", baseNurseryHunger)

            end

            if getItemAttribute(mypb.uid, "happy") and getItemAttribute(mypb.uid, "happy") < baseNurseryHappiness then

                doItemSetAttribute(mypb.uid, "happy", baseNurseryHappiness)

            end

            if getPlayerStorageValue(cid, 17000) <= 0 and getPlayerStorageValue(cid, 17001) <= 0 and getPlayerStorageValue(cid, 63215) <= 0 then

                for a, b in pairs (pokeballs) do

                    if isInArray(b.all, mypb.itemid) then

                    doTransformItem(mypb.uid, b.on)

                    end

                end

            end

        end

    end

    local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)

for balls = 1, 9 do

    for times = 1, 3 do

        local items = getItemsInContainerById(bp.uid, pokeballs[balls].all[times]) 

            if #items >= 1 then

                for _, uid in pairs(items) do

                doItemSetAttribute(uid, "hp", 1)

                doTransformItem(uid, pokeballs[balls].on)

                    if getItemAttribute(uid, "hunger") and getItemAttribute(uid, "hunger") > baseNurseryHunger then

                        doItemSetAttribute(uid, "hunger", baseNurseryHunger)

                    end

                    if getItemAttribute(uid, "happy") and getItemAttribute(uid, "happy") < baseNurseryHappiness then

                        doItemSetAttribute(uid, "happy", baseNurseryHappiness)

                    end

                end

            end

    end

end

 

selfSay('There you go! You and your pokemons are healthy again.')

end

end

 

 

Se não der certo cara já não sei o que é, mais mande o seu 050-function.lua talvez esteja faltando algo nele ...

Editado por nedroesdoksdja
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...