Ir para conteúdo
  • Cadastre-se

[Resolvido] Erro corpse poketibia


Posts Recomendados

Fiz o evento Spawn na source funcinou perfeitamente, mais o corpse continua sem level.

Script: look.lua

str = "You see a "..string.lower(iname.name).." ["..getItemAttribute(thing.uid, "level").."].\n"
Esta é a parte que dá erro. Se eu tiro a parte:
["..getItemAttribute(thing.uid, "level").."].
Funciona o Look nos corpse, mais ele não mostra o level e o gender se tipo o pokémon for male ou female quando morre o corpse fica como gerderless (sem sexo). Script da parte do look do corpse:
doItemSetAttribute(corpse.uid, "gender", getPokemonGender(cid))
Ele faz oq eu imaginava fez com que o corpse perde-se o atributo gender, que acontecia no meu server que pegava e fazia que tanto o pokémon macho ou fêmea quando morre-se(fosse derotado) acabasse ficando genderless(sem sexo). Dai fiz outro teste onde tirei a parte:
doItemSetAttribute(corpse.uid, "level", getLevel(cid))

doItemSetAttribute(corpse.uid, "gender", getPokemonGender(cid))
Aconteceu que quando dei Look (olhar) no corpse o server acusou esta linha:
for _, uid in pairs (pokes) do
Que está no arquivo da função onDeath. Atualizando: Achei está parte falando da tag -for _, uid in pairs (pokes) do- :
for a, b in pairs (pokes) do

    local dir = "data/monster/pokes/"..a..".xml"

    print(dir)

    local file = io.open(dir, "a+")

    local text = file:read("*all")

    file:close()


    local a, b = text:find("targetchange interval")


    local wtw1 = string.sub(text, 1, b)

    wtw1 = wtw1..'="10000" chance="0"/>\n'


    local c, d = a:find("strategy attack")


    wtw1 = wtw1..''..string.sub(text, c-1, 9999999)..''


    local e, f = wtw1:find("</monster>")


    wtw1 = string.sub(wtw1, 1, e-1)..'<script>\n<event name="Exp"/>\n<event name="Experience"/>\n<event name="Wild1"/>\n<event name="Wild2"/>\n<event name="Wild3"/>\n</script>\n</monster>'


    local arq = io.open(dir, "w")

    arq:write(wtw1)

    arq:close()

end
Arquivo completo: Local: talkactions/script/old.lua Onde não achei no talckactions.xml para colocar a tag para fazer funcionar o arquivo old.lua

Alguém sabe oq faz para isso parar de acontecer?

 	 elseif string.find(iname.name, "fainted") or string.find(iname.name, "derotado") then


str = "You see a "..string.lower(iname.name).." ["..getItemAttribute(thing.uid, "level").."].\n"


if getItemAttribute(thing.uid, "gender") == SEX_MALE then

str = str.."It is male."

elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then

str = str.."It is female."

else

str = str.."It is genderless."

end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)


return false


else


return true


end
Arquivo que faz o onDeath:
function onDeath(cid, corpse, deathList)


--if not isCreature(cid) then return true end

if isSummon(cid) or not deathList or corpse.itemid == 0 or getCreatureName(cid) == "Evolution" then return true end


-------------Edited Golden Arena-------------------------

if getPlayerStorageValue(cid, 22546) == 1 then

	 setGlobalStorageValue(22548, getGlobalStorageValue(22548)-1)

	 doItemSetAttribute(corpse.uid, "golden", 1) --alterado v2.6

end																												 --alterado v2.4

