- 0
erro [ERROS] Level System PDA
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.
-
Conteúdo Similar
-
- 1 resposta
- 1065 visualizações
-
- 0 respostas
- 1970 visualizações
-
- 0 respostas
- 1079 visualizações
-
- 0 respostas
- 802 visualizações
-
- 2 respostas
- 2823 visualizações
-
Pergunta
Bluester 205
Olá xTibianos, estava mexendo no meu servidor ( PokeCamp ) e acabei tentando adicionar Level System nos Pokemons, e deu quase tudo certo ! No momento, estou com o seguinte erro:
[01/04/2016 13:24:07] [Error - CreatureScript Interface]
[01/04/2016 13:24:07] data/creaturescripts/scripts/pokeexp.lua:onDeath
[01/04/2016 13:24:07] Description:
[01/04/2016 13:24:07] data/lib/level system.lua:254: attempt to perform arithmetic on a nil value
[01/04/2016 13:24:07] stack traceback:
[01/04/2016 13:24:07] data/lib/level system.lua:254: in function 'givePokemonExp'
[01/04/2016 13:24:07] data/creaturescripts/scripts/pokeexp.lua:47: in function <data/creaturescripts/scripts/pokeexp.lua:10>
A corpse ( corpo ) do Pokémon não aparece depois que ele morre.
Aqui está o Level System.lua:
function getPokemonBaseStatus(name, multiplier)
local a = pokes[name]
local m = 1
if not a then return false end
if not a.offense then return false end
if multiplier then m = multiplier end
local ret = {}
ret.off = a.offense m
ret.offense = ret.off
ret.def = a.defense m
ret.defense = ret.def
ret.agi = a.agility m
ret.agility = ret.agi
ret.spatk = a.specialattack m
ret.specialattack = ret.spatk
ret.vit = a.vitality m
ret.vitality = ret.vit
return ret
end
function getPokemonStatus(name, multiplier)
local a = pokes[name]
local m = 1
if not a then return false end
if not a.offense then return false end
if multiplier then m = multiplier end
local ret = {}
ret.off = a.offense m
ret.offense = ret.off
ret.def = a.defense m
ret.defense = ret.def
ret.agi = a.agility m
ret.agility = ret.agi
ret.spatk = a.specialattack m
ret.specialattack = ret.spatk
ret.vit = a.vitality m
ret.vitality = ret.vit
return ret
end
function getPokeballStatus(owner,pokeball)
local a = getItemAttribute(owner,pokeball.uid,poke)
if not a then return false end
local ret = {}
ret.off = getItemAttribute(owner,pokeball.uid,offense)
ret.offense = getItemAttribute(owner,pokeball.uid,offense)
ret.def = getItemAttribute(owner,pokeball.uid,defense)
ret.defense = getItemAttribute(owner,pokeball.uid,defense)
ret.agi = getItemAttribute(owner,pokeball.uid,speed)
ret.agility = getItemAttribute(owner,pokeball.uid,speed)
ret.spatk = getItemAttribute(owner,pokeball.uid,specialattack)
ret.specialattack = getItemAttribute(owner,pokeball.uid,specialattack)
ret.vit = getItemAttribute(owner,pokeball.uid,vitality)
ret.vitality = getItemAttribute(owner,pokeball.uid,vitality)
return ret
end
function getPokemonXMLOutfit(name)
local johto = false
for i = 209, 308 do --alterado v2.6
if oldpokedex[1] and oldpokedex[1] == name then
johto = true
end
end
if isShinyName(name) then
a = datamonsterpokesShiny..name...xml
elseif johto then
a = datamonsterpokesgeracao 2..name...xml --edited pra melhorar a pasta monster
else
a = datamonsterpokesgeracao 1..name...xml
end
local b = io.open(a, a+)
local c = bread(all)
bclose()
local d, e = cfind('look type=(.-)')
c = string.sub(c, d + 11, e - 1)
return tonumber©
end
function doEvolutionOutfit(cid, oldout, outfit)
if not isCreature(cid) then return true end
if getCreatureOutfit(cid).lookType == oldout then
doSetCreatureOutfit(cid, {lookType = outfit}, -1)
else
doSetCreatureOutfit(cid, {lookType = oldout}, -1)
end
end
function doStartEvolution(cid, evolution, seconds)
if not isCreature(cid) then return true end
local a = getPlayerStorageValue(cid, 1007)
local b = getCreatureHealth(cid) getCreatureMaxHealth(cid)
local d = getThingPos(cid)
local e = getCreatureMaster(cid)
if getHappinessRate(cid) 1 then return true end
local f = getCreatureOutfit(cid).lookType
local g = getItemAttribute(getPlayerSlotItem(e, 8).uid, nick) or getCreatureName(cid)
local h = getPokemonXMLOutfit(evolution)
doItemSetAttribute(getPlayerSlotItem(e, 8).uid, hp, b)
doCreatureSay(e, What My ..g.. is evolving!, TALKTYPE_SAY)
doSummonMonster(e, Evolution)
doReturnPokemon(e, cid, getPlayerSlotItem(e, 8), 0, true)
local evo = getCreatureSummons(e)[1]
doEvolutionOutfit(evo, h, f)
doCreatureSetHideHealth(evo, true)
doCreatureSetLookDir(evo, 2)
setPlayerStorageValue(evo, 1007, g)
doTeleportThing(evo, d, false)
addEvent(sendSSJEffect, 250, evo)
doSendAnimatedText(getThingPos(evo), EVOLUTION, COLOR_GRASS)
doSendEvolutionEffect(evo, getThingPos(evo), evolution, 20, false, false, f, h)
end
function doSendEvolutionEffect(cid, pos, evolution, turn, ssj, evolve, f, h)
if not isCreature(cid) then
doSendAnimatedText(pos, CANCEL, 215)
return true end
if evolve then
doEvolvePokemon(getCreatureMaster(cid), {uid = cid}, evolution, 0, 0)
return true
end
doSendMagicEffect(pos, 18)
if ssj then
sendSSJEffect(evo)
end
doEvolutionOutfit(cid, f, h)
addEvent(doSendEvolutionEffect, math.pow(1900, turn20), cid, getThingPos(cid), evolution, turn - 1, turn == 19, turn == 2, f, h)
end
function sendSSJEffect(cid)
if not isCreature(cid) then return true end
local pos1 = getThingPos(cid)
local pos2 = getThingPos(cid)
pos2.x = pos2.x + math.random(-1, 1)
pos2.y = pos2.y - math.random(1, 2)
doSendDistanceShoot(pos1, pos2, 37)
addEvent(sendSSJEffect, 45, cid)
end
function sendFinishEvolutionEffect(cid, alternate)
if not isCreature(cid) then return true end
local pos1 = getThingPos(cid)
if alternate then
local pos = {
[1] = {-2, 0},
[2] = {-1, -1},
[3] = {0, -2},
[4] = {1, -1},
[5] = {2, 0},
[6] = {1, 1},
[7] = {0, 2},
[8] = {-1, 1}}
for a = 1, 8 do
local pos2 = getThingPos(cid)
pos2.x = pos2.x + pos[a][1]
pos2.y = pos2.y + pos[a][2]
local pos = getThingPos(cid)
doSendDistanceShoot(pos2, pos, 37)
addEvent(doSendDistanceShoot, 300, pos, pos2, 37)
end
else
for a = 0, 3 do
doSendDistanceShoot(pos1, getPosByDir(pos1, a), 37)
end
for a = 4, 7 do
addEvent(doSendDistanceShoot, 600, pos1, getPosByDir(pos1, a), 37)
end
end
end
function doEvolvePokemon(cid, item2, theevo, stone1, stone2)
if not isCreature(cid) then return true end
if not pokes[theevo] or not pokes[theevo].offense then
doReturnPokemon(cid, item2.uid, getPlayerSlotItem(cid, 8), pokeballs[getPokeballType(getPlayerSlotItem(cid, 8).itemid)].effect, false, true)
return true
end
local owner = getCreatureMaster(item2.uid)
local pokeball = getPlayerSlotItem(cid, 8)
local description = Contains a ..theevo...
local pct = getCreatureHealth(item2.uid) getCreatureMaxHealth(item2.uid)
doItemSetAttribute(pokeball.uid, hp, pct)
doItemSetAttribute(pokeball.uid, poke, theevo)
doItemSetAttribute(pokeball.uid, description, Contains a ..theevo...)
doPlayerSendTextMessage(cid, 27, Congratulations! Your ..getPokeName(item2.uid).. evolved into a ..theevo..!)
doSendMagicEffect(getThingPos(item2.uid), 18)
doTransformItem(getPlayerSlotItem(cid, 7).uid, fotos[theevo])
doSendMagicEffect(getThingPos(cid), 173)
local oldpos = getThingPos(item2.uid)
local oldlod = getCreatureLookDir(item2.uid)
local oldlvl = getPokemonLevel(item2.uid)
doRemoveCreature(item2.uid)
doSummonMonster(cid, theevo)
local pk = getCreatureSummons(cid)[1]
doTeleportThing(pk, oldpos, false)
doCreatureSetLookDir(pk, oldlod)
sendFinishEvolutionEffect(pk, true)
addEvent(sendFinishEvolutionEffect, 550, pk, true)
addEvent(sendFinishEvolutionEffect, 1050, pk)
doPlayerRemoveItem(cid, stone1, 1)
doPlayerRemoveItem(cid, stone2, 1)
doAddPokemonInOwnList(cid, theevo)
local happy = getItemAttribute(pokeball.uid, happy)
doItemSetAttribute(pokeball.uid, happy, happy + happyGainedOnEvolution)
if happy + happyGainedOnEvolution 255 then
doItemSetAttribute(pokeball.uid, happy, 255)
end
adjustStatus(pk, pokeball.uid, true, false)
if useKpdoDlls then
doUpdateMoves(cid)
end
end
function givePokemonExp(cid, item, expe, pct, rarecandy)
if expe = 0 or not isCreature(cid) then return true end
local leveltable = getPokemonExperienceTable(getPokeballName(item.uid, true))
if getItemAttribute(item.uid, exp) + expe leveltable[100] then
givePokemonExp(cid, item, leveltable[100] - getItemAttribute(item.uid, exp))
return true
end
doItemSetAttribute(item.uid, exp, tonumber(getItemAttribute(item.uid, exp)) + expe)
doItemSetAttribute(item.uid, happy, getItemAttribute(item.uid, happy) + 1)
doItemSetAttribute(item.uid, nextlevelexp, getItemAttribute(item.uid, nextlevelexp) - expe)
if pct then
doPlayerSendTextMessage(cid, 27, Your ..getPokeballName(item.uid).. has received ..expe.. experience points (..pct..%).)
else
if getItemAttribute(item.uid, nextlevelexp) 0 then
doPlayerSendTextMessage(cid, 27, Your ..getPokeballName(item.uid).. [..getItemAttribute(item.uid, level)..] has received ..expe.. experience points (..getItemAttribute(item.uid, nextlevelexp).. to next level).)
else
doPlayerSendTextMessage(cid, 27, Your ..getPokeballName(item.uid).. [..getItemAttribute(item.uid, level)..] has received ..expe.. experience points and has leveled up!)
end
end
if isBeingUsed(item.itemid) then
doSendAnimatedText(getThingPos(getCreatureSummons(cid)[1]), expe, 215)
end
if getItemAttribute(item.uid, nextlevelexp) = 0 then
local summon = getCreatureSummons(cid)[1]
if not isCreature(summon) then return true end
doSendFlareEffect(getThingPos(summon))
doSendAnimatedText(getThingPos(summon), Level up!, 215)
adjustPokemonLevel(item.uid, cid, item.itemid)
doCreatureAddHealth(summon, getCreatureMaxHealth(summon))
end
end
function givePokemonExpInBp(cid, item, expe, ballid, pct, hidemessage)
if expe = 0 or not isCreature(cid) then return true end
local leveltable = getPokemonExperienceTable(getPokeballName(item, true))
if getItemAttribute(item, exp) + expe leveltable[100] then
givePokemonExpInBp(cid, item, leveltable[100] - getItemAttribute(item, exp), ballid)
return true
end
doItemSetAttribute(item, exp, getItemAttribute(item, exp) + expe)
doItemSetAttribute(item, happy, getItemAttribute(item, happy) + 1)
doItemSetAttribute(item, nextlevelexp, getItemAttribute(item, nextlevelexp) - expe)
if not hidemessage then
if pct then
doPlayerSendTextMessage(cid, 27, Your ..getPokeballName(item).. has received ..expe.. experience points (..pct..%).)
else
if getItemAttribute(item, nextlevelexp) 0 then
doPlayerSendTextMessage(cid, 27, Your ..getPokeballName(item).. [..getItemAttribute(item, level)..] has received ..expe.. experience points inside his pokeball (..getItemAttribute(item, nextlevelexp).. to next level).)
else
doPlayerSendTextMessage(cid, 27, Your ..getPokeballName(item).. [..getItemAttribute(item, level)..] has received ..expe.. experience points and has leveled up inside his pokeball.)
adjustPokemonLevel(item, cid, ballid)
end
end
end
end
function doMathDecimal(number, casas)
if math.floor(number) == number then return number end
local c = casas and casas + 1 or 3
for a = 0, 10 do
if math.floor(number) math.pow(10, a) then
local str = string.sub(..number.., 1, a + c)
return tonumber(str)
end
end
return number
end
function adjustPokemonLevel(item, cid, id, rarecandy)
if not isCreature(cid) then return true end
local exp = getItemAttribute(item, exp)
local level = getItemAttribute(item, level)
local leveltable = getPokemonExperienceTable(getPokeballName(item, true))
local newlevel = 1
for x = 1, 100 do
if exp = leveltable[x] and exp leveltable[x+1] then
newlevel = x
end
end
if newlevel = 1 then return true end
local levelsup = (newlevel - level)
local pokemon = getItemAttribute(item, poke)
local happy = getItemAttribute(item, happy)
local rate = happy 100
local newhappiness = happy
if happy = 250 then
newhappiness = 255
elseif happy = 230 then
newhappiness = happy + 4
elseif happy = 210 then
newhappiness = happy + 6
elseif happy = 180 then
newhappiness = happy + 8
elseif happy = 140 then
newhappiness = happy + 10
elseif happy = 110 then
newhappiness = happy + 12
else
newhappiness = happy + 15
end
doItemSetAttribute(item, level, newlevel)
if not rarecandy then
doItemSetAttribute(item, happy, newhappiness)
end
local nextexp = leveltable[newlevel + 1] - exp
doItemSetAttribute(item, nextlevelexp, nextexp)
if newlevel getPlayerLevel(cid) + pokemonMaxLevelAbovePlayer then
addEvent(doPlayerSendTextMessage, 30, cid, 18, Warning Your ..getPokeballName(item)..'s [..newlevel..] level is much higher than yours, so you will not be able to call him to battles.)
end
if isCreature(cid) and id = 1 and isBeingUsed(id) then
adjustStatus(getCreatureSummons(cid)[1], item, false, true)
do
pokeexp.lua:
local balls = {11826, 11828, 11829, 11831, 11832, 11834, 11835, 11837,
11737, 11739, 11740, 11742, 11743, 11745, 11746, 11748}
local function playerAddExp(cid, exp)
doPlayerAddExp(cid, exp)
doSendAnimatedText(getThingPos(cid), exp, 215)
end
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蓷m de fazer as altera蔞es 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)
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)
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
REP + para quem ajudar.
Podem fechar o tópico, já foi resolvido.
Editado por BluesterLink para o comentário
Compartilhar em outros sites
10 respostass a esta questão
Posts Recomendados