How to add text when you advance on skill

SixNine

Banned User
Joined
Dec 12, 2018
Messages
186
Best answers
0
Reaction score
17
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
Best answers
9
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,702
Best answers
22
Reaction score
1,711
Location
160,54,7
by the way, its not possible to have colored text since client 9. something
 

Delusion

Divine Intellect
Support Team
Joined
Feb 14, 2015
Messages
5,097
Best answers
483
Reaction score
2,737
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

Banned User
Joined
Dec 12, 2018
Messages
186
Best answers
0
Reaction score
17
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
 

Delusion

Divine Intellect
Support Team
Joined
Feb 14, 2015
Messages
5,097
Best answers
483
Reaction score
2,737
If you look at the link I sent, skills don't have two underscores like in older versions.
 

LordVissie

( ͡°( ͡° ͜ʖ( ͡° ͜ʖ ͡°) ͜ʖ ͡°) ͡°)
Joined
Aug 4, 2015
Messages
1,631
Best answers
2
Reaction score
589
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

Banned User
Joined
Dec 12, 2018
Messages
186
Best answers
0
Reaction score
17
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,631
Best answers
2
Reaction score
589
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.
 

LordVissie

( ͡°( ͡° ͜ʖ( ͡° ͜ʖ ͡°) ͜ʖ ͡°) ͡°)
Joined
Aug 4, 2015
Messages
1,631
Best answers
2
Reaction score
589
Location
The Earth
it says that its too much ) but it doesnt matter i tried removing them and adding them.
You should do something like this:
Lua:
local skillTypes = {
    [SKILL_LEVEL] = [37, 'LEVELUP!'],
    [SKILL_MAGLEVEL] = [12, 'MAGICUP!'],
    [SKILL_FIST] = [CONST_ME_BLOCKHIT, 'FISTUP!'],
    [SKILL_CLUB] = [CONST_ME_GROUNDSHAKER, 'CLUBUP!'],
    [SKILL_SWORD] = [4, 'SWORDUP!'],
    [SKILL_AXE] = [CONST_ME_DRAWBLOOD, 'AXEUP!'],
    [SKILL_DISTANCE] = [CONST_ME_HOLYDAMAGE, 'DISTANCEUP!'],
    [SKILL_SHIELD] = [35, 'SHIELDUP!'],
    [SKILL_FISHING] = [CONST_ME_WATERSPLASH, 'FISHINGUP!']
}

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 effect = skillTypes[skill][0]
    local text = skillTypes[skill][1]

    if effect && text 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(effect)
            player:sendTextMessage(text)
        end
    end
    return true
end
Didn't test it.
 
Last edited:
OP
SixNine

SixNine

Banned User
Joined
Dec 12, 2018
Messages
186
Best answers
0
Reaction score
17
You should do something like this:
Lua:
local skillTypes = {
    [SKILL_LEVEL] = [37, 'LEVELUP!'],
    [SKILL_MAGLEVEL] = [12, 'MAGICUP!'],
    [SKILL_FIST] = [CONST_ME_BLOCKHIT, 'FISTUP!'],
    [SKILL_CLUB] = [CONST_ME_GROUNDSHAKER, 'CLUBUP!'],
    [SKILL_SWORD] = [4, 'SWORDUP!'],
    [SKILL_AXE] = [CONST_ME_DRAWBLOOD, 'AXEUP!'],
    [SKILL_DISTANCE] = [CONST_ME_HOLYDAMAGE, 'DISTANCEUP!'],
    [SKILL_SHIELD] = [35, 'SHIELDUP!'],
    [SKILL_FISHING] = [CONST_ME_WATERSPLASH, 'FISHINGUP!']
}

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 effect = skillTypes[skill][0]
    local text = skillTypes[skill][1]

    if effect && text 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(effect)
            player:sendTextMessage(text)
        end
    end
    return true
end
Didn't test it.
Your code is having same error like mine
unexpected symbol near [ at line 2
 
Top