TFS 1.2
(I know "caster" doesn't exist and that "* targets affected" isn't a valid statement, but I put it there to give you an idea of how I want it to work)
What I want it to do is damage others and heal the user for the total damage done to all creatures affected by it.
I can see a bunch of problems with this spell, but I'm too much of a noob in LUA to fix it.
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_LIFEDRAIN)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))
local healing = Healing()
healing:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
healing:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
healing:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
function onGetFormulaValues(player, level, maglevel)
local min = (maglevel * 10) + 25
local max = (maglevel * 12.5) + 50
if target == caster then
return min, max --* targets affected
end
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
healing:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(creature, variant)
return combat:execute(creature, variant)
return healing:execute(caster, variant)
end
What I want it to do is damage others and heal the user for the total damage done to all creatures affected by it.
I can see a bunch of problems with this spell, but I'm too much of a noob in LUA to fix it.