oualid6496
Well-Known Member
Is it possible to reduce exhaust on potions, runes and spells in general?
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?for potions/runes: https://otland.net/threads/player-setexhaustion-player-getexhaustion-tfs-1-0.224233/
as for spells you just change the exhaustion in the xml
you add it to player lib and you're able to call it with player:setExhaustion/getExhaustionYea 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?
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
if player:getExhaustion(1000) <= 0 then
player:setExhaustion(1000, 10)
else
print('You\'re exhausted for: '..player:getExhaustion(1000)..' seconds.')
end