if getPlayerStorageValue(cid, 22546) == 1 and (getGlobalStorageValue(22547) == -1 or getGlobalStorageValue(22547) == #wavesGolden+1) and getGlobalStorageValue(22548) <= 0 then

	 for _, sid in ipairs(getPlayersOnline()) do

		 if getPlayerStorageValue(sid, 22545) == 1 then

			 doPlayerSendTextMessage(sid, 20, "You have win the golden arena! Take your reward!")

			 doPlayerAddItem(sid, 2152, 100) --premio

			 setPlayerStorageValue(sid, 22545, -1)

			 doTeleportThing(sid, getClosestFreeTile(sid, posBackGolden), false) --alterado v2.4

		 end															 --nao esqueçam de fazer as alteraçoes no lib/configuration.lua!!

	 end

end

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


local givenexp = getWildPokemonExp(cid)

local expstring = ""..cid.."expEx"

local killer = getItemAttribute(corpse.uid, "corpseowner")


if givenexp > 0 then

for a = 1, #deathList do

local pk = deathList[a]

if isCreature(pk) then

playerAddExp(pk, math.floor(playerExperienceRate * givenexp))

local firstball = getPlayerSlotItem(pk, 8)


if firstball and getItemAttribute(firstball.uid, expstring) and getItemAttribute(firstball.uid, expstring) > 0 then

local percent = getItemAttribute(firstball.uid, expstring) <= 1 and getItemAttribute(firstball.uid, expstring) or 1

local gainexp = math.ceil(percent * givenexp)

doItemSetAttribute(firstball.uid, expstring, 0)

givePokemonExp(pk, firstball, gainexp)

end


for b = 1, #balls do

local pokes = getItemsInContainerById(getPlayerSlotItem(pk, 3).uid, balls[b])

if #pokes >= 1 then

for _, uid in pairs (pokes) do

if getItemAttribute(uid, expstring) and getItemAttribute(uid, expstring) > 0 then

local percent = getItemAttribute(uid, expstring) <= 1 and getItemAttribute(uid, expstring) or 1

local gainexp = math.ceil(percent * givenexp)

doItemSetAttribute(uid, expstring, 0)

givePokemonExpInBp(pk, uid, gainexp, balls[b])

end

end

end

end

end

end

end


if isNpcSummon(cid) then

local master = getCreatureMaster(cid)

doSendMagicEffect(getThingPos(cid), getPlayerStorageValue(cid, 10000))

doCreatureSay(master, getPlayerStorageValue(cid, 10001), 1)

doRemoveCreature(cid)

return false

end



doItemSetAttribute(corpse.uid, "offense", getPlayerStorageValue(cid, 1011))

doItemSetAttribute(corpse.uid, "defense", getPlayerStorageValue(cid, 1012))

doItemSetAttribute(corpse.uid, "speed", getPlayerStorageValue(cid, 1013))

doItemSetAttribute(corpse.uid, "vitality", getPlayerStorageValue(cid, 1014))

doItemSetAttribute(corpse.uid, "spattack", getPlayerStorageValue(cid, 1015))

doItemSetAttribute(corpse.uid, "level", getLevel(cid))

doItemSetAttribute(corpse.uid, "gender", getPokemonGender(cid))

return true

end
Fiz um teste em um servidor que funciona perfeitamente! Tirei a parte:
local function getPokemonmove(name, number)

    local x = movestable[name]

        if not x then return {} end

    local y = {}


    if number == 1 then

        y = x.move1

    elseif number == 2 and x.move2 then

        y = x.move2

    elseif number == 3 and x.move3 then

        y = x.move3

    elseif number == 4 and x.move4 then

        y = x.move4

    elseif number == 5 and x.move5 then

        y = x.move5

    elseif number == 6 and x.move6 then

        y = x.move6

    elseif number == 7 and x.move7 then

        y = x.move7

    elseif number == 8 and x.move8 then

        y = x.move8

    elseif number == 9 and x.move9 then

        y = x.move9

    elseif number == 10 and x.move10 then

        y = x.move10

    elseif number == 11 and x.move11 then

        y = x.move11

    elseif number == 12 and x.move12 then

        y = x.move12

    elseif number == 13 and x.move13 then

        y = x.move13

    elseif number == 14 and x.move14 then

        y = x.move14

    elseif number == 15 and x.move15 then

        y = x.move15

    end


return y

end


local function doRegisterSpells()


local dir = "data/spells/scripts/ps/"

local gn = "data/spells/spells.xml"


local nb = 0


for taa, tb in pairs (movesinfo) do

    local ta = taa

        if ta == "Invisible" then

            ta = "GhostInvisible"

        end

    print("Doing move: "..ta..".")

    local a = io.open(dir..""..ta..".lua", "w")

    local b = 'function onCastSpell(cid, var)\n\n    if isSummon(cid) then return true end\n\n    docastspell(cid, "'..ta..'")\n\nreturn true\nend'

    a:write(b)

    a:close()

    --local f = '\n    <instant name="'..ta..'" words="spell'..threeNumbers(nb)..'" lvl="1000" mana="0" event="script" value="ps/'..ta..'.lua"></instant>\n'

    --local d = io.open(gn, "a+")

    --local e = d:read("*all")

    --d:close()

    --e = e..""..f..""

    --local g = io.open(gn, "w")

    --g:write(e)

    --g:close()

    --nb = nb + 1

end


end



local function doRegisterMonsterSpells()

for a = 1, 151 do

    local poke = oldpokedex[a][1]

    --print("Doing Monster: "..poke..".")

    local final = ""

    local mdir = "data/monster/pokes/"..poke..".xml"

    local b = io.open(mdir, "a+")

    local c = b:read("*all")

    b:close()

    local d, e = c:find("<attacks>(.-)</attacks>")

    if not d or not e then print("error") end

    local f1 = string.sub(c, 1, d-1)

    local f2 = string.sub(c, e+1, string.len(c))

        local rum, rdo = c:find('<flag targetdistance="(.-)"/>')

        local rang = string.sub(c, rum + 22, rdo - 3)

        local meleeatk = '	    <attack name="melee" interval="2000" chance="100" range="1" min="-50" max="-100">  </attack>'

        local rangeatk = '	    <attack name="physical" interval="2000" chance="100" range="'..tonumber(rang) + (1)..'" min="-50" max="-100">\n	    <attribute key="shootEffect" value="eartharrow"/>\n	    </attack>'

        final = rang == "1" and meleeatk or rangeatk

        final = "<attacks>\n"..final..""

    for tries = 1, 15 do

        local h = getPokemonmove(poke, tries)

            if h.name then


                local extradelay = 1

                local name = h.name ~= "Invisible" and h.name or "GhostInvisible"

                    if movesinfo[h.name].f <= 0 then

                        extradelay = 3

                    end

                local chance = 12/extradelay + math.floor(22 - h.cd / 3.5)

                local delay = 2100 + 47 * h.cd * extradelay

                local range = h.target == 1 and h.dist or "6"

                if tonumber(rang) >= tonumber(range) and tonumber(range) ~= 1 then

                    range = tonumber(rang) + 2

                end

                local text = '\n	    <attack name="'..name..'" interval="'..delay..'" chance="'..chance..'" range="'..range..'">\n	    </attack>'

                final = final..""..text..""

            end

    end

    final = final..'\n</attacks>'

    local write = f1..''..final..''..f2..''

    local i = io.open(mdir, "w")

    i:write(write)

    i:close()

end

end



for a, b in pairs (pokes) do

    local dir = "data/monster/pokes/"..a..".xml"

    print(dir)

    local file = io.open(dir, "a+")

    local text = file:read("*all")

    file:close()


    local a, b = text:find("targetchange interval")


    local wtw1 = string.sub(text, 1, b)

    wtw1 = wtw1..'="10000" chance="0"/>\n'


    local c, d = a:find("strategy attack")


    wtw1 = wtw1..''..string.sub(text, c-1, 9999999)..''


    local e, f = wtw1:find("</monster>")


    wtw1 = string.sub(wtw1, 1, e-1)..'<script>\n<event name="Exp"/>\n<event name="Experience"/>\n<event name="Wild1"/>\n<event name="Wild2"/>\n<event name="Wild3"/>\n</script>\n</monster>'


    local arq = io.open(dir, "w")

    arq:write(wtw1)

    arq:close()

end


end


Editado por danieuu (veja o histórico de edições)

Se viu o GOSTEI aqui em cima?

Então clica =D

Música:

http://www.youtube.com/watch?v=wzqdVJK5rCY&feature=player_detailpage

:D

Aposto que você gostou da que tá tocando guitarra

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

Mapper: 80% -aprendendo-

Scripter: 50% -aprendendo-

Spriter: 70% -aprendendo-

Notepad ++: 90% -enceramento-

Hex Editor: 85% -aprendendo-

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

Pokemon Friend

pikachu.gif

Link para o post
Compartilhar em outros sites

Dúvida sanada, só coloquei a parte que falei e funcionou perfeitamente.

Reportado!

Editado por danieuu (veja o histórico de edições)

Se viu o GOSTEI aqui em cima?

Então clica =D

Música:

http://www.youtube.com/watch?v=wzqdVJK5rCY&feature=player_detailpage

:D

Aposto que você gostou da que tá tocando guitarra

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

Mapper: 80% -aprendendo-

Scripter: 50% -aprendendo-

Spriter: 70% -aprendendo-

Notepad ++: 90% -enceramento-

Hex Editor: 85% -aprendendo-

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

Pokemon Friend

pikachu.gif

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo