TH
dúvida

Editar dano dessa magia

Por Thiach, 15 de abr. de 2013 em Scripts

resolvido
8
1.2k
ThiachT
15 de abril de 2013 às 08:09

Pelo amor de deus, alguma alma caridosa me ajuda? preciso colocar o dano dessa magia baseado em magic level ou skill, pelo amor de deus, eu vo ficar dando rep pra essa pessoa que me ajudar por 1 Mes!

 

SPELL:

 

 

local config = {
efeitoTele = 134, -- efeito q ira aparacer a cada teleport.
efeitoDamage = 134, -- efeito q ira aparecer ao hitar no alvo
hits = 1, -- quantos hits vai dar
delay = 600, -- intervalo de tempo a cada hit
min = 37330, -- dano minimo
max = 38550, -- dano maximo
damage = COMBAT_PHYSICALDAMAGE -- tipo do dano
}
function isWalkable(pos, creature, pz, proj) -- nord
	if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
	if getTopCreature(pos).uid > 0 and creature then return false end
	if getTileInfo(pos).protection and not pz then return false end
	local n = not proj and 3 or 2
	for i = 0, 255 do
									pos.stackpos = i
									local tile = getTileThingByPos(pos)
									if tile.itemid ~= 0 and not isCreature(tile.uid) then
																	if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
																									return false
																	end
									end
	end
	return true
end
function getPosDirs(p, dir) -- mkalo
	return dir == 1 and {x=p.x-1, y=p.y, z=p.z} or dir == 2 and {x=p.x-1, y=p.y+1, z=p.z} or dir == 3 and {x=p.x, y=p.y+1, z=p.z} or dir == 4 and {x=p.x+1, y=p.y+1, z=p.z} or dir == 5 and {x=p.x+1, y=p.y, z=p.z} or dir == 6 and {x=p.x+1, y=p.y-1, z=p.z} or dir == 7 and {x=p.x, y=p.y-1, z=p.z} or dir == 8 and {x=p.x-1, y=p.y-1, z=p.z}
end
function validPos(pos)
tb = {}
for i = 1, 8 do
 newpos = getPosDirs(pos, i)
 if isWalkable(newpos) then
  table.insert(tb, newpos)
 end
end
table.insert(tb, pos)
return tb
end
spell3 = {
start3 = function (cid, target, markpos, hits)
	if not isCreature(cid) then return true end
	if not isCreature(target) or hits < 1 then
							 doTeleportThing(cid, markpos)
							 doSendMagicEffect(getThingPos(cid), config.efeitoTele)
							 return true
	end
	posAv = validPos(getThingPos(target))
	rand = #posAv == 1 and 1 or #posAv - 1
	doSendMagicEffect(getThingPos(cid), config.efeitoTele)
	doTeleportThing(cid, posAv[math.random(1, rand)])
	doAreaCombatHealth(cid, config.damage, getThingPos(target), 0, -config.min, -config.max, config.efeitoDamage)
	addEvent(spell3.start3, config.delay, cid, target, markpos, hits - 1)
  end
}
function onCastSpell(cid)
local position1 = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
local position2 = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}
local position3 = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+1, z=getThingPosition(getCreatureTarget(cid)).z}
target = getCreatureTarget(cid)
if target then
 spell3.start3(cid, target, getThingPos(cid), config.hits)
doSendMagicEffect(position1, 39)
doSendMagicEffect(position2, 40)
doSendMagicEffect(position3, 100)
end
return true
end

 

help ae

Editado Abril 15 por Thiach

portlandP
15 de abril de 2013 às 13:47

Mude para isso:

 

local config = {

efeitoTele = 134, -- efeito q ira aparacer a cada teleport.

efeitoDamage = 134, -- efeito q ira aparecer ao hitar no alvo

hits = 1, -- quantos hits vai dar

delay = 600, -- intervalo de tempo a cada hit

min = 50 -- dano minimo padrão (exemplo: se for level 0 e magic 0 vai bater de 50)

magicFormula = 1 -- o numero de vezes o magic level do player que vai ser adicionado em Dano (se colocar 1 vai adicionar o magic level atual do player ao dano da magia)

levelFormula = 1 -- o numero de vezes o level do player que vai ser adicionado em Dano (se colocar 1 vai adicionar o level atual do player ao dano da magia)

damage = COMBAT_PHYSICALDAMAGE -- tipo do dano

}

