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

[TFS 1.2] Staged skills & Maglevel

Hultin

Member
Joined
Dec 2, 2008
Messages
262
Reaction score
17
This code is simple, and replace the already existing code in \events\scripts\player.lua (at the very bottom) but it allows you to do all lua skill stages, this is extremly useful on servers where the level/skills offset is way off of normal tibia or where there are no trainers (or both!) as is the case on my server.

Code:
function Player:onGainSkillTries(skill, tries)
    local lowMuliplier = 2 -- Multiplier if your skill is lower than lowSkill/lowMagic
    local lowSkill, lowMagic = 60, 40 -- Level which the muliplier stops being active, set to 0 to disable.
    if APPLY_SKILL_MULTIPLIER == false then
        return tries
    end

    local voc = self:getVocation():getBase():getId()

    if skill == SKILL_MAGLEVEL then
        if self:getMagicLevel() < lowMagic and (voc == 1 or voc == 2) then
            return tries * (configManager.getNumber(configKeys.RATE_MAGIC)*lowMuliplier)
        end
        return tries * configManager.getNumber(configKeys.RATE_MAGIC)
    end
    if self:getSkillLevel(skill) < lowSkill and (voc == 3 or voc == 4) then
        return tries * (configManager.getNumber(configKeys.RATE_SKILL)*lowMuliplier)
    end
    return tries * configManager.getNumber(configKeys.RATE_SKILL)
end

Edit: Forgot to add :getBase() to voc, this allows this to work on both promoted and unpromoted characters.

Code cleanup
 
Last edited:
You could alter this to use a storage value instead as a multiplier so it isn't a global setting where it differs from player to player.
 
Ofcourse, this is code that you could build off of, however this is what I intend to use on my server and as such I didn't have time nor wanted to spend time on developing features I wouldn't need (I did add some variables to make configuration possible, which I normally wouldn't have for such a basic script)
 
Back
Top