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

Is there any disableExhaustion or disableCooldown function?

Guiaki

Member
Joined
Jan 3, 2011
Messages
137
Reaction score
8
I wanted to make a spell that disabled your cooldowns for like 5 seconds, is such a thing possible?

--EDIT--
Just tried this way:
Code:
doRemoveCondition(cid, CONDITION_SPELLCOOLDOWN)
    doRemoveCondition(cid, CONDITION_SPELLGROUPCOOLDOWN)
It don't seem to have worked
 
Last edited:
Its possible to do a workaround if you use storage based exhaustions. Abit of work but may do the trick if you deem worth it.

In the spell you use to remove cooldowns
Code:
exhaustion.set(cid, REMOVECOOLDOWNSTORAGE, SECONDS)

Intop of spells just under function.
Code:
if exhaustion.check(cid, SPELLSTORAGE) then
  doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
  doPlayerSendCancel(cid, "You are exhausted.")
  return false
end
if not exhaustion.check(cid, REMOVECOOLDOWNSTORAGE) then
exhaustion.set(cid, SPELLSTORAGE, SECONDS)
end

or

Code:
if exhaustion.check(cid, SPELLSTORAGE) and if(not exhaustion.check(cid, REMOVECOOLDOWNSTORAGE)) then
  doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
  doPlayerSendCancel(cid, "You are exhausted.")
  return false
end
exhaustion.set(cid, SPELLSTORAGE, SECONDS)






In top of global.lua
Code:
dofile('data/lib/001_exhaustion.lua')

Add a .lua in data/lib with (Or add into in global.lua instead and ignore previous step)
Code:
 exhaustion =
    {
            check = function (cid, storage)
                    return getPlayerStorageValue(cid, storage) >= os.time(t)
            end,

            get = function (cid, storage)
                    local exhaust = getPlayerStorageValue(cid, storage)
                    if(exhaust > 0) then
                            local left = exhaust - os.time(t)
                            if(left >= 0) then
                                    return left
                            end
                    end

                    return false
            end,

            set = function (cid, storage, time)
                    setPlayerStorageValue(cid, storage, os.time(t) + time)
            end,

            make = function (cid, storage, time)
                    local exhaust = exhaustion.get(cid, storage)
                    if(not exhaust) then
                            exhaustion.set(cid, storage, time)
                            return true
                    end

                    return false
            end
    }
 
Last edited:
Back
Top