function isWalkable(pos, creature, pz, proj) -- nord

if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end

if getTopCreature(pos).uid > 0 and creature then return false end

if getTileInfo(pos).protection and not pz then return false end

local n = not proj and 3 or 2

for i = 0, 255 do

pos.stackpos = i

local tile = getTileThingByPos(pos)

if tile.itemid ~= 0 and not isCreature(tile.uid) then

if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then

return false

end

end

end

return true

end

function getPosDirs(p, dir) -- mkalo

return dir == 1 and {x=p.x-1, y=p.y, z=p.z} or dir == 2 and {x=p.x-1, y=p.y+1, z=p.z} or dir == 3 and {x=p.x, y=p.y+1, z=p.z} or dir == 4 and {x=p.x+1, y=p.y+1, z=p.z} or dir == 5 and {x=p.x+1, y=p.y, z=p.z} or dir == 6 and {x=p.x+1, y=p.y-1, z=p.z} or dir == 7 and {x=p.x, y=p.y-1, z=p.z} or dir == 8 and {x=p.x-1, y=p.y-1, z=p.z}

end

function validPos(pos)

tb = {}

for i = 1, 8 do

newpos = getPosDirs(pos, i)

if isWalkable(newpos) then

table.insert(tb, newpos)

end

end

table.insert(tb, pos)

return tb

end

spell3 = {

start3 = function (cid, target, markpos, hits)

local level = getPlayerLevel(cid)

local magic = getPlayerMagLevel(cid)

if not isCreature(cid) then return true end

if not isCreature(target) or hits < 1 then

doTeleportThing(cid, markpos)

doSendMagicEffect(getThingPos(cid), config.efeitoTele)

return true

end

posAv = validPos(getThingPos(target))

rand = #posAv == 1 and 1 or #posAv - 1

doSendMagicEffect(getThingPos(cid), config.efeitoTele)

doTeleportThing(cid, posAv[math.random(1, rand)])

doAreaCombatHealth(cid, config.damage, getThingPos(target), 0, -(config.levelFormula*0.75)+(config.magicFormula*0.75)+config.min, -(config.levelFormula*1.15)+(config.magicFormula*1.15)+config.min, config.efeitoDamage)

addEvent(spell3.start3, config.delay, cid, target, markpos, hits - 1)

end

}

function onCastSpell(cid)

local position1 = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}

local position2 = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}

local position3 = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+1, z=getThingPosition(getCreatureTarget(cid)).z}

target = getCreatureTarget(cid)

if target then

spell3.start3(cid, target, getThingPos(cid), config.hits)

doSendMagicEffect(position1, 39)

doSendMagicEffect(position2, 40)

doSendMagicEffect(position3, 100)

end

return true

end

 

Adicionei magicFormula e levelFormula, vc ira definir o tanto de vezes o level e magic level do char vai adicionar a magia.

A variação de min e maximo eu coloquei pra variar moderadamente.

 

Espero ter ajudado! mdr.gif

Editado Abril 15 por Portland

ThiachT
15 de abril de 2013 às 13:58

Vlw mano vo testar, so 1 coisa..

 

se nao for pedir muito, vc pode fazer a mesma coisa so que com skills?

 

Deu esse erro aqui:

 

 

[15/04/2013 13:52:33] [Error - LuaScriptInterface::loadFile] data/spells/scripts/lee/urarenge.lua:7: '}' expected (to close '{' at line 1) near 'magicFormula'

[15/04/2013 13:52:33] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/lee/urarenge.lua)

[15/04/2013 13:52:33] data/spells/scripts/lee/urarenge.lua:7: '}' expected (to close '{' at line 1) near 'magicFormula'

 

Acho que ja sei qual erro , perae

 

Ae, consegui resolver o erro, era só colocar uma virgula nos configs novos.. agora sobre a magia com skills, vc pode ajudar se nao for pedir mtu? vlw

 

EDIT---

 

