Ir para conteúdo

Featured Replies

Postado

Gente, estou com um problema na hora de chamar a Moves Table (cooldown bar). 

Segue abaixo o erro apresentado:

  • ERRO NO EXE:
-Ao chamar o pokémon para fora da ball, aparece o seguinte erro, sem atualizar a Move Table (cooldown bar)

09/10/2015 16:54:19] [Error - Action Interface] 
[09/10/2015 16:54:19] data/actions/scripts/goback.lua:onUse
[09/10/2015 16:54:19] Description: 
[09/10/2015 16:54:19] data/lib/otclient.lua:33: attempt to call global 'getCD' (a nil value)
[09/10/2015 16:54:19] stack traceback:
[09/10/2015 16:54:19]     data/lib/otclient.lua:33: in function 'cdBar'
[09/10/2015 16:54:19]     data/lib/otclient.lua:47: in function 'doUpdateCdBar'
[09/10/2015 16:54:19]     data/actions/scripts/goback.lua:103: in function <data/actions/scripts/goback.lua:4>

 


Ok, agora os scripts...

actions/scripts/goback.lua

 

local backMSG = {"Come back, doka!", "Thanks for helping, doka!", "That's enough, come back!", "You were great, doka!", "Excellent work, doka!", "Well done, doka!"}
local goMSG   = {"Go, doka!", "Let's do it, doka!", "I choose you, doka!", "I need your help, doka!", "Let's fight, doka!", "It's battle time, doka!"}

