Ir para conteúdo
  • 0

Ajuda Aqui Em Spell De Empurrar Com Dano! Difííícil!


Kyriebr

Pergunta

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

 

Erros

 

 

 

 

 

Quote

 

[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

 

 

 

 

 

Quote

 

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

 

 

 

 

 

Quote

 

 

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

Alguem me ajuda por favor, essa ultima empurra mas nao da dano, alguem pode me ajudar??

REP+ pra quem solucionar por 1 mes vei, de verdade

Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0
function getPosfromArea1(cid,area)
icenter = math.floor(table.getn(area)/2)+1
jcenter = math.floor(table.getn(area[1])/2)+1
center = area[icenter]
ivar = table.getn(area)
jvar = table.getn(area[1])
i = table.getn(area)^2
j = table.getn(area[1])^2

  if center[jcenter] == 3 then
	  if getPlayerLookDir(cid) == 0 then
	  signal = {-1,1,1,2}
	  elseif getPlayerLookDir(cid) == 1 then
	  signal = {1,-1,2,1}
	  elseif getPlayerLookDir(cid) == 2 then
	  signal = {1,-1,1,2}
	  else
	  signal = {-1,1,2,1}
	  end
  else
  signal = {-1,1,1,2}
  end

POSITIONS = {}  
P = 0

repeat
pvar = {0,0}
I = area[ivar]
J = I[jvar]
i = i-1
j = j-1
  if J == 1 then
	  if jvar < jcenter then  
	  pvar[signal[3]] = signal[1]*math.abs((jcenter-jvar))
	  elseif jvar > jcenter then  
	  pvar[signal[3]] = signal[2]*math.abs((jcenter-jvar))
	  end

	  if ivar < icenter then  
	  pvar[signal[4]] = signal[1]*math.abs((icenter-ivar))
	  elseif ivar > icenter then
	  pvar[signal[4]] = signal[2]*math.abs((icenter-ivar))
	  end
  end    
  if jvar > 1 then
  jvar = (jvar-1)
  elseif ivar > 1 then
  jvar = table.getn(area[1])
  ivar = (ivar-1)
  end  
local pos = getThingPos(cid)
local areapos = {x=pos.x+(pvar[1]),y=pos.y+(pvar[2]),z=pos.z}  
  if pos.x ~= areapos.x or pos.y ~= areapos.y then
  P = P+1
  POSITIONS[P] = areapos
  end   
until i <= 0 and j <= 0

return POSITIONS
end

function doPushCreature1(cid,uid,direction,distance,time)
if isCreature(uid) == TRUE then
   local rand = (2*math.random(0,1))-1
   local rand2 = math.random(-1,0)
   if direction == 0 then
       signal = {0,rand,-rand,rand,-rand,0,-1,-1,-1,0,0,0}
       elseif direction == 1 then
       signal = {1,1,1,0,0,0,0,rand,-rand,rand,-rand,0}
   elseif direction == 2 then
       signal = {0,rand,-rand,rand,-rand,0,1,1,1,0,0,0}
   elseif direction == 3 then
       signal = {-1,-1,-1,0,0,0,0,rand,-rand,rand,-rand,0}
   elseif direction == 4 then
       signal = {-1,rand2,(-rand2)-1,0,1,rand2+1,rand2,0}
   elseif direction == 5 then
       signal = {1,-rand2,-((-rand2)-1),0,1,rand2+1,rand2,0}
   elseif direction == 6 then
       signal = {-1,rand2,(-rand2)-1,0,-1,(-rand2)-1,rand2,0}
   else
       signal = {1,-rand2,-((-rand2)-1),0,-1,(-rand2)-1,rand2,0}
   end
   local pos = getThingPos(uid)
   nsig = #signal
   nvar = 0
   repeat
       nvar = nvar+1
       newpos = {x=pos.x+(signal[nvar]),y=pos.y+(signal[(nsig/2)+nvar]),z=pos.z}
       newtile = {x=newpos.x,y=newpos.y,z=newpos.z,stackpos=0}
   until getTileThingByPos(newtile).uid ~= 0 and hasProperty(getTileThingByPos(newtile).uid,3) == FALSE and queryTileAddThing(uid,newpos) == 1 or nvar == (nsig/2)
   if distance == nil or distance == 1 then
       local hit = math.random((getPlayerLevel(cid) * 0.90 + getPlayerMagLevel(cid) * 0.70) * 1.0,(getPlayerLevel(cid) * 1.00 + getPlayerMagLevel(cid) * 0.80) * 1.0)
       doTeleportThing(uid,newpos,TRUE)        
       doSendMagicEffect(getCreaturePosition(uid), 43) -- 12, effect ao acertar o player.
       if getCreatureHealth(uid) > hit then
           if getCreatureHealth(uid) > 0 then
               doSendAnimatedText(getCreaturePosition(uid), hit, 144)
           end
           doCreatureAddHealth(uid, -hit)
       else
           if getCreatureHealth(uid) > 0 then
               doSendAnimatedText(getCreaturePosition(uid), getCreatureHealth(uid), 144)
           end
           doCreatureAddHealth(uid, -getCreatureHealth(uid))
       end
   else
   distance = distance-1
   doTeleportThing(uid,newpos,TRUE)
       if time ~= nil then
           addEvent(doPushCreature1,time,cid,uid,direction,distance,time)
       else
           addEvent(doPushCreature1,500,cid,uid,direction,distance,500)
       end
   end
end
end

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 = getPosfromArea1(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
doPushCreature1(cid, 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 = getPosfromArea1(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
doPushCreature1(cid, 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

  • 0

Manow tu eh foda viu? vlw ai vei! sou seu fã, nao te conhecia mas sou seu fã agr!!

vlw manow

tu eh foda cacete

pqp

vlw vei!!

omi to nem acreditando

vlw mano

ta bom...

tu eh foda!

vlwwwwwwwwwwwwwwwwwwwwww

Link para o comentário
Compartilhar em outros sites

  • 0

asuhdau oks. Reportado para moverem para atendidos!

 

Estou vendo que você é um membro novo, então la vai as dicas:

Sempre que um pedido ou duvida sua forem resolvidos, clique no botão denunciar e reporte para que um moderador mova o tópico para área de resolvidos, assim mantendo o fórum mais limpo e organizado.

E como gratidão ao usuário que lhe ajudou, repute ele clicando na setinha verde abaixo de seu post.

Link para o comentário
Compartilhar em outros sites

  • 0

Tem como atualizar para TFS 1.3?

 

Coloquei aqui no servidor, porém só saiu o efeito, não empurrou o alvo e deu erro na distro:

 

Citar

Lua Script Error: [Spell Interface]
data/spells/scripts/support/pull.lua:onCastSpell
LuaScriptInterface::luaDebugPrint(). Deprecated function.
stack traceback:
        [C]: in function 'debugPrint'
        data/lib/compat/compat.lua:609: in function 'doSendAnimatedText'
        data/spells/scripts/support/pull.lua:173: in function <data/spells/scripts/support/pull.lua:119>

Lua Script Error: [Spell Interface]
data/spells/scripts/support/pull.lua:onCastSpell
LuaScriptInterface::luaAddEvent(). Argument #3 is unsafe
stack traceback:
        [C]: in function 'addEvent'
        data/spells/scripts/support/pull.lua:174: in function <data/spells/scripts/support/pull.lua:119>

Lua Script Error: [Spell Interface]
data/spells/scripts/support/pull.lua:onCastSpell
LuaScriptInterface::luaAddEvent(). Argument #3 is unsafe
stack traceback:
        [C]: in function 'addEvent'
        data/spells/scripts/support/pull.lua:175: in function <data/spells/scripts/support/pull.lua:119>

 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...