• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Exhaust in manarune that will be taken from ('timeBetweenExActions') TFS 1.2

UnLucky

New Member
Joined
Jul 15, 2021
Messages
36
Reaction score
1
GitHub
UnLucky
I need an exhaust in manarune that will be taken from ('timeBetweenExActions').

TFS 1.2

I need have in config :
-- Item Usage
timeBetweenActions = 0
timeBetweenExActions = 0

but maybe Its possible to add ('timeBetweenExActions') to lua? for manarune.Lua?.

Lua:
local exhaust = Condition(CONDITION_EXHAUST)
exhaust:setParameter(CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions') + 1000) -- Here you can put your exhaust as you want. ( 1000 means = 1 second )

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
 
    local level = player:getLevel()
    local magLevel = player:getMagicLevel()
    local min = (level * 1) + (magLevel * 1) -- for every level you heal 1 mana more so if you setup 10 you'll heal for every level 10 mana more / same for magic level.
    local max = (level * 1) + (magLevel * 1)
    local mana_add = math.random(min,max)

    targetPlayer = Player(target)
    if not targetPlayer then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You may only use this on players!")
        return true
    end

    local pos = targetPlayer:getPosition()
 
    if player:getCondition(CONDITION_EXHAUST) then
       player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
       return true
    end

    targetPlayer:addMana(mana_add)

    -- This part allows you to heal with animated text even without source edits or custom client.
    local spectators = Game.getSpectators(pos, false, false, 13, 13, 7, 7)
    if #spectators > 0 then
        for i = 1, #spectators do
            local spectator = spectators[i]
            if spectator:isPlayer() then
                spectator:sendTextMessage(MESSAGE_HEALED, nil, pos, mana_add, TEXTCOLOR_YELLOW) -- <-- There you can change the color as you want.
            end
        end
    end
   
    pos:sendMagicEffect(CONST_ME_MAGIC_RED)
    targetPlayer:addCondition(exhaust)
    return true
end
 

Levi999x

AoT
Joined
Dec 14, 2017
Messages
2,092
Solutions
53
Reaction score
1,352
Location
Germany
what if someone use 2 mrs? xD
tfs 1.2 already has os.mtime(), so you don't need to add it.

The setStorage and getStorage functions seem to be hard-coded to use int 32 values.. and I have no idea how to change it to 64 bit.. cuz everytime I do, it throws errors when compiling.


So let's just ignore using storages completely, I guess.

For this situation, with such a small time, we can just use a table.

Lua:
local exhaust = {}
local exhaustTime = 2000

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local playerId = player:getId()
    local currentTime = os.mtime()
    if exhaust[playerId] and exhaust[playerId] > currentTime then
        player:sendCancelMessage("This rune is still on cooldown. (MS:" .. exhaust[playerId] - currentTime .. ")")
        return true
    end
   
    targetPlayer = Player(target)
    if not targetPlayer then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You may only use this on players!")
        return true
    end
   
    local level = player:getLevel()
    local magLevel = player:getMagicLevel()
    local min = (level * 1) + (magLevel * 1) -- for every level you heal 1 mana more so if you setup 10 you'll heal for every level 10 mana more / same for magic level.
    local max = (level * 1) + (magLevel * 1)
    local mana_add = math.random(min,max)
   
    local pos = targetPlayer:getPosition()   
    targetPlayer:addMana(mana_add)
   
    -- This part allows you to heal with animated text even without source edits or custom client.
    local spectators = Game.getSpectators(pos, false, false, 13, 13, 7, 7)
    if #spectators > 0 then
        for i = 1, #spectators do
            local spectator = spectators[i]
            if spectator:isPlayer() then
                spectator:sendTextMessage(MESSAGE_HEALED, nil, pos, mana_add, TEXTCOLOR_YELLOW) -- <-- There you can change the color as you want.
            end
        end
    end
   
    pos:sendMagicEffect(CONST_ME_MAGIC_RED)
    exhaust[playerId] = currentTime + exhaustTime
    return true
end
 
Top