Ir para conteúdo

[Spell] Colocar Formula De Atack Em Spell [Avançado]


danilo9317

Posts Recomendados

Ta sendo um desafio pra mim, estou a 3 dias tentando arrumar isso. Tenho uma magia com um sistema que empurra o jogador para direção que ele estiver olhando, porem não consigo colocar dano nessa magia com formula porque da um dos seguintes erros:

 

Erros

 

 

[19/03/2012 14:47:48] data/spells/scripts/outras/ice push.lua:onCastSpell

[19/03/2012 14:47:48] Description:

[19/03/2012 14:47:48] (luaCreateCombatArea) This function can only be used while loading the script.

 

ou

 

[19/03/2012 15:03:15] [C]: in function 'getn'

[19/03/2012 15:03:15] data/lib/Getposfromarea.lua:2: in function 'getPosfromArea'

[19/03/2012 15:03:15] data/spells/scripts/outras/ice push.lua:72: in function <data/spells/scripts/outras/ice push.lua:55>

 

 

 

As formas que eu tentei foram essas:

 

Usando local combat

 

 

local combat1 = createCombatObject()

setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

function onGetFormulaValues(cid, level, skill)

 

min = -(level * 0.90 + skill * 0.70) * 1.0

max = -(level * 1.00 + skill * 0.80) * 1.0

 

return min, max

end

 

setCombatCallback(combat1, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

 

local function UM(cid)

local area1 = {

{0, 0, 0},

{0, 0, 0},

{1, 1, 1},

{0, 1, 0},

{0, 3, 0},

{0, 0, 0},

{0, 0, 0},

{0, 0, 0},

{0, 0, 0},

}

 

pos = getPosfromArea(cid,area1)

n = 0

 

local area1 = createCombatArea(area1)

setCombatArea(combat1, area1)

 

while n < #pos do

n = n+1

doSendMagicEffect(pos[n],2)

thing = {x=pos[n].x,y=pos[n].y,z=pos[n].z,stackpos=253}

if isCreature(getThingfromPos(thing).uid) == TRUE then

doPushCreature(getThingfromPos(thing).uid,getPlayerLookDir(cid))

end

end

end

 

 

local combat2 = createCombatObject()

setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

function onGetFormulaValues(cid, level, skill)

 

min = -(level * 0.90 + skill * 0.70) * 1.0

max = -(level * 1.00 + skill * 0.80) * 1.0

 

return min, max

end

 

setCombatCallback(combat2, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

 

local function DOIS(cid)

local area2 = {

{1, 1, 1},

{1, 1, 1},

{0, 0, 0},

{0, 0, 0},

{0, 3, 0},

{0, 0, 0},

{0, 0, 0},

{0, 0, 0},

{0, 0, 0},

}

 

 

pos = getPosfromArea(cid,area2)

n = 0

 

 

while n < #pos do

n = n+1

doSendMagicEffect(pos[n],2)

thing = {x=pos[n].x,y=pos[n].y,z=pos[n].z,stackpos=253}

if isCreature(getThingfromPos(thing).uid) == TRUE then

doPushCreature(getThingfromPos(thing).uid,getPlayerLookDir(cid))

end

end

end

 

 

function onCastSpell(cid, words, param)

doSendAnimatedText(getThingPos(cid), "Ice", 215)

addEvent(UM, 1, cid)

addEvent(DOIS, 300, cid)

return TRUE

end

 

 

 

Usando function oncastspell

 

 

 

function onCastSpell(cid, words, param)

 

local function UM(cid)

local area = {

{0, 0, 0},

{0, 0, 0},

{1, 1, 1},

{0, 1, 0},

{0, 3, 0},

{0, 0, 0},

{0, 0, 0},

{0, 0, 0},

{0, 0, 0},

}

 

pos = getPosfromArea(cid,area)

n = 0

 

while n < #pos do

n = n+1

doSendMagicEffect(pos[n],2)

thing = {x=pos[n].x,y=pos[n].y,z=pos[n].z,stackpos=253}

if isCreature(getThingfromPos(thing).uid) == TRUE then

doPushCreature(getThingfromPos(thing).uid,getPlayerLookDir(cid))

end

end

 

end

 

local function DOIS(cid)

local area = {

{1, 1, 1},

{1, 1, 1},

{0, 0, 0},

{0, 0, 0},

{0, 3, 0},

{0, 0, 0},

{0, 0, 0},

{0, 0, 0},

{0, 0, 0},

}

 

pos = getPosfromArea(cid,area)

n = 0

 

while n < #pos do

n = n+1

doSendMagicEffect(pos[n],2)

thing = {x=pos[n].x,y=pos[n].y,z=pos[n].z,stackpos=253}

if isCreature(getThingfromPos(thing).uid) == TRUE then

doPushCreature(getThingfromPos(thing).uid,getPlayerLookDir(cid))

end

end

end

 

doSendAnimatedText(getThingPos(cid), "Ice", 215)

addEvent(UM, 1, cid)

addEvent(DOIS, 300, cid)

return TRUE

end

Esse eu consigo fazer a magia funcionar sem erros, só que não consigo colocar a formula de attack . Se alguem consegui use a formula que eu passei no spell de cima.

 

 

Link para o comentário
Compartilhar em outros sites

tenta assim

 

function onCastSpell(cid, words, param)

 

function onGetFormulaValues(cid, level, skill)

 

min = -(level * 0.90 + skill * 0.70) * 1.0

max = -(level * 1.00 + skill * 0.80) * 1.0

end

 

local function UM(cid)

local area = {

{0, 0, 0},

{0, 0, 0},

{1, 1, 1},

{0, 1, 0},

{0, 3, 0},

{0, 0, 0},

{0, 0, 0},

{0, 0, 0},

{0, 0, 0},

}

 

pos = getPosfromArea(cid,area)

n = 0

 

while n < #pos do

n = n+1

doAreaCombatHealth(cid, COMBAT_PHYSICALDAMAGE, pos[n], {3}, min, max, 2)

thing = {x=pos[n].x,y=pos[n].y,z=pos[n].z,stackpos=253}

if isCreature(getThingfromPos(thing).uid) == TRUE then

doPushCreature(getThingfromPos(thing).uid,getPlayerLookDir(cid))

end

end

 

end

 

local function DOIS(cid)

local area = {

{1, 1, 1},

{1, 1, 1},

{0, 0, 0},

{0, 0, 0},

{0, 3, 0},

{0, 0, 0},

{0, 0, 0},

{0, 0, 0},

{0, 0, 0},

}

 

pos = getPosfromArea(cid,area)

n = 0

 

while n < #pos do

n = n+1

doAreaCombatHealth(cid, COMBAT_PHYSICALDAMAGE, pos[n], {3}, min, max, 2)

thing = {x=pos[n].x,y=pos[n].y,z=pos[n].z,stackpos=253}

if isCreature(getThingfromPos(thing).uid) == TRUE then

doPushCreature(getThingfromPos(thing).uid,getPlayerLookDir(cid))

end

end

end

 

doSendAnimatedText(getThingPos(cid), "Ice", 215)

addEvent(UM, 1, cid)

addEvent(DOIS, 300, cid)

return TRUE

end

 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...