TO
pedido

Error na spell.

Por Tony Araujo, 26 de mar. de 2013 em Scripts

resolvido
script
8
1.2k
Tony AraujoT
26 de março de 2013 às 22:24

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 *-*

SlicerS
26 de março de 2013 às 22:27

manda ele te mandar a funçao.. changeposbydir... ;x deve ta na lib dele...

Tony AraujoT
27 de março de 2013 às 13:54

Ele nao entra faz 3 dias -'

Editado Março 27 por OrochiElf

dalvorsnD
27 de março de 2013 às 14:30

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 Março 27 por dalvorsn

Tony AraujoT
27 de março de 2013 às 14:50

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.

dalvorsnD
27 de março de 2013 às 14:57

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'

Tony AraujoT
28 de março de 2013 às 08:45

Funciionou , REP+ ,

Duvida Sanada.

RoksasR
28 de março de 2013 às 19:03

Tópico movido para a seção de dúvidas e pedidos resolvidos.