BO

[Encerrado] Gym System erro

Por boxxer321, 14 de nov. de 2017 em Tópicos Sem Resposta

13
2.5k
boxxer321B
14 de novembro de 2017 às 16:44

Fala galera...

Resolvi tentar fazer o gym system funcionar aqui no meu servidor, mas preciso saber o que ta dando esse erro aqui:

 

Spoiler

[14/11/2017 16:37:07] [Error - Npc interface] 
[14/11/2017 16:37:08] In a timer event called from: 
[14/11/2017 16:37:08] data/npc/scripts/brock.lua:onCreatureSay
[14/11/2017 16:37:08] Description: 
[14/11/2017 16:37:08] data/npc/scripts/brock.lua:44: attempt to get length of global 'gobackmsgs' (a nil value)
[14/11/2017 16:37:08] stack traceback:
[14/11/2017 16:37:08]     data/npc/scripts/brock.lua:44: in function <data/npc/scripts/brock.lua:21>

[14/11/2017 16:37:10] [Error - CreatureScript Interface] 
[14/11/2017 16:37:11] data/creaturescripts/scripts/gym.lua:onDeath
[14/11/2017 16:37:11] Description: 
[14/11/2017 16:37:11] data/lib/gymLib.lua:2: attempt to get length of global 'gobackmsgs' (a nil value)
[14/11/2017 16:37:11] stack traceback:
[14/11/2017 16:37:11]     data/lib/gymLib.lua:2: in function 'returnPokeNpc'
[14/11/2017 16:37:11]     data/creaturescripts/scripts/gym.lua:9: in function <data/creaturescripts/scripts/gym.lua:7>

 

alguém?

PoccnnP
15 de novembro de 2017 às 18:39

ele não encontrou esse tal de gobackmsgs. não sei o que é, mas é preciso ele para funcionar.

 

Verifica se ele existe e se o termo está correto.

boxxer321B
15 de novembro de 2017 às 20:42
1 hora atrás, Poccnn disse:

ele não encontrou esse tal de gobackmsgs. não sei o que é, mas é preciso ele para funcionar.

 

Verifica se ele existe e se o termo está correto.

ele ficaria no script do brock? ou lib/gym?

ShiroeS
15 de novembro de 2017 às 23:15

Ela fica no arquivo gymLib.lua tanto que no erro seguinte ele mostra o porque da função estar dando erro:

[14/11/2017 16:37:10] [Error - CreatureScript Interface] 
[14/11/2017 16:37:11] data/creaturescripts/scripts/gym.lua:onDeath
[14/11/2017 16:37:11] Description: 
[14/11/2017 16:37:11] data/lib/gymLib.lua:2: attempt to get length of global 'gobackmsgs' (a nil value)
[14/11/2017 16:37:11] stack traceback:
[14/11/2017 16:37:11]     data/lib/gymLib.lua:2: in function 'returnPokeNpc'
[14/11/2017 16:37:11]     data/creaturescripts/scripts/gym.lua:9: in function <data/creaturescripts/scripts/gym.lua:7>

Esta faltando a função returnPokeNpc também, esse erro esta dando toda vez que o pokémon do npc morre né?

boxxer321B
16 de novembro de 2017 às 00:58
1 hora atrás, Rookie disse:

Ela fica no arquivo gymLib.lua tanto que no erro seguinte ele mostra o porque da função estar dando erro:

[14/11/2017 16:37:10] [Error - CreatureScript Interface] 
[14/11/2017 16:37:11] data/creaturescripts/scripts/gym.lua:onDeath
[14/11/2017 16:37:11] Description: 
[14/11/2017 16:37:11] data/lib/gymLib.lua:2: attempt to get length of global 'gobackmsgs' (a nil value)
[14/11/2017 16:37:11] stack traceback:
[14/11/2017 16:37:11]     data/lib/gymLib.lua:2: in function 'returnPokeNpc'
[14/11/2017 16:37:11]     data/creaturescripts/scripts/gym.lua:9: in function <data/creaturescripts/scripts/gym.lua:7>

Esta faltando a função returnPokeNpc também, esse erro esta dando toda vez que o pokémon do npc morre né?

exatamente, logo depois que o pokémon do gym morre.

eu já tentei de tudo aqui, mas sem sucesso...

Isso era para aquela base que falei contigo por privado, que postaria aqui.

2 semanas depois...
ShiroeS
23 de novembro de 2017 às 12:16

@boxxer321 Poste seu gymLib.lua por gentileza, caso já tenha arrumado esse bug desconsidere este post.

boxxer321B
23 de novembro de 2017 às 15:44
3 horas atrás, Rookie disse:

@boxxer321 Poste seu gymLib.lua por gentileza, caso já tenha arrumado esse bug desconsidere este post.

