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

How to add text when you advance on skill

SixNine

Active Member
Joined
Dec 12, 2018
Messages
442
Reaction score
40
Hello,
so i need something like this, when you advance on level or magic level or any axe fighting, sword fighting etc it would send text above player something like this i will fully explain
(Skill) (whats the text and colors)
Level up - Level (in green)
Magic Level - Magic Level (in random colors)
Axe Fighting - Axe Fighting (in green)
Sword Fighting - Sword Fighting (in green)
Club Fighting - Club Fighting (in green)
And etc with all those skills

TFS 1.2
 
Change "&&" to "and", did change the script in quite a rush haha
Doesnt send any text above player. SendTextMessage doesnt make sense how it should send text above player shouldnt it be
addAnimatedText("Axe Fighting", getPosition(), TEXTCOLOR_LIGHTGREEN);
so that way it would be possible to add colors too.
 
If you're not on a pre-9.7 client (or not using OTC) you can't use animated text.
player:say(text, TALKTYPE_MONSTER_SAY, false, nil, player:getPosition())
 
If you're not on a pre-9.7 client (or not using OTC) you can't use animated text.
player:say(text, TALKTYPE_MONSTER_SAY, false, nil, player:getPosition())
But you can use addAnimatedText("Axe Fighting", getPosition(), TEXTCOLOR_LIGHTGREEN); since im using it in source. And my client is 8.6

bump
 
@SixNine I created this script back in 2013. It uses a custom animated text function (posted below). You may be able to use this within your script to send text as it was deprecated in TFS.

Lua:
local function doSendAnimatedText(pos, text, color, cid) -- by J.Dre
    if tonumber(text) then
        text = tonumber(text)
        if cid and isPlayer(cid) then
            doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE_OTHERS, "", text, color, pos)
        else
            local t = getSpectators(pos, 7, 5, false)
            if t then
                for _, cid in ipairs(t) do
                    if isPlayer(cid) then
                        doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE_OTHERS, "", text, color, pos)
                    end
                end
            end
        end
    else
        if cid and isCreature(cid) then
            doCreatureSay(cid, text, TALKTYPE_MONSTER)
        else
            local t = getSpectators(pos, 7, 5, false)
            if t then
                for _, cid in ipairs(t) do
                    if isPlayer(cid) then
                        doCreatureSay(cid, text, TALKTYPE_MONSTER, false, cid, pos)
                    end
                end
            end
        end
    end
end
 
@SixNine I created this script back in 2013. It uses a custom animated text function (posted below). You may be able to use this within your script to send text as it was deprecated in TFS.

Lua:
local function doSendAnimatedText(pos, text, color, cid) -- by J.Dre
    if tonumber(text) then
        text = tonumber(text)
        if cid and isPlayer(cid) then
            doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE_OTHERS, "", text, color, pos)
        else
            local t = getSpectators(pos, 7, 5, false)
            if t then
                for _, cid in ipairs(t) do
                    if isPlayer(cid) then
                        doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE_OTHERS, "", text, color, pos)
                    end
                end
            end
        end
    else
        if cid and isCreature(cid) then
            doCreatureSay(cid, text, TALKTYPE_MONSTER)
        else
            local t = getSpectators(pos, 7, 5, false)
            if t then
                for _, cid in ipairs(t) do
                    if isPlayer(cid) then
                        doCreatureSay(cid, text, TALKTYPE_MONSTER, false, cid, pos)
                    end
                end
            end
        end
    end
end
So this code goes in compact, but by using doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE_OTHERS, "", text, TEXTCOLOR_LIGHTGREEN, pos) in code nothing happens

So this code goes in compact, but by using doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE_OTHERS, "", text, TEXTCOLOR_LIGHTGREEN, pos) in code nothing happens
bump

bump
 
creaturescripts.xml
Code:
<event type="advance" name="AdvanceEffects" script="advance_effects.lua" />

advance_effects.lua
Code:
local config = {
    [SKILL_LEVEL] = { "Level Up!", CONST_ME_CAKE },
    [SKILL_CLUB] = { "Club Up!", CONST_ME_FIREWORK_BLUE },
    [SKILL_AXE] = { "Axe Up!", CONST_ME_FIREWORK_RED },
    [SKILL_SWORD] = { "Sword Up!", CONST_ME_FIREWORK_YELLOW },
    [SKILL_DISTANCE] = { "Distance Up!", CONST_ME_ASSASSIN },
    [SKILL_SHIELD] = { "Shield Up!", CONST_ME_BLOCKHIT },
    [SKILL_FISHING] = { "Fishing Up!", CONST_ME_WATERSPLASH },
    [SKILL_FIST] = { "Fist Up!", CONST_ME_HITAREA },
    [SKILL_MAGLEVEL] = { "Magic Level Up!", CONST_ME_HEARTS }
}

