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

Scroll that boosts exp for x time

  • Thread starter Deleted member 49793
  • Start date
D

Deleted member 49793

Guest
Looking for a script for 1.1 TFS that boosts a players exp for X minutes, (example 2 hours)

Anyone have one made or can put one together?
 
Skill window in classic tibia client is hardcoded, so you would have to use OTC for that.

i guess ill find a way to add this
Lua:
 condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
and have the buff icon disply for the duretion of the exp boost..

thanks for the answer :3
 
It's not hardcoded in the client, it's hardcoded in the packet that's sent to the client from the server.
C++:
    msg.add<uint16_t>(100); // base xp gain rate
    msg.add<uint16_t>(0); // xp voucher
    msg.add<uint16_t>(0); // low level bonus
    msg.add<uint16_t>(0); // xp boost
    msg.add<uint16_t>(100); // stamina multiplier (100 = x1.0)
You'd have to create a new Lua function to set multiplier/rate to player and send that value where the xp boost value is added, and inside of that Lua function use player->sendStats() to update the client immediately.
 
How to make talkaction to check how much time is left? tfs 1.2

Something like this should work
Remember to change your storage number!

Lua:
function onSay(player, words, param)

    local function showTimeLeft(number, usewords)
        local number = tonumber(number)
        if not number then
                return "error"
        end

        if number < 0 then
                return "expired"
        end

        local clocknum = os.date("!%X",number):split(":") -- h:m:s
        local day = math.modf(number / 86400)
        local hour = clocknum[1]
        local minute = clocknum[2]
        local second = clocknum[3]

        if not usewords then
                return table.concat({day, hour, minute, second}, ":")
        end

        local text = {}
        if day > 0 then
                table.insert(text, tonumber(day) .. " day" .. (day > 1 and "s" or ""))
        end

        if hour ~= "00" then
                table.insert(text, tonumber(hour) .. " hour" .. (tonumber(hour) > 1 and "s" or ""))
        end

        if minute ~= "00" then
                table.insert(text, tonumber(minute) .. " minute" .. (tonumber(minute) > 1 and "s" or ""))
        end

        if second ~= "00" then
                table.insert(text, tonumber(second) .. " second" .. (tonumber(second) > 1 and "s" or ""))
        end

        countdown_text = ""
        if #text > 0 then
            countdown_text = text[1]
            for i = 2, #text - 1 do
                    countdown_text = countdown_text .. ", " .. text[i]
            end
            if #text > 1 then
                    countdown_text = countdown_text .. " and " .. text[#text]
            end
                    countdown_text = countdown_text
            else
                    countdown_text = "expired"
            end
        return countdown_text
    end
  
  
  
    local storage = 1234

    if player:getStorageValue(storage) >= os.time() then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have "..showTimeLeft(player:getStorageValue(storage) - os.time(), true)
        return true
    end
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "No Scroll active")
end
 
Last edited:
Something like this should work
Remember to change your storage number!

Lua:
function onSay(player, words, param)

    local function showTimeLeft(number, usewords)
        local number = tonumber(number)
        if not number then
                return "error"
        end

        if number < 0 then
                return "expired"
        end

        local clocknum = os.date("!%X",number):split(":") -- h:m:s
        local day = math.modf(number / 86400)
        local hour = clocknum[1]
        local minute = clocknum[2]
        local second = clocknum[3]

        if not usewords then
                return table.concat({day, hour, minute, second}, ":")
        end

        local text = {}
        if day > 0 then
                table.insert(text, tonumber(day) .. " day" .. (day > 1 and "s" or ""))
        end

        if hour ~= "00" then
                table.insert(text, tonumber(hour) .. " hour" .. (tonumber(hour) > 1 and "s" or ""))
        end

        if minute ~= "00" then
                table.insert(text, tonumber(minute) .. " minute" .. (tonumber(minute) > 1 and "s" or ""))
        end

        if second ~= "00" then
                table.insert(text, tonumber(second) .. " second" .. (tonumber(second) > 1 and "s" or ""))
        end

        countdown_text = ""
        if #text > 0 then
            countdown_text = text[1]
            for i = 2, #text - 1 do
                    countdown_text = countdown_text .. ", " .. text[i]
            end
            if #text > 1 then
                    countdown_text = countdown_text .. " and " .. text[#text]
            end
                    countdown_text = countdown_text
            else
                    countdown_text = "expired"
            end
        return countdown_text
    end
 
 
 
    local storage = 1234

    if player:getStorageValue(storage) >= os.time() then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have "..showTimeLeft(player:getStorageValue(storage) - os.time(), true)
        return true
    end
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "No Scroll active")
end
Great ! How to add to your script exhaust ?
 
Can you be a bit more specific? what do you mean?

