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

Lua [TFS 0.X]Skill Scroll - Skill booster

potinho

Advanced OT User
Joined
Oct 11, 2009
Messages
1,402
Solutions
17
Reaction score
150
Location
Brazil
I would like a script (action) that, when I use the item, the skill rate (skills axe, sword, club, distance, shield, fist and magic level) would be "x" times faster for "x" time. can you help me?
 
Lua:
local config = {
    removeOnUse = true,
    time = 1, -- minutes
    storage = 26
}

config.boostItem = {
    [itemID] = {
        [SKILL__LEVEL] = 5,
        [SKILL_AXE] = 10,
        [SKILL_SWORD] = 50
    }
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local val = config.boostItem[item.itemid]
    if not val then return true end

    if getCreatureStorage(cid, config.storage) - os.time() >= 0 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You must wait for using this item.")
        return true
    end

    if config.removeOnUse then
        doRemoveItem(item.uid, 1)
    end

    for key, value in pairs(val) do
        doPlayerSetRate(cid, key, value)
    end

    addEvent(function()
        if isPlayer(cid) then
            for key, value in pairs(val) do
                doPlayerSetRate(cid, key, 1) -- set rates x1
            end

            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your boost time has over.")
            doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
        end
    end, config.time * 60 * 1000)

    doCreatureSetStorage(cid, config.storage, os.time() + (config.time * 60))
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You\'ve been boosted.")
    doCreatureSay(cid, "BOOST!", TALKTYPE_ORANGE_1)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_STUN)
    return true
end

login.lua
Lua:
if getCreatureStorage(cid, STORAGE) - os.time() >= 0 then
    doCreatureSetStorage(cid, STORAGE, -1)
end
 
Last edited:
Lua:
local config = {
    removeOnUse = true,
    time = 1, -- minutes
    storage = 26
}

config.boostItem = {
    [itemID] = {
        [SKILL__LEVEL] = 5,
        [SKILL_AXE] = 10,
        [SKILL_SWORD] = 50
    }
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local val = config.boostItem[item.itemid]
    if not val then return true end

    if getCreatureStorage(cid, config.storage) - os.time() >= 0 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You must wait for using this item.")
        return true
    end

    if config.removeOnUse then
        doRemoveItem(item.uid, 1)
    end

    for key, value in pairs(val) do
        doPlayerSetRate(cid, key, value)
    end

    addEvent(function()
        if isPlayer(cid) then
            for key, value in pairs(val) do
                doPlayerSetRate(cid, key, 1) -- set rates x1
            end

            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your boost time has over.")
            doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
        end
    end, config.time * 60 * 1000)

    doCreatureSetStorage(cid, config.storage, os.time() + (config.time * 60))
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You\'ve been boosted.")
    doCreatureSay(cid, "BOOST!", TALKTYPE_ORANGE_1)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_STUN)
    return true
end

login.lua
Lua:
if getCreatureStorage(cid, STORAGE) - os.time() >= 0 then
    doCreatureSetStorage(cid, STORAGE, -1)
end
Sorry for be a newbie, but how this script works? What i need to change? I guess rates and skills, but i dont know to do it right.
 
Back
Top