function onUse(cid, item, frompos, item2, topos)
if #getCreatureSummons(cid) >= 1 and getPlayerStorageValue(getCreatureSummons(cid)[1], 33) >= 1 then
return true
end
--------
   msgunicaback =  backMSG[math.random(#backMSG)]
   msgunicago = goMSG[math.random(#goMSG)]
   btype = getPokeballType(item.itemid)
   usando = pokeballs[btype].use
   online = pokeballs[btype].on
   morto  = pokeballs[btype].off
   if isIconeSystem(cid) then
      effect = getItemAttribute(item.uid, "effect")
    else
      effect =  getItemAttribute(item.uid, "effect")
   end
--------

if item.itemid == usando then
if #getCreatureSummons(cid) >= 1 then
local z = getCreatureSummons(cid)[1]
local pokename = getCreatureName(z)
local mbk = msgunicaback:gsub("doka", pokename)
if getItemAttribute(item.uid, "poke"):find(getCreatureName(z)) then
doTransformItem(item.uid, item.itemid-1)
doCreatureSay(cid, mbk, TALKTYPE_SAY)
local summom = getCreatureSummons(cid)
local maxh = pokes[getCreatureName(summom[1])].vida
local pct2 = ((getCreatureHealth(summom[1])) / (getCreatureMaxHealth(summom[1])))
local vids = ((getCreatureHealth(summom[1])) - 2)
doCreatureAddHealth(summom[1], -vids)
setCreatureMaxHealth(summom[1], maxh)
doCreatureAddHealth(summom[1], ((maxh) * (pct2)))
doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke"):sub(1, findLetter(getItemAttribute(item.uid, "poke"), ".")) .. " HP = ["..getCreatureHealth(z).."/"..getCreatureMaxHealth(z).."]")
setPlayerStorageValue(cid, 61204, 0)
setPlayerStorageValue(cid, 2, 0)
doSendMagicEffect(getCreaturePosition(z), effect)
doRemoveCreature(z)
pokeHealthSend(cid)
return true
end
end
elseif item.itemid == morto then
       return doPlayerSendCancel(cid, "This pokemon is fainted.")

elseif item.itemid == online then
if isZumbie(cid) or isHuman(cid) then
return doPlayerSendCancel(cid, "Sorry, is not possible.")
end
if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_FEET).uid then
    doPlayerSendCancel(cid, "You must put your pokeball in the correct place!")
    return TRUE
end


if not canSummon(cid) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHROOM)
end

if getPlayerStorageValue(cid, 63215) >= 1 then
return doPlayerSendCancel(cid, "You can't use pokeball while surfing.")
end

if getPlayerStorageValue(cid, 62314) >= 1 then
return doPlayerSendCancel(cid, "You can't use pokeball while flying.")
end

if #getCreatureSummons(cid) >= 1 then
return doPlayerSendCancel(cid, "You have already summoned a pokemon.")
end

for i,x in pairs(pokes) do
if i == getItemAttribute(item.uid, "poke"):sub(9, findLetter(getItemAttribute(item.uid, "poke"), "'")-1) then

if getPlayerLevel(cid) < x.level then
doPlayerSendCancel(cid, "You need level "..x.level.." or higher to use this pokemon.")
return true
end
local removed = doCreateItem(1285, 1, getThingPos(cid))
doSummonMonster(cid, i)
local pk = getCreatureSummons(cid)[1]
doTeleportThing(pk, getClosestFreeTile(pk, getThingPos(cid)), false)
doRemoveItem(removed, 1)
doCreatureSetLookDir(pk, 2)
local maxh = pokes[getCreatureName(pk)].vida
local levellife = ((getPlayerLevel(cid)) * (pokes[getCreatureName(pk)].cons))
local health = tonumber(getItemAttribute(item.uid, "poke"):match("%[(.-)/"))
doConvinceCreature(cid, pk)
doCreatureAddHealth(pk, health-maxh)
local pct = ((getCreatureHealth(pk)) / (getCreatureMaxHealth(pk)))
local vidis = (getCreatureHealth(pk))
setCreatureMaxHealth(pk, ((maxh) + (levellife)))
doCreatureAddHealth(pk, 2)
doCreatureAddHealth(pk, -vidis)
doCreatureAddHealth(pk, ((getCreatureMaxHealth(pk)) * (pct)) - 2)
doTransformItem(item.uid, item.itemid+1)
local pokename = getCreatureName(getCreatureSummons(cid)[1])
local mgo = msgunicago:gsub("doka", pokename)
doCreatureSay(cid, mgo, TALKTYPE_SAY)
doUpdateCdBar(cid)
pokeHealthSend(cid)
doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke"):sub(1, findLetter(getItemAttribute(item.uid, "poke"), ".")))
doSendMagicEffect(getCreaturePosition(pk), effect)
setPlayerStorageValue(cid, 61204, 1)
registerCreatureEvent(pk, "DiePoke")
registerCreatureEvent(pk, "Exp")
break
end
end
end
return TRUE
end
 





lib/otclient.lua

function pokeHealthSend(cid, zerar)
local summon = getCreatureSummons(cid)[1]
if #getCreatureSummons(cid) >= 1 then
doPlayerSendCancel(cid, "#pokehealth,"..getCreatureHealth(summon)..","..getCreatureMaxHealth(summon))
else
doPlayerSendCancel(cid, "#pokehealth,0,0")
end
end

function getNewMoveTable(table, n)
if table == nil or not n then return false end

local moves = {table.move1, table.move2, table.move3, table.move4, table.move5, table.move6, table.move7, table.move8, table.move9,
table.move10, table.move11, table.move12}

return moves[n] or false
end

function cdBar(cid, i)
if not isCreature(cid) then return true end
local summon = getCreatureSummons(cid)[1]
local ret = {}
local a = getPlayerSlotItem(cid, 8)
local moves = movestable[getCreatureName(summon)]
table.insert(ret, "#cdbar,")
table.insert(ret, i..",")
if summon and getPlayerStorageValue(summon, 212123) >= 1 then
   cdzin = "cm_move"..i
else
   cdzin = "move"..i
end

    table.insert(ret, (getCD(a.uid, cdzin)..","))

local b = getNewMoveTable(moves, i)
    if b then
       table.insert(ret, b.name..",")
    else
       table.insert(ret, "n/n,")
    end
doPlayerSendCancel(cid, table.concat(ret))
doPlayerSendCancel(cid, "-")
end

function doUpdateCdBar(cid)
     for a = 1 ,12 do
        cdBar(cid, a)
     end
end

 


 

Agradeço a ajuda desde já.

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 520k

Informação Importante

Confirmação de Termo