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

Old school Exhausted system

skic

Member
Joined
Aug 15, 2020
Messages
58
Reaction score
13
I'm using TFS 1.2 and Realera map which it seems is dowgraded from 8.6 so it is possible to spam Heal + attack spell at the same time and on old school clients like 7.6 and 8.0 this was not allowed.

Example: You can spam exura gran and exori vis pretty much one after another.

Is it possible to implement exhaust somehow so when I spam one spell or rune to be exhausted for 1.5 sec or something like that before being able to spam another spell or rune?

Do I need to change something in the engine source or I can do it in lua somewhere?

I've used this script from otland: Player.setExhaustion, Player.getExhaustion [TFS 1.0] (https://otland.net/threads/player-setexhaustion-player-getexhaustion-tfs-1-0.224233/)
But I can only make it work with seconds, to be exhausted for 1, 2 , 3 etc.. seconds. Is there a way to make it work with 1.5 second or 1.7?

Thanks
 
Last edited:
I'm using TFS 1.2 and Realera map which it seems is dowgraded from 8.6 so it is possible to spam Heal + attack spell at the same time and on old school clients like 7.6 and 8.0 this was not allowed.

Example: You can spam exura gran and exori vis pretty much one after another.

Is it possible to implement exhaust somehow so when I spam one spell or rune to be exhausted for 1.5 sec or something like that before being able to spam another spell or rune?

Do I need to change something in the engine source or I can do it in lua somewhere?

I've used this script from otland: Player.setExhaustion, Player.getExhaustion [TFS 1.0] (https://otland.net/threads/player-setexhaustion-player-getexhaustion-tfs-1-0.224233/)
But I can only make it work with seconds, to be exhausted for 1, 2 , 3 etc.. seconds. Is there a way to make it work with 1.5 second or 1.7?

Thanks

Instead of os.time() you can use os.mtime(), with mtime you will put in milliseconds:
1000 = 1 second
1500 = 1.5 seconds
 
Instead of os.time() you can use os.mtime(), with mtime you will put in milliseconds:
1000 = 1 second
1500 = 1.5 seconds

You mean put it like this:
Lua:
function Player.setExhaustion(self, value, time)
    self:setStorageValue(value, time + os.mtime())
end

function Player.getExhaustion(self, value)
    local storage = self:getStorageValue(value)
    if not storage or storage <= os.mtime() then
        return 0
    end

    return storage - os.mtime()
end

function Player:hasExhaustion(value)
    return self:getExhaustion(value) >= os.mtime() and true or false
end

Code:
function onCastSpell(cid, var)
    if cid:getExhaustion(1000) <= 0 then
        cid:setExhaustion(1000, 1500)
        return doCombat(cid, combat, var)
    else
        print('You\'re exhausted for: '..cid:getExhaustion(1000)..' seconds.')
        return false
    end
end

For some reason, in onCastSpell it always goes to else part. I probably didn't write the Player functions correctly or something.
 
You mean put it like this:
Lua:
function Player.setExhaustion(self, value, time)
    self:setStorageValue(value, time + os.mtime())
end

function Player.getExhaustion(self, value)
    local storage = self:getStorageValue(value)
    if not storage or storage <= os.mtime() then
        return 0
    end

    return storage - os.mtime()
end

function Player:hasExhaustion(value)
    return self:getExhaustion(value) >= os.mtime() and true or false
end

Code:
function onCastSpell(cid, var)
    if cid:getExhaustion(1000) <= 0 then
        cid:setExhaustion(1000, 1500)
        return doCombat(cid, combat, var)
    else
        print('You\'re exhausted for: '..cid:getExhaustion(1000)..' seconds.')
        return false
    end
end

For some reason, in onCastSpell it always goes to else part. I probably didn't write the Player functions correctly or something.

Instead of:
Lua:
if cid:getExhaustion(1000) <= 0 then

change to:
Lua:
if not cid:hasExhaustion(1000) then
 
Back
Top