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

Animated Text - Lua - 1.3

bayview

Banned User
Joined
Jan 25, 2018
Messages
611
Solutions
25
Reaction score
324
I haven't managed to make this work for the regular tibia client but that doesn't mean it shouldn't be released because it can be used for otclient and without editing the sources.
Place this in data\lib\core\creature.lua at the bottom of the page.
Lua:
--[[
    CLIENTOS_NONE = 0,

    CLIENTOS_LINUX = 1,
    CLIENTOS_WINDOWS = 2,
    CLIENTOS_FLASH = 3,

    CLIENTOS_OTCLIENT_LINUX = 10,
    CLIENTOS_OTCLIENT_WINDOWS = 11,
    CLIENTOS_OTCLIENT_MAC = 12,
]]

local function sendColorText(message, color, pos, send, cid)
    local player = Player(cid)
    if not player then
        return
    end
    -- this could also be handled inside of the calling function instead
    local clientid = player:getClient()['os']
    -- if the player is using otclient
    if clientid > 3 then
        local msg = NetworkMessage()
        msg:addByte(0x84)
        msg:addPosition(pos)
        msg:addByte(color)
        msg:addString(message)
        if send and next(send) then
            for i = 1, #send do
                if pos:getDistance(send[i]:getPosition()) <= 7 then
                    msg:sendToPlayer(send[i])
                end
            end
        end
    end
end

function Creature:sendColorText(message, pos, color, interval, canSee)
    -- Creature:sendColorText(message, position, color[, interval[, canSee]])
    if not self then
        return
    end
   
    local specs = Game.getSpectators(pos, false, true, 0, 8, 0, 6)
    local send = {}
    for i = 1, #specs do
        -- send to specific names
        if (canSee and next(canSee)) and isInArray(canSee, specs[i]:getName()) then
            send[#send+1] = specs[i]
        else
            -- or send it to everyone
            send[#send+1] = specs[i]
        end
    end
    send = (next(send) and send) or specs
    interval = type(color) == 'table' and #color or interval
    for x = 1, interval do
        if type(color) == 'table' then
            addEvent(sendColorText, 1000 * x, message, color[x], pos, send, self:getId())
        else
            addEvent(sendColorText, 1000 * x, message, color, pos, send, self:getId())
        end
    end
    return true
end
 
works:
creature:sendColorText(named, Position, 30, 1, {''..Playername1..'', 'Playername2'})


canSee <-- dont works
 
Back
Top