Ir para conteúdo

transforma esse script em spell


rohfagundes

Posts Recomendados

alguem ai consegui tranforma esse script em spell

eu peguei esse script em outro forum

ele é junto com Soul System

 

function checkDam(uid, AurAz, st)

if (isCreature(uid)) and (os.time() - st < L_Soul.auras[AurAz].duration)then

local p = getThingPos(uid)

local poz = {{x = p.x, y = p.y - 2, z = p.z},

{x = p.x - 2, y = p.y, z = p.z},

{x = p.x, y = p.y + 2, z = p.z},

{x = p.x + 2, y = p.y, z = p.z},}

 

if (getTileInfo(p).protection) then

st = st - L_Soul.auras[AurAz].duration

end

 

local function getBest(a)

local pz = poz[1]

for i, v in pairs(poz) do

if (getDistanceBetween(v, getThingPos(a)) < getDistanceBetween(pz, getThingPos(a))) then

pz = v

end

end

return pz

end

 

local creat = getUidsInArea({x = p.x - L_Soul.auras[AurAz].raio, y = p.y - L_Soul.auras[AurAz].raio, z = p.z}, {x = p.x + L_Soul.auras[AurAz].raio, y = p.y + L_Soul.auras[AurAz].raio, z = p.z})

local target = ((isCreature(getCreatureTarget(uid))) and getCreatureTarget(uid)) or 0

 

local cs = {}

if (target == 0) then

for _, v in pairs(creat) do

if ((getCreatureTarget(v) == uid)) or ((isMonster(v)) or ((getCreatureSkullType(v) > 2) and (getCreatureTarget(v) == uid))) and (v ~= uid) then

table.insert(cs, v)

end

end

target = (#cs > 0 and cs[math.random(#cs)]) or 0

end

 

if (target ~= 0) then

doSendDistanceShoot(getBest(target), getThingPos(target), L_Soul.souls[AurAz].effects.distance)

doTargetCombatHealth(uid, target, L_Soul.souls[AurAz].combat, -L_Soul.auras[AurAz].damage[1], -L_Soul.auras[AurAz].damage[2], 255)

end

 

addEvent(checkDam, L_Soul.auras[AurAz].interval, uid, AurAz, st)

end

end

 

function sendEffect(uid, interval, at, st, AurAz)

local at = at or 1

 

if (isCreature(uid)) then

local p = getThingPos(uid)

 

if (getTileInfo(p).protection) then

st = st - L_Soul.auras[AurAz].duration

end

 

local poz = {{x = p.x, y = p.y - 2, z = p.z},

{x = p.x - 2, y = p.y, z = p.z},

{x = p.x, y = p.y + 2, z = p.z},

{x = p.x + 2, y = p.y, z = p.z},}

 

if (os.time() - st > L_Soul.auras[AurAz].duration) then

for i, v in ipairs(poz) do

doSendDistanceShoot(v, p, L_Soul.souls[AurAz].effects.distance)

end

setPlayerStorageValue(uid, L_Soul.auras_sto, -1)

addEvent(doSendMagicEffect, 250, p, L_Soul.souls[AurAz].effects.eff)

return true

end

 

local next = poz[at + 1] and at+1 or 1

doSendDistanceShoot(poz[at], poz[next], L_Soul.souls[AurAz].effects.distance)

addEvent(sendEffect, interval, uid, interval, next, st, AurAz)

end

 

return true

end

 

function onSay(cid, words, param)

domodlib("Soul System[LIB]")

 

local lan = L_Soul.lang[L_Soul.language]

 

local AurAz = words:explode(" ")[1]

 

if not (L_Soul.auras[AurAz]) then

return false

end

 

if (#getPlayerSoulStonesByType(cid, AurAz) < L_Soul.auras[AurAz].stones_n) then

return doPlayerSendCancel(cid, string.format(lan[19], AurAz, L_Soul.auras[AurAz].stones_n))

end

 

if (getPlayerStorageValue(cid, L_Soul.auras_sto) > 0) then

return doPlayerSendCancel(cid, string.format(lan[20], math.floor(L_Soul.auras[AurAz].duration/60)))

end

 

if (getTileInfo(getThingPos(cid)).protection) then

return doPlayerSendCancel(cid, lan[21])

end

 

setPlayerStorageValue(cid, L_Soul.auras_sto, os.time())

doPlayerRemoveSoulStoneByType(cid, AurAz, L_Soul.auras[AurAz].stones_n)

sendEffect(cid, L_Soul.auras[AurAz].speed, nil, os.time(), AurAz)

checkDam(cid, AurAz, os.time())

return true

end

 

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...