Ir para conteúdo
  • 0

Bug na Spell


koete

Pergunta

Peguei uma Spell de Kagemane aqui do fórum de uma pessoa que postou

mas... ela funciona assim vc clica em algum target e usa a spell ai o target por X tempo vai fazer exatamente o que vc fizer exemplo se eu andar para cima ele vai andar tambem. O problema é quando o tempo da spell acaba mostra esta msg de erro.

 

ERRO

 

[28/06/2013 11:24:48] Lua Script Error: [spell Interface]

[28/06/2013 11:24:48] in a timer event called from:
[28/06/2013 11:24:48] data/spells/scripts/Jutus Naruto/kagemane.lua:onCastSpell
[28/06/2013 11:24:48] data/spells/scripts/Jutus Naruto/kagemane.lua:22: attempt to call global 'doCreatureNoMove' (a nil value)
[28/06/2013 11:24:48] stack traceback:

[28/06/2013 11:24:48] data/spells/scripts/Jutus Naruto/kagemane.lua:22: in function <data/spells/scripts/Jutus Naruto/kagemane.lua:1>

 

como resolver isso?

SCRIPT DA SPELL:

 

local function move(cid, target, playerpos, targetpos, times)

if playerdir ~= getCreatureLookDirection(cid) then
doCreatureSetLookDirection(target, getCreatureLookDirection(cid))
end
if playerpos ~= getCreaturePosition(cid) then
if playerpos.z == getCreaturePosition(cid).z then
local ntpos = getCreaturePosition(cid)
local x,y,z = ntpos.x-playerpos.x,ntpos.y-playerpos.y,ntpos.z-playerpos.z
ntpos = getCreaturePosition(target)
ntpos.x, ntpos.y, ntpos.z = ntpos.x+x,ntpos.y+y,ntpos.z+z
if queryTileAddThing(target, ntpos) == RETURNVALUE_NOERROR and getCreaturePosition(cid).z == getCreaturePosition(target).z then
doMoveCreature(target, getCreatureLookDirection(cid))
end
end
end
local playerpos, targetpos = getCreaturePosition(cid), getCreaturePosition(target)
local times = times+1
if times < 100 then
addEvent(move, 1, cid, target, playerpos, targetpos, times)
else
doCreatureNoMove(target, 0)
doSendDistanceShoot(targetpos, playerpos, 31)
doSendAnimatedText(targetpos, "Livre!", math.random(1,255))
doPlayerSendCancel(cid, "Voce nao tem mais o controle do "..getCreatureName(target)..".")
if (isPlayer(target)) then
doPlayerSendCancel(cid, "Voce foi libertado "..getPlayerName(cid).."da tecnica da sombra.")
setPlayerStorageValue(target, 14755, -1)
end
end
end
function onCastSpell(cid, var)
local target = getCreatureTarget(cid)
if (isPlayer(target)) or (isMonster(target)) then
if getPlayerStorageValue(cid, 14755) == -1 then
doCreatureSetNoMove(target, 1)
doPlayerSendCancel(cid, "Voce possuiu "..getCreatureName(target)..".")
if (isPlayer(target)) then
doPlayerSendCancel(target, "Voce foi possuido por "..getPlayerName(cid)..".")
setPlayerStorageValue(target, 14755, 1)
end
doSendAnimatedText(getCreaturePosition(target), "Possuido!", math.random(1,255))
local playerpos,playerdir,targetpos = getCreaturePosition(cid), getCreatureLookDir(cid), getCreaturePosition(target)
doSendDistanceShoot(playerpos, targetpos, 31)
doSendMagicEffect(getCreaturePosition(target), CONST_ME_SMALLCLOUDS)
local times = 1
addEvent(move, 1000, cid, target, playerpos, targetpos, times)
else
doPlayerSendCancel(cid, "Você ainda esta sobre a possecao do inimigo.")
end
end

end

 

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

4 respostass a esta questão

Posts Recomendados

  • 0


local function move(cid, target, playerpos, targetpos, times)

 

if playerdir ~= getCreatureLookDirection(cid) then

doCreatureSetLookDirection(target, getCreatureLookDirection(cid))

end

 

if playerpos ~= getCreaturePosition(cid) then

if playerpos.z == getCreaturePosition(cid).z then

local ntpos = getCreaturePosition(cid)

local x,y,z = ntpos.x-playerpos.x,ntpos.y-playerpos.y,ntpos.z-playerpos.z

ntpos = getCreaturePosition(target)

ntpos.x, ntpos.y, ntpos.z = ntpos.x+x,ntpos.y+y,ntpos.z+z

if queryTileAddThing(target, ntpos) == RETURNVALUE_NOERROR and getCreaturePosition(cid).z == getCreaturePosition(target).z then

doMoveCreature(target, getCreatureLookDirection(cid))

end

end

end

local playerpos, targetpos = getCreaturePosition(cid), getCreaturePosition(target)

local times = times+1

if times < 100 then

addEvent(move, 1, cid, target, playerpos, targetpos, times)

else

doCreatureSetNoMove(target, 0)

doSendDistanceShoot(targetpos, playerpos, 31)

doSendAnimatedText(targetpos, "Livre!", math.random(1,255))

doPlayerSendCancel(cid, "Voce nao tem mais o controle do "..getCreatureName(target)..".")

if (isPlayer(target)) then

doPlayerSendCancel(cid, "Voce foi libertado "..getPlayerName(cid).."da tecnica da sombra.")

setPlayerStorageValue(target, 14755, -1)

end

end

end

 

function onCastSpell(cid, var)

local target = getCreatureTarget(cid)

if (isPlayer(target)) or (isMonster(target)) then

if getPlayerStorageValue(cid, 14755) == -1 then

doCreatureSetNoMove(target, 1)

doPlayerSendCancel(cid, "Voce possuiu "..getCreatureName(target)..".")

if (isPlayer(target)) then

doPlayerSendCancel(target, "Voce foi possuido por "..getPlayerName(cid)..".")

setPlayerStorageValue(target, 14755, 1)

end

doSendAnimatedText(getCreaturePosition(target), "Possuido!", math.random(1,255))

local playerpos,playerdir,targetpos = getCreaturePosition(cid), getCreatureLookDir(cid), getCreaturePosition(target)

doSendDistanceShoot(playerpos, targetpos, 31)

doSendMagicEffect(getCreaturePosition(target), CONST_ME_SMALLCLOUDS)

local times = 1

addEvent(move, 1000, cid, target, playerpos, targetpos, times)

else

doPlayerSendCancel(cid, "Você ainda esta sobre a possecao do inimigo.")

end

end

 

end

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...