Here is a spell that I am using and completely nothing happens. I don't use mana and it does nothing and I get no error in console eithier, im using this on 0.4 8.6 which is weird, does anyone know the problem? thankyou if u can help
Code:
local range = 5
local bounces = 4
local anim = CONST_ANI_CAKE
local effect = CONST_ME_MAGIC_BLUE
local combat_type = COMBAT_HEALING
function getPlayerDamage(cid, mina, minb, maxa, maxb, minl, maxl, minm, maxm, minc, maxc)
local min = (getPlayerLevel(cid) / minl + getPlayerMagLevel(cid) * minm) / 100 * mina + minb
local max = (getPlayerLevel(cid) / maxl + getPlayerMagLevel(cid) * maxm) / 100 * maxa + maxb
if(minc and math.abs(min) < math.abs(minc)) then
min = minc
end
if(maxc and math.abs(max) < math.abs(maxc)) then
max = maxc
end
return -math.ceil(math.random(max, min))
end
function attackNextTarget(cid, lastPosition, bounces, ignored, dmg)
local targets = {}
for i, tmpTarget in pairs(getSpectators(lastPosition, range, range)) do
if not(isInArray(ignored, tmpTarget)) and isSightClear(lastPosition, getCreaturePosition(tmpTarget), false) and not(getTileInfo(getCreaturePosition(tmpTarget)).protection) and not(getTileInfo(getCreaturePosition(tmpTarget)).nopvp) and (isPlayer(tmpTarget)) then
table.insert(targets, tmpTarget)
end
end
if(#targets > 0) then
local target = targets[math.random(1, #targets)]
table.insert(ignored, target)
doSendDistanceShoot(lastPosition, getCreaturePosition(target), anim)
doTargetCombatHealth(cid, target, combat_type, dmg, dmg, effect)
if(bounces > 0) then
addEvent(attackNextTarget, 150, cid, getCreaturePosition(target), bounces - 1, ignored, dmg)
end
end
end
function onCastSpell(cid, var)
local target = variantToNumber(var)
if(isPlayer(target)) then
local dmg = -getPlayerDamage(cid, 5, 5, 10, 14, 1, 1, 1, 1)
doSendDistanceShoot(getCreaturePosition(cid), getCreaturePosition(target), anim)
doTargetCombatHealth(cid, target, combat_type, dmg, dmg, effect)
if(bounces > 0) then
attackNextTarget(cid, getCreaturePosition(target), bounces - 1, {target}, dmg)
end
return true
end
return false
end