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

RevScripts On use of rune/item gives player walking speed for duration of time

Lbtg

Intermediate OT User
Joined
Nov 22, 2008
Messages
2,312
Reaction score
135
Hey again ^^

Tfs 1.4+

please if can help with this :(

Idea:
if player use rune/item , rune/item gets removed and player recieve effectss + walking speed of 100 for 90 seconds.
if the boost is active, player cannot use anymore rune/item and gets poff poff effect and message saying ''Boost is active, maybe wait abit''

Thanks in advance!
 
Solution
not tested

actions:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local config = {
        level = 50,       -- Minimum level to use the rune/item
        storage = 42007, -- Do not change this (storage, only if you know)
        efeitoBoost = CONST_ME_MAGIC_BLUE, -- Boost effect (haste)
        efeitoPoff = CONST_ME_HEARTS -- poff poff effect
    }
 
    if player:getLevel() < config.level then
        return player:sendCancelMessage("You do not have enough level to use this.")
    end
 
    if player:getStorageValue(config.storage) > os.time() then
        local minutes = math.ceil((player:getStorageValue(config.storage) - os.time()) / 60)
        local s = (minutes == 1 and "" or "s")...
not tested

actions:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local config = {
        level = 50,       -- Minimum level to use the rune/item
        storage = 42007, -- Do not change this (storage, only if you know)
        efeitoBoost = CONST_ME_MAGIC_BLUE, -- Boost effect (haste)
        efeitoPoff = CONST_ME_HEARTS -- poff poff effect
    }
 
    if player:getLevel() < config.level then
        return player:sendCancelMessage("You do not have enough level to use this.")
    end
 
    if player:getStorageValue(config.storage) > os.time() then
        local minutes = math.ceil((player:getStorageValue(config.storage) - os.time()) / 60)
        local s = (minutes == 1 and "" or "s")
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Boost is active, maybe wait ".. minutes .." minute".. s ..".")
        player:getPosition():sendMagicEffect(config.efeitoPoff)
        return true
    end
 
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You received a haste effect.")
    player:getPosition():sendMagicEffect(config.efeitoBoost)
 
    local durationInSeconds = 90
    player:addCondition(CONDITION_HASTE, durationInSeconds * 1000, -config.efeitoBoost)
    player:setStorageValue(config.storage, os.time() + durationInSeconds)
    item:remove(1)
 
    return true
end

or

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local config = {
        level = 50,  
        storage = 42007,
        efeitoBoost = CONST_ME_MAGIC_BLUE,
        efeitoPoff = CONST_ME_HEARTS
    }
 
    if player:getLevel() < config.level then
        return player:sendCancelMessage("You do not have enough level to use this.")
    end
 
    if player:getStorageValue(config.storage) > os.time() then
        local minutes = math.ceil((player:getStorageValue(config.storage) - os.time()) / 60)
        local s = (minutes == 1 and "" or "s")
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Boost is active, maybe wait ".. minutes .." minute".. s ..".")
        player:getPosition():sendMagicEffect(config.efeitoPoff)
        return true
    end
 
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You received a haste effect.")
    player:getPosition():sendMagicEffect(config.efeitoBoost)
 
    local durationInSeconds = 90
    local condition = Condition(CONDITION_HASTE)
    condition:setParameter(CONDITION_PARAM_SPEED, 100)
    combat:addCondition(condition)
 
    player:setStorageValue(config.storage, os.time() + durationInSeconds)
    item:remove(1)
 
    return true
end
 
Last edited:
Solution
Tested and worked fine. if you want to increase just increase the speed more and more! 😄
Revscript!

condition:setParameter(CONDITION_PARAM_SPEED, 100) -- Increases speed by 100

Lua:
local hasteBoostAction = Action()

function hasteBoostAction.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local config = {
        level = 50,     
        storage = 42007,  -- Storage to control wait time
        efeitoBoost = CONST_ME_MAGIC_BLUE, -- Boost effect (haste)
        efeitoPoff = CONST_ME_HEARTS -- poff poff effect
    }

    if player:getLevel() < config.level then
        return player:sendCancelMessage("You do not have enough level to use this.")
    end
  
    if player:getStorageValue(config.storage) > os.time() then
        local minutes = math.ceil((player:getStorageValue(config.storage) - os.time()) / 60)
        local s = (minutes == 1 and "" or "s")
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Boost is active, maybe wait ".. minutes .." minute".. s ..".")
        player:getPosition():sendMagicEffect(config.efeitoPoff)
        return true
    end
  
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You received a haste effect.")
    player:getPosition():sendMagicEffect(config.efeitoBoost)
  
    local condition = Condition(CONDITION_HASTE)
    condition:setParameter(CONDITION_PARAM_SPEED, 100) -- Increases speed by 100
    condition:setParameter(CONDITION_PARAM_TICKS, 90000) -- 90 seconds
    player:addCondition(condition)
  
    player:setStorageValue(config.storage, os.time() + 90) -- Storage time is in seconds
    item:remove(1)
  
    return true
end

hasteBoostAction:id(39553) -- The ID of the item that grants the boost
hasteBoostAction:register()
 
Last edited:
Tested and worked fine. Just about the speed, if you want to increase it, just increase the speed more and more! 😄
Revscript!



Lua:
local hasteBoostAction = Action()

function hasteBoostAction.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local config = {
        level = 50,     
        storage = 42007,  -- Storage to control wait time
        efeitoBoost = CONST_ME_MAGIC_BLUE, -- Boost effect (haste)
        efeitoPoff = CONST_ME_HEARTS -- poff poff effect
    }

    if player:getLevel() < config.level then
        return player:sendCancelMessage("You do not have enough level to use this.")
    end
  
    if player:getStorageValue(config.storage) > os.time() then
        local minutes = math.ceil((player:getStorageValue(config.storage) - os.time()) / 60)
        local s = (minutes == 1 and "" or "s")
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Boost is active, maybe wait ".. minutes .." minute".. s ..".")
        player:getPosition():sendMagicEffect(config.efeitoPoff)
        return true
    end
  
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You received a haste effect.")
    player:getPosition():sendMagicEffect(config.efeitoBoost)
  
    local condition = Condition(CONDITION_HASTE)
    condition:setParameter(CONDITION_PARAM_SPEED, 100) -- Increases speed by 100
    condition:setParameter(CONDITION_PARAM_TICKS, 90000) -- 90 seconds
    player:addCondition(condition)
  
    player:setStorageValue(config.storage, os.time() + 90) -- Storage time is in seconds
    item:remove(1)
  
    return true
end

hasteBoostAction:id(39553) -- The ID of the item that grants the boost
hasteBoostAction:register()
looks nice will try today :)
 