local imageEffect = {
    {0, 0, 1, 0, 1, 0, 0},
    {0, 1, 0, 1, 0, 1, 0},
    {1, 0, 0, 0, 0, 0, 1},
    {1, 0, 0, 0, 0, 0, 1},
    {0, 1, 0, 0, 0, 1, 0},
    {0, 0, 1, 0, 1, 0, 0},
    {0, 0, 0, 1, 0, 0, 0}
}

function onAdvance(player, skill, oldLevel, newLevel)
    if oldLevel < newLevel then
        local info = config[skill]
        if info then
            player:say(info[1], TALKTYPE_MONSTER_SAY)
            local diff = math.ceil(#imageEffect[1] / 2)
            local position = player:getPosition() + Position(-diff, -diff, 0)
            for k, v in pairs(imageEffect) do
                for l, b in pairs(v) do
                    if b ~= 0 then
                        (position + Position(l, k, 0)):sendMagicEffect(info[2])
                    end
                end
            end
        end
    end
    return true
end

Create the figure that you like, by default I created a heart!
 
creaturescripts.xml
Code:
<event type="advance" name="AdvanceEffects" script="advance_effects.lua" />

advance_effects.lua
Code:
local config = {
    [SKILL_LEVEL] = { "Level Up!", CONST_ME_CAKE },
    [SKILL_CLUB] = { "Club Up!", CONST_ME_FIREWORK_BLUE },
    [SKILL_AXE] = { "Axe Up!", CONST_ME_FIREWORK_RED },
    [SKILL_SWORD] = { "Sword Up!", CONST_ME_FIREWORK_YELLOW },
    [SKILL_DISTANCE] = { "Distance Up!", CONST_ME_ASSASSIN },
    [SKILL_SHIELD] = { "Shield Up!", CONST_ME_BLOCKHIT },
    [SKILL_FISHING] = { "Fishing Up!", CONST_ME_WATERSPLASH },
    [SKILL_FIST] = { "Fist Up!", CONST_ME_HITAREA },
    [SKILL_MAGLEVEL] = { "Magic Level Up!", CONST_ME_HEARTS }
}

local imageEffect = {
    {0, 0, 1, 0, 1, 0, 0},
    {0, 1, 0, 1, 0, 1, 0},
    {1, 0, 0, 0, 0, 0, 1},
    {1, 0, 0, 0, 0, 0, 1},
    {0, 1, 0, 0, 0, 1, 0},
    {0, 0, 1, 0, 1, 0, 0},
    {0, 0, 0, 1, 0, 0, 0}
}

function onAdvance(player, skill, oldLevel, newLevel)
    if oldLevel < newLevel then
        local info = config[skill]
        if info then
            player:say(info[1], TALKTYPE_MONSTER_SAY)
            local diff = math.ceil(#imageEffect[1] / 2)
            local position = player:getPosition() + Position(-diff, -diff, 0)
            for k, v in pairs(imageEffect) do
                for l, b in pairs(v) do
                    if b ~= 0 then
                        (position + Position(l, k, 0)):sendMagicEffect(info[2])
                    end
                end
            end
        end
    end
    return true
end

Create the figure that you like, by default I created a heart!
Works, btw you sure colors doesnt work like J.Dre said with
doSendAnimatedText(pos, text, color, cid)?
 
Works, btw you sure colors doesnt work like J.Dre said with
doSendAnimatedText(pos, text, color, cid)?
It's a client limitation, not a source issue.
Unless you change client to a previous version, or use OTC (Open Tibia Client), animated text will not work.
 
It's a client limitation, not a source issue.
Unless you change client to a previous version, or use OTC (Open Tibia Client), animated text will not work.
Its weird because a saw a lot of servers with 8.54 client having same advance message but with colors like green and etc and i would doubt it was dll
 
Its weird because a saw a lot of servers with 8.54 client having same advance message but with colors like green and etc and i would doubt it was dll

You should be able to edit this line of code to pronounce the messages in different format:
Lua:
player:say(info[1], TALKTYPE_MONSTER_SAY)
Code:
TALKTYPE_SAY  
TALKTYPE_WHISPER   
TALKTYPE_YELL   
TALKTYPE_PRIVATE_FROM   
TALKTYPE_PRIVATE_TO   
TALKTYPE_CHANNEL_Y   
TALKTYPE_CHANNEL_O   
TALKTYPE_PRIVATE_NP   
TALKTYPE_PRIVATE_PN   
TALKTYPE_BROADCAST   
TALKTYPE_CHANNEL_R1   
TALKTYPE_PRIVATE_RED_FROM   
TALKTYPE_PRIVATE_RED_TO   
TALKTYPE_MONSTER_SAY   
TALKTYPE_MONSTER_YELL   
TALKTYPE_CHANNEL_R2

The version of TFS you are using was downgraded and may be missing some of the original features.
 
Back
Top