Ir para conteúdo
  • 0

Erro Shiny Stone


LionM

Pergunta

Erro Distro:

[28/07/2016 18:30:35] [Error - Action Interface] 
[28/07/2016 18:30:35] data/actions/scripts/Shiny stone.lua:onUse
[28/07/2016 18:30:35] Description: 
[28/07/2016 18:30:35] data/actions/scripts/Shiny stone.lua:121: attempt to index global 'getPokeballs' (a nil value)
[28/07/2016 18:30:35] stack traceback:
[28/07/2016 18:30:36]     data/actions/scripts/Shiny stone.lua:121: in function <data/actions/scripts/Shiny stone.lua:102>
 

Erro Game: Usa uma shiny stone a menos

 

Script:

local evo = {
["Snorlax"] = {"Big Snorlax", 7},
["Onix"] = {"Crystal Onix", 6},
["Charizard"] = {"Elder Charizard", 8},
["Abomasnow"] = {"Shiny Abomasnow", 8},
["Abra"] = {"Shiny Abra", 2},
["Aerodactyl"] = {"Shiny Aerodactyl", 7},
["Aggron"] = {"Shiny Aggron", 8},
["Aipom"] = {"Shiny Aipom", 3},
["Alakazam"] = {"Shiny Alakazam", 8},
["Arbok"] = {"Shiny Arbok", 6},
["Arcanine"] = {"Shiny Arcanine", 6},
["Aron"] = {"Shiny Aron", 2},
["Beautifly"] = {"Shiny Beautifly",4},
["Beedrill"] = {"Shiny Beedrill", 4},
["Blastoise"] = {"Shiny Blastoise", 8},
["Breloom"] = {"Shiny Breloom", 5},
["Butterfree"] = {"Shiny Butterfree", 5},
["Cacnea"] = {"Shiny Cacnea", 2},
["Cacturne"] = {"Shiny Cacturne", 5},
["Camerupt"] = {"Shiny Camerupt", 6},
["Carnivine"] = {"Shiny Carnivine", 6},
["Caterpie"] = {"Shiny Caterpie", 2},
["Chansey"] = {"Shiny Chansey", 5},
["Clefable"] = {"Shiny Clefable", 7},
["Cloyster"] = {"Shiny Cloyster", 5},
["Corsola"] = {"Shiny Corsola", 4},
["Crobat"] = {"Shiny Crobat", 7},
["Cubone"] = {"Shiny Cubone", 2},
["Delcatty"] = {"Shiny Delcatty", 5},
["Ditto"] = {"Shiny Ditto", 7},
["Dragonair"] = {"Shiny Dragonair", 4},
["Dragonite"] = {"Shiny Dragonite", 8},
["Dratini"] = {"Shiny Dratini", 2},
["Drifblim"] = {"Shiny Drifblim", 6},
["Drowzee"] = {"Shiny Drowzee", 4},
["Dustox"] = {"Shiny Dustox", 4},
["Ekans"] = {"Shiny Ekans", 3},
["Electabuzz"] = {"Shiny Electabuzz", 4},
["Electrode"] = {"Shiny Electrode", 5},
["Farfetch'd"] = {"Shiny Farfetch'd", 3},
["Fearow"] = {"Shiny Fearow", 6},
["Feraligatr"] = {"Shiny Feraligatr", 8},
["Flareon"] = {"Shiny Flareon", 6},
["Flygon"] = {"Shiny Flygon", 9},
["Garchomp"] = {"Shiny Garchomp", 12},
["Gardevoir"] = {"Shiny Gardevoir", 7},
["Gengar"] = {"Shiny Gengar", 8},
["Golbat"] = {"Shiny Golbat", 4},
["Golem"] = {"Shiny Golem", 6},
["Grimer"] = {"Shiny Grimer", 3},
["Growlithe"] = {"Shiny Growlithe", 3},
["Gyarados"] = {"Shiny Gyarados", 8},
["Hitmonchan"] = {"Shiny Hitmonchan", 6},
["Hitmonlee"] = {"Shiny Hitmonlee", 6},
["Horsea"] = {"Shiny Horsea", 2},
["Jynx"] = {"Shiny Jynx", 7},
["Kingler"] = {"Shiny Kingler", 5},
["Krabby"] = {"Shiny Krabby", 2},
["Magikarp"] = {"Shiny Magikarp", 1},
["Magmar"] = {"Shiny Magmar", 5},
["Marowak"] = {"Shiny Marowak", 5},
["Metagross"] = {"Shiny Metagross", 10},
["Milotic"] = {"Shiny Milotic", 8},
["Muk"] = {"Shiny Muk", 6},
["Ninetales"] = {"Shiny Ninetales", 6},
["Oddish"] = {"Shiny Oddish", 2},
["Paras"] = {"Shiny Paras", 3},
["Parasect"] = {"Shiny Parasect", 6},
["Pidgeot"] = {"Shiny Pidgeot", 6},
["Pinsir"] = {"Shiny Pinsir", 7},
["Porygon"] = {"Shiny Porygon", 9},
["Raichu"] = {"Shiny Raichu", 7},
["Raticate"] = {"Shiny Raticate", 6},
["Rattata"] = {"Shiny Rattata", 3},
["Roserade"] = {"Shiny Roserade", 8},
["Salamence"] = {"Shiny Salamence", 10},
["Scyther"] = {"Shiny Scyther", 4},
["Seadra"] = {"Shiny Seadra", 5},
["Tangela"] = {"Shiny Tangela", 4},
["Tangrowth"] = {"Shiny Tangrowth", 10},
["Tentacool"] = {"Shiny Tentacool", 2},
["Tentacruel"] = {"Shiny Tentacruel", 9},
["Tropius"] = {"Shiny Tropius", 10},
["Vaporeon"] = {"Shiny Vaporeon", 6},
["Venomoth"] = {"Shiny Venomoth", 6},
["Venonat"] = {"Shiny Venonat", 2},
["Venusaur"] = {"Shiny Venusaur", 8},
["Vileplume"] = {"Shiny Vileplume", 6},
["Voltorb"] = {"Shiny Voltorb", 2},
["Wigglytuff"] = {"Shiny Wigglytuff", 7},
["Zubat"] = {"Shiny Zubat", 3},

}
local balls = {
[11826] = {newBall = 11826},
[11832] = {newBall = 11832},
[11835] = {newBall = 11835},
[11829] = {newBall = 11829},
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
   if isMonster(itemEx.uid) and getCreatureMaster(itemEx.uid) == cid then
          local monster = getCreatureName(itemEx.uid)
          if evo[monster] then  
                 if getPlayerItemCount(cid, item.itemid) >= evo[monster][2] then
                    doPlayerSendTextMessage(cid, 27, "Parabens! Seu "..getPokeName(itemEx.uid).." evoluiu para"..evo[monster][1].."!")
                    local health, maxHealth = getCreatureHealth(itemEx.uid), getCreatureMaxHealth(itemEx.uid)
                    doSendMagicEffect(getThingPos(itemEx.uid), 18)
                    doRemoveCreature(itemEx.uid)
                    doPlayerRemoveItem(cid, item.itemid, evo[monster][2]-1)
                    doRemoveItem(item.uid, 1)
                    doSummonMonster(cid,evo[monster][1])
                    local pokeball = getPlayerSlotItem(cid, 8):
                    doItemSetAttribute(pokeball.uid, "poke", evo[monster][1])
                    doItemSetAttribute(pokeball.uid, "level", pokes[evo[monster][1]].level)
                    doItemSetAttribute(ball, "hp", 1)
                    doItemSetAttribute(ball, "happy", 110)
                    local pk = getCreatureSummons(cid)[1]
                    local getShinyPokeballs = balls[getPlayerSlotItem(cid, 8).itemid]
                    doTransformItem(getPlayerSlotItem(cid, 8).uid, getPokeballs.newBall)
                    adjustStatus(pk, pokeball.uid, true, false, true)
                    return TRUE
                 else
                    return doPlayerSendTextMessage(cid, 27, "You need atleast ".. evo[monster][2] .." stones to do it!")
                 end
          end
end
return FALSE
end

Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

  • 0

Remova esta linha:

doTransformItem(getPlayerSlotItem(cid, 8).uid, getPokeballs.newBall)

Como o ID da pokeball permanecerá o mesmo, a função acima é desnecessária.

Link para o comentário
Compartilhar em outros sites

  • 0

 doTransformItem(getPlayerSlotItem(cid, 8).uid, getPokeballs.newBall) 

Tá pegando a variável newBall da table getPokeballs, sendo que a table é:

local balls = {
[11826] = {newBall = 11826},
[11832] = {newBall = 11832},
[11835] = {newBall = 11835},
[11829] = {newBall = 11829},
}

A table não existe, por isso retorna nil.
Creio que o correto seria:

doTransformItem(getPlayerSlotItem(cid, u).uid, balls.getPokeballs)

 

Link para o comentário
Compartilhar em outros sites

  • 0

^ neste caso, para chamar um elemento de balls você precisa de um index, além do fato de que getPokeballs é algo inexistente no código, por isso imagino que seu objetivo foi chamar newBall e não getPokeballs.

Se o autor do tópico preferir manter a linha, pode substituí-la por:

doTransformItem(getPlayerSlotItem(cid, 8).uid, balls[getPlayerSlotItem(cid, 8).itemid].newBall)

 

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

×
×
  • Criar Novo...