Tested and worked fine. if you want to increase just increase the speed more and more! �
Revscript!



Lua:
local hasteBoostAction = Action()

function hasteBoostAction.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local config = {
        level = 50,    
        storage = 42007,  -- Storage to control wait time
        efeitoBoost = CONST_ME_MAGIC_BLUE, -- Boost effect (haste)
        efeitoPoff = CONST_ME_HEARTS -- poff poff effect
    }

    if player:getLevel() < config.level then
        return player:sendCancelMessage("You do not have enough level to use this.")
    end
 
    if player:getStorageValue(config.storage) > os.time() then
        local minutes = math.ceil((player:getStorageValue(config.storage) - os.time()) / 60)
        local s = (minutes == 1 and "" or "s")
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Boost is active, maybe wait ".. minutes .." minute".. s ..".")
        player:getPosition():sendMagicEffect(config.efeitoPoff)
        return true
    end
 
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You received a haste effect.")
    player:getPosition():sendMagicEffect(config.efeitoBoost)
 
    local condition = Condition(CONDITION_HASTE)
    condition:setParameter(CONDITION_PARAM_SPEED, 100) -- Increases speed by 100
    condition:setParameter(CONDITION_PARAM_TICKS, 90000) -- 90 seconds
    player:addCondition(condition)
 
    player:setStorageValue(config.storage, os.time() + 90) -- Storage time is in seconds
    item:remove(1)
 
    return true
end

hasteBoostAction:id(39553) -- The ID of the item that grants the boost
hasteBoostAction:register()

is it possible to create a script on OTX?
 

Take a look at your source code and check for this "CONST_ME_HEARTS" effect. If it doesn't exist, you can replace it with another effect of your choice.
This line allows you to increase the speed or make other modifications if you wish.
setConditionFormula(condition, 0.8, -56, 0.7, -56)

I don't know if it will work, it's important to test to find out which one works for you, the first or the second.
setConditionParam(condition, CONDITION_PARAM_SPEED, 100)


Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local config = {
        level = 50,      
        storage = 42007,
        efeitoBoost = CONST_ME_MAGIC_BLUE,
        efeitoPoff = CONST_ME_HEARTS
    }

    if getPlayerLevel(cid) < config.level then
        doPlayerSendCancel(cid, "You do not have enough level to use this.")
        return true
    end

    if getPlayerStorageValue(cid, config.storage) > os.time() then
        local minutes = math.ceil((getPlayerStorageValue(cid, config.storage) - os.time()) / 60)
        local s = (minutes == 1 and "" or "s")
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Boost is active, maybe wait ".. minutes .." minute".. s ..".")
        doSendMagicEffect(getCreaturePosition(cid), config.efeitoPoff)
        return true
    end

    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You received a haste effect.")
    doSendMagicEffect(getCreaturePosition(cid), config.efeitoBoost)

    local durationInSeconds = 90
    local condition = createConditionObject(CONDITION_HASTE)
    setConditionParam(condition, CONDITION_PARAM_TICKS, durationInSeconds * 1000)
    setConditionParam(condition, CONDITION_PARAM_SPEED, 100)
     setCombatCondition(combat, condition)
   
    setPlayerStorageValue(cid, config.storage, os.time() + durationInSeconds)
    doRemoveItem(item.uid, 1)

    return true
end