https://mega.nz/#!5xARDT7B!dn6rEkJDtamYfEMJJyGN4HyTgnmPuATsn6JbNV0sh9k

 

desculpe postar por link, mas no momento estou pelo celular ;(

ShiroeS
23 de novembro de 2017 às 17:07

Eu não cheguei a testar, mas creio que seja isso que esteja faltando:

gobackmsgs = {
[1] = {back = "Come back, doka!"},
[2] = {back = "Thanks for helping, doka!"},
[3] = {back = "That's enough, come back!"},
[4] = {back = "You were great, doka!"},
[5] = {back = "Excellent work, doka!"},
[6] = {back = "Well done, doka!"},
[7] = {back = "You need to rest, doka!"},
[8] = {back = "Hurry back, doka!"},
[9] = {back = "You did your best, doka!"}
}

function returnPokeNpc(summon, npc)
	local msgba = gobackmsgs[math.random(1, #gobackmsgs)].back:gsub("doka", getCreatureName(summon))
	local balleffect = pokeballs["normal"].effect

	doSendMagicEffect(getThingPos(summon), balleffect)
	doCreatureSay(npc, msgba, 1)

	doRemoveCreature(summon)
end

Você esta usando a base do Pokemon Dash Revolution V10?

Editado Novembro 23 por Rookie

Um pequeno erro no começo do script!

boxxer321B
28 de novembro de 2017 às 11:56
Em 23/11/2017 at 17:07, Rookie disse:

Eu não cheguei a testar, mas creio que seja isso que esteja faltando:

gobackmsgs = {
[1] = {back = "Come back, doka!"},
[2] = {back = "Thanks for helping, doka!"},
[3] = {back = "That's enough, come back!"},
[4] = {back = "You were great, doka!"},
[5] = {back = "Excellent work, doka!"},
[6] = {back = "Well done, doka!"},
[7] = {back = "You need to rest, doka!"},
[8] = {back = "Hurry back, doka!"},
[9] = {back = "You did your best, doka!"}
}

function returnPokeNpc(summon, npc)
	local msgba = gobackmsgs[math.random(1, #gobackmsgs)].back:gsub("doka", getCreatureName(summon))
	local balleffect = pokeballs["normal"].effect

	doSendMagicEffect(getThingPos(summon), balleffect)
	doCreatureSay(npc, msgba, 1)

	doRemoveCreature(summon)
end

Você esta usando a base do Pokemon Dash Revolution V10?

desculpe a demora, fiquei sem computador para testar... irei testar e edito!

respondendo sua pergunta, não, uso a base do deglorio, porém, um amigo tirou o gym e estou tentando por denovo :)

 

 

EDIT: Deu esse erro agora 

Spoiler

[28/11/2017 12:27:40] [Error - Npc interface] 
[28/11/2017 12:27:40] In a timer event called from: 
[28/11/2017 12:27:40] data/npc/scripts/brock.lua:onCreatureSay
[28/11/2017 12:27:40] Description: 
[28/11/2017 12:27:40] data/npc/scripts/brock.lua:44: attempt to index field 'go' (a nil value)
[28/11/2017 12:27:41] stack traceback:
[28/11/2017 12:27:41]     data/npc/scripts/brock.lua:44: in function <data/npc/scripts/brock.lua:21>

 

script npc brock:

 

Spoiler

local focus = 0
local max_distance = 8
local talk_start = 0
local conv = 0
local fighting = false
local challenger = 0
local afk_limit_time = 30    -- seconds
local afk_time = 0        -- don't change
local battle_turn = 1        -- don't change
local challenger_turn = 0    -- don't change

local pokemons = {
{name = "Geodude", level = 28, extralevel = 12, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Rhyhorn", level = 27, extralevel = 17, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Graveler", level = 31, extralevel = 19, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Onix", level = 40, extralevel = 12, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Golem", level = 38, extralevel = 18, sex = SEX_MALE, nick = "Golemniso", ball = "normal"},
}


local function doSummonGymPokemon(npc)
    battle_turn = battle_turn + 1
    local this = npc
    if #getCreatureSummons(this) >= 1 or focus == 0 then return true end
    local it = pokemons[battle_turn]
    pokeNpc = doSummonCreature(it.name, getThingPos(this))
    local summon = getCreatureSummons(this)[1]
    local balleffect = pokeballs["normal"].effect
    if it.ball and pokeballs[it.ball] then
        balleffect = pokeballs[it.ball].effect
    end
    doSendMagicEffect(getThingPos(pokeNpc), balleffect)

    setPlayerStorageValue(pokeNpc, 990, this)
    setPlayerStorageValue(pokeNpc, 991, "battle")
    setPlayerStorageValue(pokeNpc, 8595, 1)
    registerCreatureEvent(pokeNpc, "Gym1")
    registerCreatureEvent(pokeNpc, "Gym2")
    registerCreatureEvent(pokeNpc, "Gym3")
    registerCreatureEvent(pokeNpc, "Gym4")
    registerCreatureEvent(pokeNpc, "Gym5")
    setPlayerStorageValue(this, 990, 1)
    addEvent(adjustWildPoke, 15, pokeNpc, it.optionalLevel)
    mgo = gobackmsgs[math.random(1, #gobackmsgs)].go:gsub("doka", it.name)
    doCreatureSay(this, mgo, 1)
    fighting = true
end

local function doWinDuel(cid, npc)
    if not isCreature(cid) then return true end
    local this = npc
    local a = gymbadges[getCreatureName(this)] + 8
    doCreatureSay(npc, "You won the duel! Congratulations, take this "..getItemNameById(a - 8).." as a prize.", 1)
    local b = getPlayerItemById(cid, true, a)
    if b.uid > 0 then doTransformItem(b.uid, b.itemid - 8) end
    doPlayerSendCancel(cid, "#getBadges# "..getCreatureName(this).." "..getPlayerItemCount(cid, gymbadges[getCreatureName(this)]))
end

function onCreatureSay(cid, type, msg)
    local msg = string.lower(msg)

    if focus == cid then
        talk_start = os.clock()
    end

    if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) <= 4 then
        focus = cid
        talk_start = os.clock()
        conv = 1
        selfSay("Hello "..getCreatureName(cid)..", my name is Blaine and I'm Cinnabar's Gym Leader. How may I help you?")
        return true
    end

    if isDuelMsg(msg) and conv == 1 and focus == cid then
        if getPlayerItemCount(cid, gymbadges[getCreatureName(getThis())]) >= 1 then
            selfSay("You have already won my Volcano Badge, maybe some other day we can fight.")
            focus = 0
        return true
        end

         if not hasPokemon(cid) then
             selfSay("To battle agains't a gym leader you need pokemons.")
        return true
         end

        selfSay("You are challenging me to a battle. It will be a "..#pokemons.." pokemon limit battle, let's start?")
        conv = 2

    return true
    end

    if isConfirmMsg(msg) and conv == 2 and focus == cid then
        challenger = focus
        setPlayerStorageValue(cid, 990, 1)
        setPlayerStorageValue(cid, 999, 1)
        if #getCreatureSummons(cid) >= 1 then
        local pk = getCreatureSummons(cid)[1]
        setPlayerStorageValue(pk, 990, 1)
        end
        selfSay("Yea, let's fight!")
        talk_start = os.clock()
        setPlayerStorageValue(getThis(), 990, 1)
        addEvent(doSummonGymPokemon, 5, getThis())
        conv = 3
    return true
    end

    if isNegMsg(msg) and conv == 2 and focus == cid then
        focus = 0
        selfSay("It is better for you to refuse a battle against me!")
    return true
    end

    local function doRemove(npc)
    local it = pokemons[battle_turn]
        local balleffect = pokeballs["normal"].effect
    if it.ball and pokeballs[it.ball] then
        balleffect = pokeballs[it.ball].effect
    end
    doSendMagicEffect(getThingPos(pokeNpc), balleffect)
    doRemoveCreature(pokeNpc)
    end

    if msgcontains(msg, 'bye') and focus == cid then
        selfSay('Bye and do your best trainer!')
        setPlayerStorageValue(focus, 990, -1)
        setPlayerStorageValue(focus, 999, -1)
        if #getCreatureSummons(focus) >= 1 then
        local pk = getCreatureSummons(focus)[1]
        setPlayerStorageValue(pk, 990, -1)
        end
    doSendMagicEffect(getThingPos(pokeNpc), balleffect)
    doRemoveCreature(pokeNpc)
        focus = 0
    return true
    end
end

local afk_warning = false

function checkPoke(player, poke)

end

function onThink()

    if focus == 0 then
        selfTurn(2)
        fighting = false
        challenger = 0
        challenger_turn = 0
        battle_turn = 0
        afk_time = 0
        afk_warning = false
        setPlayerStorageValue(getThis(), 990, -1)
        return true
    else
        if not isCreature(focus) then
            focus = 0
            return true
        end
        if fighting then
            talk_start = os.clock()

            if #getCreatureSummons(challenger) >= 1 then
                if pokeChalenger == nil then
                    pokeChalenger = getCreatureName(getCreatureSummons(challenger)[1])
                    afk_time = 0
                    challenger_turn = challenger_turn + 1
                elseif pokeChalenger == getCreatureName(getCreatureSummons(challenger)[1]) then
                    afk_time = 0
                else
                    afk_time = 0
                    challenger_turn = challenger_turn + 1
                    pokeChalenger = getCreatureName(getCreatureSummons(challenger)[1])
                end
            else
                    afk_time = afk_time + 0.5
            end

            if afk_time > afk_limit_time then
                setPlayerStorageValue(focus, 990, -1)
        setPlayerStorageValue(focus, 999, -1)
        doRemoveCreature(pokeNpc)
                                  focus = 0
                selfSay("I have waited too long, come back when you are ready!")
            return true
            end

            if not afk_warning and afk_time > afk_limit_time / 2 then
                selfSay("Where's your pokemon? Let's fight!")
                afk_warning = true
            end


            if getPlayerStorageValue(getThis(), 990) == -1 then
                if battle_turn >= #pokemons then
                    addEvent(doWinDuel, 1000, focus, getThis())
                    setPlayerStorageValue(focus, 990, -1)
                    focus = 0
                return true
                end
                setPlayerStorageValue(getThis(), 990, 1)
                addEvent(doSummonGymPokemon, 1000, getThis())
            end

            if challenger_turn >= 7 or challenger_turn > #pokemons then
                selfSay("You lost our duel! Maybe some other time you'll defeat me.")
                setPlayerStorageValue(focus, 990, -1)
                focus = 0
            return true
            end
        end

        local npcpos = getThingPos(getThis())
        local focpos = getThingPos(focus)

        if npcpos.z ~= focpos.z then
            setPlayerStorageValue(focus, 990, -1)
            focus = 0
            selfSay("Bye then.")
            return true
        end

        if (os.clock() - talk_start) > 30 then
            selfSay("Good bye and keep training!")
            setPlayerStorageValue(focus, 990, -1)
            focus = 0
        end

        if getDistanceToCreature(focus) > max_distance then
            setPlayerStorageValue(focus, 990, -1)
        setPlayerStorageValue(focus, 999, -1)
            if #getCreatureSummons(focus) >= 1 then
        local pk = getCreatureSummons(focus)[1]
        setPlayerStorageValue(pk, 990, -1)
        end
        doRemoveCreature(pokeNpc)
            focus = 0
    selfSay("You were strong enough to win this battle!")
        return true
        end

        local dir = doRedirectDirection(getDirectionTo(npcpos, focpos))
        selfTurn(dir)
    end
return true
end
 

 

Editado Novembro 28 por boxxer321

DrakopoulosD
29 de novembro de 2017 às 02:51

A table q o script esta pedindo é essa

gobackmsgs = {
	[1] = {go = "Go, doka!", back = "Come back, doka!"},
	[2] = {go = "Let's do it, doka!", back = "Thanks for helping, doka!"},
	[3] = {go = "I choose you, doka!", back = "That's enough, come back!"},
	[4] = {go = "I need your help, doka!", back = "You were great, doka!"},
	[5] = {go = "Let's fight, doka!", back = "Excellent work, doka!"},
	[6] = {go = "It's battle time, doka!", back = "Well done, doka!"},
	[7] = {go = "It's your turn, doka!", back = "You need to rest, doka!"},
	[8] = {go = "doka, let's battle!", back = "Hurry back, doka!"},
	[9] = {go = "Show your strength, doka!", back = "You did your best, doka!"}
}

Geralmente ela fica no configuration.lua

boxxer321B
03 de dezembro de 2017 às 15:04
Em 29/11/2017 at 02:51, Drakopoulos disse:

A table q o script esta pedindo é essa

gobackmsgs = {
	[1] = {go = "Go, doka!", back = "Come back, doka!"},
	[2] = {go = "Let's do it, doka!", back = "Thanks for helping, doka!"},
	[3] = {go = "I choose you, doka!", back = "That's enough, come back!"},
	[4] = {go = "I need your help, doka!", back = "You were great, doka!"},
	[5] = {go = "Let's fight, doka!", back = "Excellent work, doka!"},
	[6] = {go = "It's battle time, doka!", back = "Well done, doka!"},
	[7] = {go = "It's your turn, doka!", back = "You need to rest, doka!"},
	[8] = {go = "doka, let's battle!", back = "Hurry back, doka!"},
	[9] = {go = "Show your strength, doka!", back = "You did your best, doka!"}
}

Geralmente ela fica no configuration.lua

então seria apenas adicionar isso em qualquer parte do configuration.lua que funciona?

 

desculpa mas não posso testar agora :(

3 semanas depois...
boxxer321B
20 de dezembro de 2017 às 12:19

Funcionou @Drakopoulos! Muito Obrigado!

4 meses depois...
StigalS
19 de abril de 2018 às 17:12
A questão neste tópico de suporte foi encerrada por falta de resposta. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta