• 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 Spell buff animation

Raikou

Well-Known Member
Joined
Jul 18, 2007
Messages
145
Solutions
2
Reaction score
54
I got the following working code for a spell that buffs critical skills.
My (luxury) problem is that the animation to show that the buff is active on the person, is in my eyes not the greatest. Though I can't think of another way.
Is there a better way to show that the character is buffed?

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)                -- Initial animation

local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_TICKS, 10000)                        -- Result of (numbers 1 * 2)
condition:setParameter(CONDITION_PARAM_SPECIALSKILL_CRITICALHITCHANCE, 10)    
condition:setParameter(CONDITION_PARAM_SPECIALSKILL_CRITICALHITAMOUNT, 10)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

function buffAnimation(buffedcreature, counter)
    if counter ~= 0 and Creature(buffedcreature) then
        local buffCreature = Creature(buffedcreature)
        local buffedPos = buffCreature:getPosition()
        buffedPos:sendMagicEffect(CONST_ME_LOSEENERGY)                        -- Animation to show character is buffed
        counter = counter - 1
        addEvent(buffAnimation, 200, buffedcreature, counter)                 -- 1 Number  
    end
    return true
end

combat:addCondition(condition)

function onCastSpell(creature, variant)
    creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)                -- Caster animation for doing the spell
    local buffCreature = Creature(variant.number)
    
    addEvent(buffAnimation, 0, buffCreature.uid,50)                         -- 2 number 
    return combat:execute(creature, variant)
end

Oh and if people want, they can of course use this spell. :)
 
Back
Top