How to add text when you advance on skill

SixNine

Member
Joined
Dec 12, 2018
Messages
175
Reaction score
8
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
 

Ascuas Funkeln

Rakkedo Game
Joined
Apr 14, 2013
Messages
142
Reaction score
60
Location
Poland
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
Fastest way is by extendedopcodes, via server you must rebuild code...
 

Evil Puncker

I'd rather kiss a rattlesnake
Joined
May 30, 2009
Messages
5,432
Reaction score
1,563
Location
brazol
by the way, its not possible to have colored text since client 9. something
 

Stigma

Veteran OT User
Joined
Feb 14, 2015
Messages
4,587
Reaction score
2,147
by the way, its not possible to have colored text since client 9. something
9.7

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
Just use an onAdvance creaturescript and look at skill ids here and just send different text to player based on the skill id
 
OP
SixNine

SixNine

Member
Joined
Dec 12, 2018
Messages
175
Reaction score
8
9.7


Just use an onAdvance creaturescript and look at skill ids here and just send different text to player based on the skill id
Table index is nil
Lua:
local area, data = 
{
    {0, 1, 1, 1, 0},
    {1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1},
    {0, 1, 1, 1, 0}
},
{
    [SKILL_FIST] = 'FISTUP!',
    [SKILL_CLUB] = 'CLUBUP!',
    [SKILL_SWORD] = 'SWORDUP!',
    [SKILL_AXE] = 'AXEUP!',
    [SKILL_DISTANCE] = 'DISTANCEUP!',
    [SKILL_SHIELD] = 'SHIELDUP!',
    [SKILL_FISHING] = 'FISHINGUP!',
    [SKILL__MAGLEVEL] = 'MAGICUP!',
    [SKILL__LEVEL] = 'LEVELUP!'
}
  
function onAdvance(cid, skill, oldLevel, newLevel)
    doPlayerSave(cid)
    local center, data = {}, data[skill] --function doSendMagicEffectInArea of Mock
    center.y = math.floor(table.getn(area)/2)+1
    for y = 1, table.getn(area) do
        for x = 1, table.getn(area[y]) do
            if area[y][x] > 0 then
                center.x = math.floor(table.getn(area[y])/2)+1
                doSendMagicEffect({x=getThingPos(cid).x+x-center.x,y=getThingPos(cid).y+y-center.y,z= getThingPos(cid).z},math.random(28,30),cid)
            end
        end
    end    
    for i = 1, #data do
        addEvent(doSendAnimatedText, i*150, getThingPos(cid), data:sub(i,i), i%2 == 0 and TEXTCOLOR_RED or TEXTCOLOR_ORANGE)
    end
    return true
end
 

Stigma

Veteran OT User
Joined
Feb 14, 2015
Messages
4,587
Reaction score
2,147
If you look at the link I sent, skills don't have two underscores like in older versions.
 
OP
SixNine

SixNine

Member
Joined
Dec 12, 2018
Messages
175
Reaction score
8
If you look at the link I sent, skills don't have two underscores like in older versions.
Okay fixed it but it doesnt send any text Those FISTUP! and etc
 

LordVissie

( ͡°( ͡° ͜ʖ( ͡° ͜ʖ ͡°) ͜ʖ ͡°) ͡°)
Joined
Aug 4, 2015
Messages
1,624
Reaction score
573
Location
The Earth
You can't get colored text in TFS 1.2 without extendedopcodes. You can use player:sendTextMessage('...') for just orange text above the player.
why don't you do something like this (This is without text just effects for different advance type):
Lua:
local skillTypes = {
    [SKILL_LEVEL] = 37,
    [SKILL_MAGLEVEL] = 12,
    [SKILL_FIST] = CONST_ME_BLOCKHIT,
    [SKILL_CLUB] = CONST_ME_GROUNDSHAKER,
    [SKILL_SWORD] = 4,
    [SKILL_AXE] = CONST_ME_DRAWBLOOD,
    [SKILL_DISTANCE] = CONST_ME_HOLYDAMAGE,
    [SKILL_SHIELD] = 35,
    [SKILL_FISHING] = CONST_ME_WATERSPLASH
}

local dirs = {
    {x = -1, y = -1}, -- Northwest
    {x = 1,  y = -1},   -- Northeast
    {x = 1,  y = 1},   -- Southeast
    {x = -1, y = 1},  -- Southwest
}

function onAdvance(player, skill, oldLevel, newLevel)
    local getSkill = skillTypes[skill]
    if getSkill then
        for i = 1, #dirs do
            local pos = player:getPosition()
            pos:sendMagicEffect(32)
            pos.y = pos.y + dirs[i].y
            pos.x = pos.x + dirs[i].x
            pos:sendMagicEffect(getSkill)
        end
    end
    return true
end
The code you posted isn't for TFS 1.2.
 
Last edited:
OP
SixNine

SixNine

