• 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 mw timerwith animatedtext script with multiple colors and playername who used the mw in there too animated text

johnsamir

Advanced OT User
Joined
Oct 13, 2009
Messages
965
Solutions
6
Reaction score
165
Location
Nowhere
Lua:
--[[SevuEntertainment(c)]]--
local recAnimateText = false
local startSeconds = 20

local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_MAGICWALL)

mwCountDownStart = function(position, seconds)
    local spectators = Game.getSpectators(position, false, true, 7, 7, 7, 7)
    if #spectators > 0 then
        for _, spectator in ipairs(spectators) do
            local animatedText = tostring(seconds)
            Game.sendAnimatedText(animatedText, position, 180) --- color red here
        end
    end
    if seconds > 0 then
        addEvent(mwCountDownStart, 1000, position, seconds - 1)
    end
end
function onCastSpell(creature, variant, isHotkey)
    if combat:execute(creature, variant) then
        mwCountDownStart(Variant.getPosition(variant), startSeconds)
        return true
    end
    return false
end
i have this mw timer script that has animated text in it.
up would be possible to add the name of the player that used the mwall in animated text too?
and maybe add multiple color like changing? you made an script a time ago that does that


a time ago @Mateus Robeerto

MADE THIS SCRIPT WHICH sen animated text in multilpe colors​

Code:
local globalevent = GlobalEvent("positionandtext")
local textcolors = {5, 30, 35, 95, 108, 129, 143, 155, 180, 198, 210, 215}

local effects = {
    {position = Position(32366, 32235, 7), text = 'Training Monks!', effect = CONST_ME_BATS},
    --{position = Position(723, 594, 8), text = 'Treiner!', effect = CONST_ME_GIANTICE},
    --{position = Position(305, 885, 8), text = 'Treinamento Offline!', effect = CONST_ME_BATS},
    --{position = Position(2030, 481, 5), text = 'Skills Up!', effect = CONST_ME_BATS},
   -- {position = Position(721, 593, 7), text = 'Clique!', effect = CONST_ME_GIANTICE},
}

function globalevent.onThink(interval)
    for i = 1, #effects do
        local settings = effects[i]
        local spectators = Game.getSpectators(settings.position, false, true, 7, 7, 5, 5)
        if #spectators > 0 then
            if settings.text then
                local textcolor = textcolors[math.random(#textcolors)]
                Game.sendAnimatedText(settings.text, settings.position, textcolor)
            end
            if settings.effect then
                settings.position:sendMagicEffect(settings.effect)
            end
            if settings.effect2 then
                settings.position:sendMagicEffect(settings.effect2)
            end
        end
    end
    return true
end

globalevent:interval(2000)
globalevent:register()
i will appreciate any help, thank you in advance
 
Lua:
--[[SevuEntertainment(c)]]--
local recAnimateText = false
local startSeconds = 20

local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_MAGICWALL)

mwCountDownStart = function(position, seconds)
    local spectators = Game.getSpectators(position, false, true, 7, 7, 7, 7)
    if #spectators > 0 then
        for _, spectator in ipairs(spectators) do
            local animatedText = tostring(seconds)
            local colorIndex = math.random(1, 215)
            Game.sendAnimatedText(animatedText, position, colorIndex)
        end
    end
    if seconds > 0 then
        addEvent(mwCountDownStart, 1000, position, seconds - 1)
    end
end

function onCastSpell(creature, variant, isHotkey)
    if combat:execute(creature, variant) then
        mwCountDownStart(Variant.getPosition(variant), startSeconds)
        return true
    end
    return false
end
 
Last edited:
Back
Top