A spell nao esta batendo dano nenhum, =S

portlandP
15 de abril de 2013 às 14:30

espera que vo da uma olhada de novo, to com sono hoje =/

Editado Abril 15 por Portland

ThiachT
15 de abril de 2013 às 14:34

Beleza to no aguardo

portlandP
15 de abril de 2013 às 14:40
local config = {

efeitoTele = 134, -- efeito q ira aparacer a cada teleport.

efeitoDamage = 134, -- efeito q ira aparecer ao hitar no alvo

hits = 1, -- quantos hits vai dar

delay = 600, -- intervalo de tempo a cada hit

min = 50, -- dano minimo padrão (exemplo: se for level 0 e magic 0 vai bater de 50)

magicFormula = 1, -- o numero de vezes o magic level do player que vai ser adicionado em Dano (se colocar 1 vai adicionar o magic level atual do player ao dano da magia)

levelFormula = 1, -- o numero de vezes o level do player que vai ser adicionado em Dano (se colocar 1 vai adicionar o level atual do player ao dano da magia)

damage = COMBAT_PHYSICALDAMAGE -- tipo do dano

}

function isWalkable(pos, creature, pz, proj) -- nord

if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end

if getTopCreature(pos).uid > 0 and creature then return false end

if getTileInfo(pos).protection and not pz then return false end

local n = not proj and 3 or 2

for i = 0, 255 do

pos.stackpos = i

local tile = getTileThingByPos(pos)

if tile.itemid ~= 0 and not isCreature(tile.uid) then

if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then

return false

end

end

end

return true

end

function getPosDirs(p, dir) -- mkalo

return dir == 1 and {x=p.x-1, y=p.y, z=p.z} or dir == 2 and {x=p.x-1, y=p.y+1, z=p.z} or dir == 3 and {x=p.x, y=p.y+1, z=p.z} or dir == 4 and {x=p.x+1, y=p.y+1, z=p.z} or dir == 5 and {x=p.x+1, y=p.y, z=p.z} or dir == 6 and {x=p.x+1, y=p.y-1, z=p.z} or dir == 7 and {x=p.x, y=p.y-1, z=p.z} or dir == 8 and {x=p.x-1, y=p.y-1, z=p.z}

end

function validPos(pos)

tb = {}

for i = 1, 8 do

newpos = getPosDirs(pos, i)

if isWalkable(newpos) then

table.insert(tb, newpos)

end

end

table.insert(tb, pos)

return tb

end

spell3 = {

start3 = function (cid, target, markpos, hits)

local level = getPlayerLevel(cid)

local magic = getPlayerMagLevel(cid)

if not isCreature(cid) then return true end

if not isCreature(target) or hits < 1 then

doTeleportThing(cid, markpos)

doSendMagicEffect(getThingPos(cid), config.efeitoTele)

return true

end

posAv = validPos(getThingPos(target))

rand = #posAv == 1 and 1 or #posAv - 1

doSendMagicEffect(getThingPos(cid), config.efeitoTele)

doTeleportThing(cid, posAv[math.random(1, rand)])

doAreaCombatHealth(cid, config.damage, getThingPos(target), 0, -(config.levelFormula*level*0.7)+(config.magicFormula*magic*0.75)+config.min, -(config.levelFormula*level*1.05)+(config.magicFormula*magic*1.15)+config.min, config.efeitoDamage)

addEvent(spell3.start3, config.delay, cid, target, markpos, hits - 1)

end

}

function onCastSpell(cid)

local position1 = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}

local position2 = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}

local position3 = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+1, z=getThingPosition(getCreatureTarget(cid)).z}

target = getCreatureTarget(cid)

if target then

spell3.start3(cid, target, getThingPos(cid), config.hits)

doSendMagicEffect(position1, 39)

doSendMagicEffect(position2, 40)

doSendMagicEffect(position3, 100)

end

return true

end

 

Agora vai, foi mal ae, eh que to com sono, dormi 3:30 de sono hoje só.

ThiachT
15 de abril de 2013 às 15:46

vlw manoo, muito obrigado! REP+ PRA VC! durante 1 mes, vlw

RoksasR
17 de abril de 2013 às 19:49

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