use the command once every 10 sec exhausted but i done it:
Lua:
local cfg = {
exhausted = 10, -- Time you are exhausted.
storage = 78949 -- Storage used for "exhaust."
}
function onSay(player, words, param)
if (player:getStorageValue(cfg.storage) > os.time())then
        player:sendCancelMessage("You must wait another " .. player:getStorageValue(cfg.storage) - os.time() .. ' second' .. ((player:getStorageValue(cfg.storage) - os.time()) == 1 and "" or "s") .. ".")
    return false
    end

    local function showTimeLeft(number, usewords)
        local number = tonumber(number)
        if not number then
                return "error"
        end

        if number < 0 then
                return "expired"
        end

        local clocknum = os.date("!%X",number):split(":") -- h:m:s
        local day = math.modf(number / 3600)
        local hour = clocknum[1]
        local minute = clocknum[2]
        local second = clocknum[3]

        if not usewords then
                return table.concat({day, hour, minute, second}, ":")
        end

        local text = {}
        if day > 0 then
                table.insert(text, tonumber(day) .. " day" .. (day > 1 and "s" or ""))
        end

        if hour ~= "00" then
                table.insert(text, tonumber(hour) .. " hour" .. (tonumber(hour) > 1 and "s" or ""))
        end

        if minute ~= "00" then
                table.insert(text, tonumber(minute) .. " minute" .. (tonumber(minute) > 1 and "s" or ""))
        end

        if second ~= "00" then
                table.insert(text, tonumber(second) .. " second" .. (tonumber(second) > 1 and "s" or ""))
        end

        countdown_text = ""
        if #text > 0 then
            countdown_text = text[1]
            for i = 2, #text - 1 do
                    countdown_text = countdown_text .. ", " .. text[i]
            end
            if #text > 1 then
                    countdown_text = countdown_text .. " and " .. text[#text]
            end
                    countdown_text = countdown_text
            else
                    countdown_text = "expired"
            end
        return countdown_text
    end
 
 
 
    local storage = 98546
     player:setStorageValue(cfg.storage, os.time() + cfg.exhausted)
    if player:getStorageValue(storage) >= os.time() then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Your bonus will disappear in: "..showTimeLeft(player:getStorageValue(storage) - os.time(), true))
        return false
    end
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "No Exp Potion active")
end

Thanks You !
 
As far as I can see there isn't any need to 'convert' it, since all of the functions used are already in TFS 1.3

Should work as-is.
I've this but it doesnt work ...
Lua:
local xpboost = Action()
local cfg = {
exhausted = 10, -- Time you are exhausted.
storage = 78949 -- Storage used for "exhaust."
}
function xpboost.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if (player:getStorageValue(cfg.storage) > os.time())then
        player:sendCancelMessage("You must wait another " .. player:getStorageValue(cfg.storage) - os.time() .. ' second' .. ((player:getStorageValue(cfg.storage) - os.time()) == 1 and "" or "s") .. ".")
    return false
    end

    local function showTimeLeft(number, usewords)
        local number = tonumber(number)
        if not number then
                return "error"
        end

        if number < 0 then
                return "expired"
        end

        local clocknum = os.date("!%X",number):split(":") -- h:m:s
        local day = math.modf(number / 3600)
        local hour = clocknum[1]
        local minute = clocknum[2]
        local second = clocknum[3]

        if not usewords then
                return table.concat({day, hour, minute, second}, ":")
        end

        local text = {}
        if day > 0 then
                table.insert(text, tonumber(day) .. " day" .. (day > 1 and "s" or ""))
        end

        if hour ~= "00" then
                table.insert(text, tonumber(hour) .. " hour" .. (tonumber(hour) > 1 and "s" or ""))
        end

        if minute ~= "00" then
                table.insert(text, tonumber(minute) .. " minute" .. (tonumber(minute) > 1 and "s" or ""))
        end

        if second ~= "00" then
                table.insert(text, tonumber(second) .. " second" .. (tonumber(second) > 1 and "s" or ""))
        end

        countdown_text = ""
        if #text > 0 then
            countdown_text = text[1]
            for i = 2, #text - 1 do
                    countdown_text = countdown_text .. ", " .. text[i]
            end
            if #text > 1 then
                    countdown_text = countdown_text .. " and " .. text[#text]
            end
                    countdown_text = countdown_text
            else
                    countdown_text = "expired"
            end
        return countdown_text
    end



    local storage = 65004
     player:setStorageValue(cfg.storage, os.time() + cfg.exhausted)
    if player:getStorageValue(storage) >= os.time() then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Your bonus will disappear in: "..showTimeLeft(player:getStorageValue(storage) - os.time(), true))
        return false
    end
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "No Exp Potion active")
end

xpboost:id(40407)
xpboost:register()
AND THIS DOESNT WORK ETHIER

Code:
local xpBoost = Action()

function xpBoost.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local xpboost = 86400
local xpvalue = 50
  db.query("UPDATE `players` SET `xpboost_stamina` = `xpboost_stamina` + '" .. xpboost .. "' WHERE `id` = '" .. player:getAccountId() .. "';")
  db.query("UPDATE `players` SET `xpboost_value` = `xpboost_value` + '" .. xpvalue .. "' WHERE `id` = '" .. player:getAccountId() .. "';")
  player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You received 1 Day of 50% Xp Boost")
  item:remove(1)
  return true
end

xpBoost:id(40407)
xpBoost:register()
 
before I added these scripts, I was getting the stages exp, since adding them, I get normal tibia exp any knows why?
 
Back
Top