Ir para conteúdo

Pergunta

Fala ai galera, meu amigo me passou uma spell para eu usar em meu servidor.

porém quando eu fui testar deu um error muito chato.

 


[26/03/2013 22:23:56] [Error - Spell Interface]
[26/03/2013 22:23:56] In a timer event called from:
[26/03/2013 22:23:56] data/spells/scripts/attack/hells core.lua:onCastSpell
[26/03/2013 22:23:56] Description:
[26/03/2013 22:23:56] data/spells/scripts/attack/hells core.lua:72: attempt to call global 'changeposbydir' (a nil value)
[26/03/2013 22:23:56] stack traceback:
[26/03/2013 22:23:56]  data/spells/scripts/attack/hells core.lua:72: in function 'onSpell'
[26/03/2013 22:23:56]  data/spells/scripts/attack/hells core.lua:88: in function <data/spells/scripts/attack/hells core.lua:88>

 

Script

 

 

 

local combat = createCombatObject()

setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)

setCombatParam(combat, COMBAT_PARAM_EFFECT, 255)

setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 7, 14)

 

 

local arr = {

{0,0,0,0,0,1,0,0,0,0,0},

{0,1,0,0,0,1,0,0,0,1,0},

{0,0,1,0,0,1,0,0,1,0,0},

{0,0,0,1,0,1,0,1,0,0,0},

{0,0,0,0,1,1,1,0,0,0,0},

{1,1,1,1,1,2,1,1,1,1,1},

{0,0,0,0,1,1,1,0,0,0,0},

{0,0,0,1,0,1,0,1,0,0,0},

{0,0,1,0,0,1,0,0,1,0,0},

{0,1,0,0,0,1,0,0,0,1,0},

{0,0,0,0,0,1,0,0,0,0,0}

}

local area = createCombatArea(arr)

setCombatArea(combat, area)

 

local function onCastSpell1(parameters)

doCombat(parameters.cid, combat1, parameters.var)

end

 

function getThingPosWithDebug(what)

if not isCreature(what) or getCreatureHealth(what) <= 0 then

return {x = 1, y = 1, z = 1}

end

return getThingPos(what)

end

 

function onCastSpell(cid, var)

function onOut1(cid)

local outfit = getCreatureOutfit(cid)

outfit.lookType = 350

doSetCreatureOutfit(cid, outfit, -1)

end

 

function onOut2(cid)

local outfit = getCreatureOutfit(cid)

outfit.lookType = 351

doSetCreatureOutfit(cid, outfit, -1)

end

 

function onRemove(cid)

doRemoveCondition(cid, CONDITION_OUTFIT)

end

 

local function ChargingBeam(cid)

if not isCreature(cid) then

return true

end

local tab = {}

 

for x = -2, 2 do

for y = -2, 2 do

local pos = getThingPosWithDebug(cid)

pos.x = pos.x + x

pos.y = pos.y + y

if pos.x ~= getThingPosWithDebug(cid).x and pos.y ~= getThingPosWithDebug(cid).y then

table.insert(tab, pos)

end

end

end

doSendDistanceShoot(tab[math.random(#tab)], getThingPosWithDebug(cid), 35)

end

local function onSpell(cid)

doCombat(cid, combat, var)

for a=0,7 do

doSendDistanceShoot(getThingPos(cid), changeposbydir(getThingPos(cid), a, a>3 and 4 or 5), 35)

end

end

local function son2(cid)

useSound(cid,26,"sounds/energy.wav")

end

addEvent(function() son2(cid) end,1*1000)

useSound(cid,26,"sounds/load.wav")

doCreatureSay(cid,"Energy Explosion",TALKTYPE_ORANGE_1)

onOut1(cid)

addEvent(function() onOut2(cid) end,1*1000)

addEvent(function() onRemove(cid) end,2*1000)

ChargingBeam(cid)

ChargingBeam(cid)

ChargingBeam(cid)

ChargingBeam(cid)

addEvent(function() onSpell(cid) end,1*1000)

addEvent(doCombat,1100,cid,combat,var)

end

 

 

 

Se alguem poder ajudar *-*

Link para o comentário
https://xtibia.com/forum/topic/210715-error-na-spell/
Compartilhar em outros sites

7 respostass a esta questão

Posts Recomendados

  • 0

O que a função 'changeposbydir' deveria fazer?

 

#edit

Acho que sei como é essa função, se for a que estou pensando, o nome dela no tfs é getPositionByDirection(fromPosition, direction, size)

Teste ai:

eryUTCpi[/pastebin]

Editado por dalvorsn
Link para o comentário
https://xtibia.com/forum/topic/210715-error-na-spell/#findComment-1494032
Compartilhar em outros sites

  • 0

Bom, a funçao mesmo iria jogar o mesmo efeito para todos lados do player.

 

\ | /

-0-

/ | \

 

Mais ou menos do jeito dakeles pontos ali.

 

@Vou testar o seu sistema.

Link para o comentário
https://xtibia.com/forum/topic/210715-error-na-spell/#findComment-1494037
Compartilhar em outros sites

  • 0

Bom, a funçao mesmo iria jogar o mesmo efeito para todos lados do player.

 

\ | /

-0-

/ | \

 

Mais ou menos do jeito dakeles pontos ali.

 

@Vou testar o seu sistema.

 

Eu não alterei em nada a magia, eu apenas troquei o nome 'changeposbydir' por 'getPositionByDirection'

Link para o comentário
https://xtibia.com/forum/topic/210715-error-na-spell/#findComment-1494040
Compartilhar em outros sites

×
×
  • Criar Novo...