• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Distance effect in spell!

boxxer321

Active Member
Joined
Nov 5, 2011
Messages
106
Reaction score
34
Can anyone add distance effect in this spell?

local function suck(cid, target)
if isCreature(cid) then
if isCreature(target) then
local formula = math.random(getPlayerLevel(cid), getPlayerLevel(cid) * 10)

doCreatureAddHealth(cid, formula)
doCreatureAddHealth(target, -formula)
doSendAnimatedText(getThingPos(cid), "+"..formula, COLOR_GREEN)
doSendAnimatedText(getThingPos(target), "-"..formula, COLOR_RED)
doSendMagicEffect(getThingPos(cid), 12)
doSendMagicEffect(getThingPos(target), 45)
return true
end
end
return true
end

function onCastSpell(cid)
local config = {
arrounds = 3, -- Vezes que a magia vai atacar
exaust = 5, -- tempo de exaust -> 1 = 1s
level = 50,
mana = 4500, -- Mana que vai gastar
time = 1000, -- tempo para executar a magia novamente (arrounds) -> 1 = 1s
t = getCreatureTarget(cid), --- Não mexa.
}

if config.t <= 0 then

doPlayerSendCancel(cid, "You need a target.")
return false
end

if getCreatureMana(cid) < config.mana then

doPlayerSendCancel(cid, "You need "..config.mana.." of mana to cast this spell.")
return false
end

if getPlayerLevel(cid) < config.level then

doPlayerSendCancel(cid, "You need level "..config.level.." to cast this spell.")
return false
end

if exhaustion.get(cid, 21511) then

doPlayerSendCancel(cid, "You need wait "..exhaustion.get(cid, 21511).." seconds.")
return false
end

exhaustion.set(cid, 21511, config.exaust)
doCreatureAddMana(cid, - config.mana)
doCreatureSay(cid, "BLOOD SUCK", TALKTYPE_MONSTER)

for a = 1, config.arrounds do

addEvent(suck, config.time * a, cid, config.t)
end
return false
end
 
Solution
Try this one and use code tags/post your TFS version next time.
Lua:
local function suck(cid, target)
if isCreature(cid) then
if isCreature(target) then
local formula = math.random(getPlayerLevel(cid), getPlayerLevel(cid) * 10)

doCreatureAddHealth(cid, formula)
doCreatureAddHealth(target, -formula)
doSendAnimatedText(getThingPos(cid), "+"..formula, COLOR_GREEN)
doSendAnimatedText(getThingPos(target), "-"..formula, COLOR_RED)
doSendMagicEffect(getThingPos(cid), 12)
doSendMagicEffect(getThingPos(target), 45)
doSendDistanceShoot(getThingPos(cid), getThingPos(target), CONST_ANI_ENERGY)
return true
end
end
return true
end

function onCastSpell(cid)
local config = {
arrounds = 3, -- Vezes que a magia vai atacar
exaust = 5, -- tempo de exaust...
Try this one and use code tags/post your TFS version next time.
Lua:
local function suck(cid, target)
if isCreature(cid) then
if isCreature(target) then
local formula = math.random(getPlayerLevel(cid), getPlayerLevel(cid) * 10)

doCreatureAddHealth(cid, formula)
doCreatureAddHealth(target, -formula)
doSendAnimatedText(getThingPos(cid), "+"..formula, COLOR_GREEN)
doSendAnimatedText(getThingPos(target), "-"..formula, COLOR_RED)
doSendMagicEffect(getThingPos(cid), 12)
doSendMagicEffect(getThingPos(target), 45)
doSendDistanceShoot(getThingPos(cid), getThingPos(target), CONST_ANI_ENERGY)
return true
end
end
return true
end

function onCastSpell(cid)
local config = {
arrounds = 3, -- Vezes que a magia vai atacar
exaust = 5, -- tempo de exaust -> 1 = 1s
level = 50,
mana = 4500, -- Mana que vai gastar
time = 1000, -- tempo para executar a magia novamente (arrounds) -> 1 = 1s
t = getCreatureTarget(cid), --- Não mexa.
}

if config.t <= 0 then

doPlayerSendCancel(cid, "You need a target.")
return false
end

if getCreatureMana(cid) < config.mana then

doPlayerSendCancel(cid, "You need "..config.mana.." of mana to cast this spell.")
return false
end

if getPlayerLevel(cid) < config.level then

doPlayerSendCancel(cid, "You need level "..config.level.." to cast this spell.")
return false
end

if exhaustion.get(cid, 21511) then

doPlayerSendCancel(cid, "You need wait "..exhaustion.get(cid, 21511).." seconds.")
return false
end

exhaustion.set(cid, 21511, config.exaust)
doCreatureAddMana(cid, - config.mana)
doCreatureSay(cid, "BLOOD SUCK", TALKTYPE_MONSTER)

for a = 1, config.arrounds do

addEvent(suck, config.time * a, cid, config.t)
end
return false
end
 
Last edited:
Solution
Try this one and use code tags/post your TFS version next time.
Lua:
local function suck(cid, target)
if isCreature(cid) then
if isCreature(target) then
local formula = math.random(getPlayerLevel(cid), getPlayerLevel(cid) * 10)

doCreatureAddHealth(cid, formula)
doCreatureAddHealth(target, -formula)
doSendAnimatedText(getThingPos(cid), "+"..formula, COLOR_GREEN)
doSendAnimatedText(getThingPos(target), "-"..formula, COLOR_RED)
doSendMagicEffect(getThingPos(cid), 12)
doSendMagicEffect(getThingPos(target), 45)
doSendDistanceShoot(getThingPos(cid), getThingPos(target), CONST_ANI_ENERGY)
return true
end
end
return true
end

function onCastSpell(cid)
local config = {
arrounds = 3, -- Vezes que a magia vai atacar
exaust = 5, -- tempo de exaust -> 1 = 1s
level = 50,
mana = 4500, -- Mana que vai gastar
time = 1000, -- tempo para executar a magia novamente (arrounds) -> 1 = 1s
t = getCreatureTarget(cid), --- Não mexa.
}

if config.t <= 0 then

doPlayerSendCancel(cid, "You need a target.")
return false
end

if getCreatureMana(cid) < config.mana then

doPlayerSendCancel(cid, "You need "..config.mana.." of mana to cast this spell.")
return false
end

if getPlayerLevel(cid) < config.level then

doPlayerSendCancel(cid, "You need level "..config.level.." to cast this spell.")
return false
end

if exhaustion.get(cid, 21511) then

doPlayerSendCancel(cid, "You need wait "..exhaustion.get(cid, 21511).." seconds.")
return false
end

exhaustion.set(cid, 21511, config.exaust)
doCreatureAddMana(cid, - config.mana)
doCreatureSay(cid, "BLOOD SUCK", TALKTYPE_MONSTER)

for a = 1, config.arrounds do

addEvent(suck, config.time * a, cid, config.t)
end
return false
end
thank you!!!!!
 
Back
Top