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

Tfs 1.2 Exhaust

Yea I saw that but I didn't really understand how to use it. Do I have to add it in potions.lua or create a new action?

And for the spells so I will have to reduce it for every spell?
you add it to player lib and you're able to call it with player:setExhaustion/getExhaustion
as for spells yes you have to change each one
 
As it's action, you'll need to lower timeBetweenExActions in your config.lua in order to decrease it's exhausted time.
Please note that doing that you'll change every time of any action performed by the player.
This is just a workaround.


To use that script @Xeraphus posted above, you'll need to add this to your lib function files:

THIS SCRIPT WAS MADE BY @Printer AND CAN BE FOUND HERE: https://otland.net/threads/player-setexhaustion-player-getexhaustion-tfs-1-0.224233/
PHP:
function Player.setExhaustion(self, value, time)
    self:setStorageValue(value, time + os.time())
end

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

    return storage - os.time()
end

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

To make it work you'll need to set few checks to your potions script file:

PHP:
   if player:getExhaustion(1000) <= 0 then
        player:setExhaustion(1000, 10)
    else
        print('You\'re exhausted for: '..player:getExhaustion(1000)..' seconds.')
    end

Where player:getExhaustion(1000) <= 0, you're checking if the exhausted has ended, below or equals to zero (seconds).
Where player:setExhaustion(1000, 10) you're setting an exhausted of 10 seconds to the player

1000 is the storage you're using to save that specific storage (potions) and should be changed to a unused storage.
10 is the numeric value of the exhaustion in seconds.
 
Back
Top