Member
Joined
Dec 12, 2018
Messages
175
Reaction score
8
You can't get colored text in TFS 1.2 without extendedopcodes. You can use player:sendTextMessage('...') for just orange text above the player.
why don't you do something like this (This is without text just effects for different advance type):
Lua:
local skillTypes = {
    [SKILL_LEVEL] = 37,
    [SKILL_MAGLEVEL] = 12,
    [SKILL_FIST] = CONST_ME_BLOCKHIT,
    [SKILL_CLUB] = CONST_ME_GROUNDSHAKER,
    [SKILL_SWORD] = 4,
    [SKILL_AXE] = CONST_ME_DRAWBLOOD,
    [SKILL_DISTANCE] = CONST_ME_HOLYDAMAGE,
    [SKILL_SHIELD] = 35,
    [SKILL_FISHING] = CONST_ME_WATERSPLASH
}

local dirs = {
    {x = -1, y = -1}, -- Northwest
    {x = 1,  y = -1},   -- Northeast
    {x = 1,  y = 1},   -- Southeast
    {x = -1, y = 1},  -- Southwest
}

function onAdvance(player, skill, oldLevel, newLevel)
    local getSkill = skillTypes[skill]
    if getSkill then
        for i = 1, #dirs do
            local pos = player:getPosition()
            pos:sendMagicEffect(32)
            pos.y = pos.y + dirs[i].y
            pos.x = pos.x + dirs[i].x
            pos:sendMagicEffect(getSkill)
        end
    end
    return true
end
The code you posted isn't for TFS 1.2.
So something like this
Lua:
local skillTypes = {
    [SKILL_LEVEL] = 37,
    [SKILL_MAGLEVEL] = 12,
    [SKILL_FIST] = CONST_ME_BLOCKHIT,
    [SKILL_CLUB] = CONST_ME_GROUNDSHAKER,
    [SKILL_SWORD] = 4,
    [SKILL_AXE] = CONST_ME_DRAWBLOOD,
    [SKILL_DISTANCE] = CONST_ME_HOLYDAMAGE,
    [SKILL_SHIELD] = 35,
    [SKILL_FISHING] = CONST_ME_WATERSPLASH
}

local skillText = {
    [SKILL_FIST] = 'FISTUP!',
    [SKILL_CLUB] = 'CLUBUP!',
    [SKILL_SWORD] = 'SWORDUP!',
    [SKILL_AXE] = 'AXEUP!',
    [SKILL_DISTANCE] = 'DISTANCEUP!',
    [SKILL_SHIELD] = 'SHIELDUP!',
    [SKILL_FISHING] = 'FISHINGUP!',
    [SKILL__MAGLEVEL] = 'MAGICUP!',
    [SKILL__LEVEL] = 'LEVELUP!'
}

local dirs = {
    {x = -1, y = -1}, -- Northwest
    {x = 1,  y = -1},   -- Northeast
    {x = 1,  y = 1},   -- Southeast
    {x = -1, y = 1},  -- Southwest
}

function onAdvance(player, skill, oldLevel, newLevel)
    local getSkill = skillTypes[skill]
    if getSkill then
        for i = 1, #dirs do
            local pos = player:getPosition()
            pos:sendMagicEffect(32)
            pos.y = pos.y + dirs[i].y
            pos.x = pos.x + dirs[i].x
            pos:sendMagicEffect(getSkill)
            player:sendTextMessage("".. skillText ..""))
        end
    end
    return true
end
?
 

LordVissie

( ͡°( ͡° ͜ʖ( ͡° ͜ʖ ͡°) ͜ʖ ͡°) ͡°)
Joined
Aug 4, 2015
Messages
1,624
Reaction score
573
Location
The Earth
So something like this
Lua:
local skillTypes = {
    [SKILL_LEVEL] = 37,
    [SKILL_MAGLEVEL] = 12,
    [SKILL_FIST] = CONST_ME_BLOCKHIT,
    [SKILL_CLUB] = CONST_ME_GROUNDSHAKER,
    [SKILL_SWORD] = 4,
    [SKILL_AXE] = CONST_ME_DRAWBLOOD,
    [SKILL_DISTANCE] = CONST_ME_HOLYDAMAGE,
    [SKILL_SHIELD] = 35,
    [SKILL_FISHING] = CONST_ME_WATERSPLASH
}

local skillText = {
    [SKILL_FIST] = 'FISTUP!',
    [SKILL_CLUB] = 'CLUBUP!',
    [SKILL_SWORD] = 'SWORDUP!',
    [SKILL_AXE] = 'AXEUP!',
    [SKILL_DISTANCE] = 'DISTANCEUP!',
    [SKILL_SHIELD] = 'SHIELDUP!',
    [SKILL_FISHING] = 'FISHINGUP!',
    [SKILL__MAGLEVEL] = 'MAGICUP!',
    [SKILL__LEVEL] = 'LEVELUP!'
}

local dirs = {
    {x = -1, y = -1}, -- Northwest
    {x = 1,  y = -1},   -- Northeast
    {x = 1,  y = 1},   -- Southeast
    {x = -1, y = 1},  -- Southwest
}

function onAdvance(player, skill, oldLevel, newLevel)
    local getSkill = skillTypes[skill]
    if getSkill then
        for i = 1, #dirs do
            local pos = player:getPosition()
            pos:sendMagicEffect(32)
            pos.y = pos.y + dirs[i].y
            pos.x = pos.x + dirs[i].x
            pos:sendMagicEffect(getSkill)
            player:sendTextMessage("".. skillText ..""))
        end
    end
    return true
end
?
If it works, then yes.
 
Top