or

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local config = {
        level = 50,    
        storage = 42007,
        efeitoBoost = CONST_ME_MAGIC_BLUE,
        efeitoPoff = CONST_ME_HEARTS
    }

    if getPlayerLevel(cid) < config.level then
        doPlayerSendCancel(cid, "You do not have enough level to use this.")
        return true
    end

    if getPlayerStorageValue(cid, config.storage) > os.time() then
        local minutes = math.ceil((getPlayerStorageValue(cid, config.storage) - os.time()) / 60)
        local s = (minutes == 1 and "" or "s")
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Boost is active, maybe wait ".. minutes .." minute".. s ..".")
        doSendMagicEffect(getCreaturePosition(cid), config.efeitoPoff)
        return true
    end

    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You received a haste effect.")
    doSendMagicEffect(getCreaturePosition(cid), config.efeitoBoost)

    local durationInSeconds = 90
    local condition = createConditionObject(CONDITION_HASTE)
    setConditionParam(condition, CONDITION_PARAM_TICKS, durationInSeconds * 1000)
    setConditionFormula(condition, 0.8, -56, 0.7, -56)
     setCombatCondition(combat, condition)
   
    setPlayerStorageValue(cid, config.storage, os.time() + durationInSeconds)
    doRemoveItem(item.uid, 1)

    return true
end
 
Last edited:
Take a look at your source code and check for this "CONST_ME_HEARTS" effect. If it doesn't exist, you can replace it with another effect of your choice.
This line allows you to increase the speed or make other modifications if you wish.


I don't know if it will work, it's important to test to find out which one works for you, the first or the second.



Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local config = {
        level = 50,      
        storage = 42007,
        efeitoBoost = CONST_ME_MAGIC_BLUE,
        efeitoPoff = CONST_ME_HEARTS
    }

    if getPlayerLevel(cid) < config.level then
        doPlayerSendCancel(cid, "You do not have enough level to use this.")
        return true
    end

    if getPlayerStorageValue(cid, config.storage) > os.time() then
        local minutes = math.ceil((getPlayerStorageValue(cid, config.storage) - os.time()) / 60)
        local s = (minutes == 1 and "" or "s")
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Boost is active, maybe wait ".. minutes .." minute".. s ..".")
        doSendMagicEffect(getCreaturePosition(cid), config.efeitoPoff)
        return true
    end

    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You received a haste effect.")
    doSendMagicEffect(getCreaturePosition(cid), config.efeitoBoost)

    local durationInSeconds = 90
    local condition = createConditionObject(CONDITION_HASTE)
    setConditionParam(condition, CONDITION_PARAM_TICKS, durationInSeconds * 1000)
    setConditionParam(condition, CONDITION_PARAM_SPEED, 100)
    doAddCondition(cid, condition)
   
    setPlayerStorageValue(cid, config.storage, os.time() + durationInSeconds)
    doRemoveItem(item.uid, 1)

    return true
end

or

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local config = {
        level = 50,    
        storage = 42007,
        efeitoBoost = CONST_ME_MAGIC_BLUE,
        efeitoPoff = CONST_ME_HEARTS
    }

    if getPlayerLevel(cid) < config.level then
        doPlayerSendCancel(cid, "You do not have enough level to use this.")
        return true
    end

    if getPlayerStorageValue(cid, config.storage) > os.time() then
        local minutes = math.ceil((getPlayerStorageValue(cid, config.storage) - os.time()) / 60)
        local s = (minutes == 1 and "" or "s")
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Boost is active, maybe wait ".. minutes .." minute".. s ..".")
        doSendMagicEffect(getCreaturePosition(cid), config.efeitoPoff)
        return true
    end

    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You received a haste effect.")
    doSendMagicEffect(getCreaturePosition(cid), config.efeitoBoost)

    local durationInSeconds = 90
    local condition = createConditionObject(CONDITION_HASTE)
    setConditionParam(condition, CONDITION_PARAM_TICKS, durationInSeconds * 1000)
    setConditionFormula(condition, 0.8, -56, 0.7, -56)
    doAddCondition(cid, condition)
   
    setPlayerStorageValue(cid, config.storage, os.time() + durationInSeconds)
    doRemoveItem(item.uid, 1)

    return true
end
hello. the first script gives an error :

[30/8/2023 10:57:5] [Error - Action Interface]
[30/8/2023 10:57:5] data/actions/scripts/speed boost.lua:eek:nUse
[30/8/2023 10:57:5] Description:
[30/8/2023 10:57:5] (LuaInterface::luaSetConditionFormula) Condition not found

the second script gives no error but the speed doesn't change

(sorry, my english is not good)
 
hello. the first script gives an error :

[30/8/2023 10:57:5] [Error - Action Interface]
[30/8/2023 10:57:5] data/actions/scripts/speed boost.lua:eek:nUse
[30/8/2023 10:57:5] Description:
[30/8/2023 10:57:5] (LuaInterface::luaSetConditionFormula) Condition not found

the second script gives no error but the speed doesn't change

(sorry, my english is not good)
PM!
 
Back
Top