Ir para conteúdo
  • 0

Ajuda TM System


atakashi

Pergunta

Boa noite, galera to com um problema no TM system no servidor de poketibia aqui.

está tudo funcionando normal, porém quando eu vou usar um Move que o pokemon não tem, por exemplo um m12 que o charizard não tem, da o seguinte erro no console.

 

[05/12/2016 21:34:47] [Error - TalkAction Interface] [05/12/2016 21:34:47] data/talkactions/scripts/move1.lua:onSay[05/12/2016 21:34:47] Description: [05/12/2016 21:34:47] data/talkactions/scripts/move1.lua:84: attempt to index local 'move' (a nil value)[05/12/2016 21:34:47] stack traceback:[05/12/2016 21:34:47] 	data/talkactions/scripts/move1.lua:84: in function <data/talkactions/scripts/move1.lua:24>[05/12/2016 21:35:13]

e quando uso um TM que o pokemon não tem.

[05/12/2016 21:32:14] [Error - TalkAction Interface] [05/12/2016 21:32:14] data/talkactions/scripts/move1.lua:onSay[05/12/2016 21:32:14] Description: [05/12/2016 21:32:14] data/talkactions/scripts/move1.lua:91: attempt to index field '?' (a nil value)[05/12/2016 21:32:14] stack traceback:[05/12/2016 21:32:14] 	data/talkactions/scripts/move1.lua:91: in function <data/talkactions/scripts/move1.lua:24>

Era para aparecer a mensagem,  " Your pokemon doesn't recognize this move. "

Eu não sei onde arruma pois não consigo entender o problema.

Vou aguardar a ajuda de alguém, aqui está meu script de move1.lua

 

 

