• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Need help with my "Mass Lifedrain" spell

Demnish

Tibian Hero
Joined
Sep 28, 2011
Messages
401
Solutions
2
Reaction score
63
Location
Sweden
TFS 1.2
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
(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.
 
Back
Top