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

effect skills up tfs 1.2

Mateus Robeerto

Excellent OT User
Joined
Jun 5, 2016
Messages
1,337
Solutions
71
Reaction score
697
Location
ლ(ಠ益ಠლ)
convert there for me plx xD
Lua:
function onAdvance(cid, skill, oldlevel, newlevel)
skillnames={'Fist','Club','Sword','Axe','Distance','Shield','Fishing','Magic','Level'}

     doSendAnimatedText(getCreaturePosition(cid), '' ..skillnames[skill+1].. ' Up!', math.random(1,254))
doSendMagicEffect(getCreaturePosition(cid),27)
end
 
I think you are missing an IF or for function. to specify the skill

you asked to convert it literally. there is

Lua:
local creatureEvent = CreatureEvent("skillup")

function creatureEvent.onAdvance(player, skill, oldLevel, newLevel)
   local skillnames = {'Fist','Club','Sword','Axe','Distance','Shield','Fishing','Magic','Level'}
--if skill == skillnames then ?????????
    if not Game.sendAnimatedText then
        player:say('' ..skillnames[skill+1].. ' Up!', TALKTYPE_ORANGE_1)
        player:getPosition():sendMagicEffect(27)

  
    else
  
    Game.sendAnimatedText('' ..skillnames[skill+1].. ' Up!', player:getPosition(), TEXTCOLOR_ORANGE)
    player:getPosition():sendMagicEffect(27)
  
    end

--end
    return true
end

creatureEvent:register()


Remember to add in login as registerEvent player:registerEvent("skillup")
PD: If someone can improve it better, I'm not good with arrays
 
I think you are missing an IF or for function. to specify the skill

you asked to convert it literally. there is

Lua:
local creatureEvent = CreatureEvent("skillup")

function creatureEvent.onAdvance(player, skill, oldLevel, newLevel)
   local skillnames = {'Fist','Club','Sword','Axe','Distance','Shield','Fishing','Magic','Level'}
--if skill == skillnames then ?????????
    if not Game.sendAnimatedText then
        player:say('' ..skillnames[skill+1].. ' Up!', TALKTYPE_ORANGE_1)
        player:getPosition():sendMagicEffect(27)

 
    else
 
    Game.sendAnimatedText('' ..skillnames[skill+1].. ' Up!', player:getPosition(), TEXTCOLOR_ORANGE)
    player:getPosition():sendMagicEffect(27)
 
    end

--end
    return true
end

creatureEvent:register()


Remember to add in login as registerEvent player:registerEvent("skillup")
PD: If someone can improve it better, I'm not good with arrays
in tfs 0.4 8.60 it's working normally, it's not missing if, the script is original that's why I came here asking you to convert for me xD, but tfs 1.2 8.0 downgrage gave an error see there
Lua Script Error: [Test Interface]
data/creaturescripts/scripts/Advance.lua
data/creaturescripts/scripts/Advance.lua:1: attempt to call global 'CreatureEvent' (a nil value)
stack traceback:
[C]: in function 'CreatureEvent'
data/creaturescripts/scripts/Advance.lua:1: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/Advance.lua
It is already registering in the login, everything is ok
thanks for the help
Post automatically merged:

this script is working perfectly only for the level, I just want to level up "magic level, skills to the others xD, I can't think and convert, I'm not very good at TFS 1X ;/,

Lua:
unction onAdvance(player, skill, oldLevel, newLevel)
    if skill ~= SKILL_LEVEL then
        return true
    end
    local playerPos = player:getPosition()
    -- Game.sendAnimatedText("Level Up!", playerPos, TEXTCOLOR_LIGHTGREEN)
    player:say("Level Up!", TALKTYPE_MONSTER_SAY)
    local effects = {29, 28, 29, 28, 29, 28}
    for i = 1, #effects do
        addEvent(Position.sendMagicEffect, 1 * (i * 100), playerPos, effects[i])
    end
    playerPos:sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
    return true
end
 
I think you are missing an IF or for function. to specify the skill

you asked to convert it literally. there is

Lua:
local creatureEvent = CreatureEvent("skillup")

function creatureEvent.onAdvance(player, skill, oldLevel, newLevel)
   local skillnames = {'Fist','Club','Sword','Axe','Distance','Shield','Fishing','Magic','Level'}
--if skill == skillnames then ?????????
    if not Game.sendAnimatedText then
        player:say('' ..skillnames[skill+1].. ' Up!', TALKTYPE_ORANGE_1)
        player:getPosition():sendMagicEffect(27)

 
    else
 
    Game.sendAnimatedText('' ..skillnames[skill+1].. ' Up!', player:getPosition(), TEXTCOLOR_ORANGE)
    player:getPosition():sendMagicEffect(27)
 
    end

--end
    return true
end

creatureEvent:register()


Remember to add in login as registerEvent player:registerEvent("skillup")
PD: If someone can improve it better, I'm not good with arrays
solved here, use tfs 1.2 8.0 downgrage

For those who want to use the script, it's working normally here, okay
Lua:
local config = {
    [0] = { "Fist skill UP", 31},
    [1] = { "Club skill UP", 31},
    [2] = { "Sword skill UP", 31},
    [3] = { "Axe skill UP", 31},
    [4] = { "Distance skill UP", 31},
    [5] = { "Shield skill UP", 31},
    [6] = { "Fishing skill UP", 31},
    [7] = { "Magic level UP", 31},
}


function onAdvance(cid, skill, oldlevel, newlevel)

local pos = getPlayerPosition(cid)
local effectPositions = {
{x = pos.x, y = pos.y - 0, z = pos.z},
{x = pos.x, y = pos.y + 0, z = pos.z},
{x = pos.x - 0, y = pos.y, z = pos.z},
{x = pos.x + 0, y = pos.y, z = pos.z},
{x = pos.x - 0, y = pos.y - 0, z = pos.z},
{x = pos.x + 0, y = pos.y - 0, z = pos.z},
{x = pos.x + 0, y = pos.y + 0, z = pos.z},
{x = pos.x - 0, y = pos.y + 0, z = pos.z}
}

        
    for type, variable in pairs(config) do
        if skill == type then
            doCreatureSay(cid, ""..variable[1].." ["..newlevel.."]", TALKTYPE_ORANGE_1)
    for _, ePos in ipairs(effectPositions) do
        doSendDistanceShoot(pos, ePos, CONST_ANI_ASSASSIN)
        doSendMagicEffect(ePos, CONST_ME_ASSASSIN)
            end

            
        end
    end   
return TRUE
end
 
Back
Top