• 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!

Spell Display animated animations with mana and health healing effect, with matching colors, etc.

Mateus Robeerto

Excellent OT User
Joined
Jun 5, 2016
Messages
1,337
Solutions
71
Reaction score
697
Location
ლ(ಠ益ಠლ)
I'll explain step by step how to add an animated effect to display the number of healing and mana.

Here is an example of the original UH (ultimate_healing) spell. TFS 1.5 8.0 Nekiro.

Lua:
local combat = Combat()

combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)

combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)

combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)

combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)

function onGetFormulaValues(player, level, magicLevel)

    local min = (level / 5) + (magicLevel * 6.8) + 42

    local max = (level / 5) + (magicLevel * 12.9) + 90

    return min, max

end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)

    return combat:execute(creature, variant)

end

Let's work on how to correctly replace the proper place.

Lua:
return min, max

for this

Lua:
local totalIncrease = math.random(min, max)

    local formattedText = string.format("+%d", totalIncrease)

    doSendAnimatedText(formattedText, getPlayerPosition(cid), 12)

    return totalIncrease, totalIncrease


Look how the end result is here.

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 6.8) + 42
    local max = (level / 5) + (magicLevel * 12.9) + 90
 
    local totalIncrease = math.random(min, max)
    local formattedText = string.format("+%d", totalIncrease)
    Game.sendAnimatedText(formattedText, player:getPosition(), 12)

    return totalIncrease, totalIncrease
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end

In green color it is 12, if you want to change it, just modify that line.

Lua:
doSendAnimatedText(formattedText, getPlayerPosition(cid), 12)

See the GIF to check the result

Please, after making the changes or modifications, let us know here so we know if it worked or not.

Note: For those of you who don't have text animation in your source, you need to add it to the source for the animated text display to work correctly.

Hope you enjoyed this script.😏
 
Last edited:
Back
Top