local msgs = {"use ", ""}function doAlertReady(cid, id, movename, n, cd)if not isCreature(cid) then return true endlocal myball = getPlayerSlotItem(cid, 8)if myball.itemid > 0 and getItemAttribute(myball.uid, cd) == "cd:"..id.."" thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPokeballName(myball.uid).." - "..movename.." (m"..n..") is ready!")return trueendlocal p = getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid)if not p or #p <= 0 then return true endfor a = 1, #p doif getItemAttribute(p[a], cd) == "cd:"..id.."" thenif isInArray({"m1", "m2", "m3"}, n) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPokeballName(p[a]).." - "..movename.." (t"..n..") is ready!")elsedoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPokeballName(p[a]).." - "..movename.." (m"..n..") is ready!")endreturn trueendendendfunction onSay(cid, words, param, channel)if param ~= "" then return true endif string.len(words) > 3 then return true endif #getCreatureSummons(cid) == 0 thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need a pokemon to use moves.")return 0end--alterado v2.5local mypoke = getCreatureSummons(cid)[1]if getCreatureCondition(cid, CONDITION_EXHAUST) then return true endif getCreatureName(mypoke) == "Evolution" then return true endlocal name = getCreatureName(mypoke) == "Ditto" or getCreatureName(mypoke) == "Shiny Ditto" or getCreatureName(mypoke) == "Black Ditto" and getPlayerStorageValue(mypoke, 1010) or getCreatureName(mypoke)local it = string.sub(words, 2, 3)local move = movestable[name].move1if getPlayerStorageValue(mypoke, 212123) >= 1 thencdzin = "cm_move"..it..""elsecdzin = "move"..it.."" --alterado v2.5endif it == "2" thenmove = movestable[name].move2elseif it == "3" thenmove = movestable[name].move3elseif it == "4" thenmove = movestable[name].move4elseif it == "5" thenmove = movestable[name].move5elseif it == "6" thenmove = movestable[name].move6elseif it == "7" thenmove = movestable[name].move7elseif it == "8" thenmove = movestable[name].move8elseif it == "9" thenmove = movestable[name].move9elseif it == "10" thenmove = movestable[name].move10elseif it == "11" thenmove = movestable[name].move11elseif it == "12" thenmove = movestable[name].move12elseif it == "13" thenmove = movestable[name].move13elseif it == "m1" thenmove = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "tm1") or falseelseif it == "m2" thenmove = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "tm2") or falseelseif it == "m3" thenmove = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "tm3") or falseendif isInArray({1,2,3,4,5,6,7,8,9,10,11,12,13}, it) thenmLevel = move.levelmCD = move.cdmName = move.namemTarget = move.targetmDist = move.distelsem = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "t"..it.."")mLevel = tmList[m].levelmCD = tmList[m].cdmName = mmTarget = tmList[m].targetmDist = tmList[m].distendif not move thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your pokemon doesn't recognize this move.")return trueend		if getPlayerLevel(cid) < move.level then	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need be atleast level "..move.level.." to use this move.") return trueendif getCD(getPlayerSlotItem(cid, 8).uid, cdzin) > 0 and getCD(getPlayerSlotItem(cid, 8).uid, cdzin) < (mCD + 2) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have to wait "..getCD(getPlayerSlotItem(cid, 8).uid, cdzin).." seconds to use "..mName.." again.")return 0endif getTileInfo(getThingPos(mypoke)).protection thendoPlayerSendCancel(cid, "Your pokemon cannot use moves while in protection zone.")return 0endif getPlayerStorageValue(mypoke, 3894) >= 1 thenreturn doPlayerSendCancel(cid, "You can't attack because you is with fear") --alterado v2.3endif (mName == "Team Slice" or mName == "Team Claw") and #getCreatureSummons(cid) < 2 then --alterado v2.5doPlayerSendCancel(cid, "Your pokemon need be in a team for use this move!")return 0end--alterado v2.6if isCreature(getCreatureTarget(cid)) and isInArray(specialabilities["evasion"], getCreatureName(getCreatureTarget(cid))) and math.random(1, 100) <= 10 thenlocal target = getCreatureTarget(cid)if isCreature(getMasterTarget(target)) then --alterado v2.6 --alterado v2.5doSendMagicEffect(getThingPos(target), 211)doSendAnimatedText(getThingPos(target), "TOO BAD", 215)doTeleportThing(target, getClosestFreeTile(target, getThingPos(mypoke)), false)doSendMagicEffect(getThingPos(target), 211)doFaceCreature(target, getThingPos(mypoke))return true --alterado v2.6endendif mTarget == 1 thenif not isCreature(getCreatureTarget(cid)) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don\'t have any targets.")return 0endif getCreatureCondition(getCreatureTarget(cid), CONDITION_INVISIBLE) thenreturn 0endif getCreatureHealth(getCreatureTarget(cid)) <= 0 thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your have already defeated your target.")return 0endif not isCreature(getCreatureSummons(cid)[1]) thenreturn trueendif getDistanceBetween(getThingPos(getCreatureSummons(cid)[1]), getThingPos(getCreatureTarget(cid))) > mDist thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Get closer to the target to use this move.")return 0endif not isSightClear(getThingPos(getCreatureSummons(cid)[1]), getThingPos(getCreatureTarget(cid)), false) thenreturn 0endendlocal newid = 0if isSleeping(mypoke) or isSilence(mypoke) then --alterado v2.5doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry you can't do that right now.")return 0elsenewid = setCD(getPlayerSlotItem(cid, 8).uid, cdzin, mCD)enddoCreatureSay(cid, ""..getPokeName(mypoke)..", "..msgs[math.random(#msgs)]..""..mName.."!", TALKTYPE_SAY)local summons = getCreatureSummons(cid) --alterado v2.6addEvent(doAlertReady, mCD * 1000, cid, newid, mName, it, cdzin)for i = 2, #summons doif isCreature(summons[i]) and getPlayerStorageValue(cid, 637501) >= 1 thendocastspell(summons[i], mName) --alterado v2.6endenddocastspell(mypoke, mName)doCreatureAddCondition(cid, playerexhaust)if useKpdoDlls thendoUpdateCooldowns(cid)endreturn 0end

 

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 1

Transfira as seguintes linhas:

if not move then    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your pokemon doesn't recognize this move.")    return trueend

para acima de:

if isInArray({1,2,3,4,5,6,7,8,9,10,11,12,13}, it) then

 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...