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

Player.setExhaustion, Player.getExhaustion [TFS 1.0]

that's the odd thing, it always returns false

In that case print out getExhaustion and see what you get, might be something with the storage key, what the function returns in terms of that we are comparing it to another time stamp etc.
 
The accuracy of this exhaust is +/- 999ms. Consider changing os.time to os.mtime. Not sure if mtime is implemented though as standard C lua dosn't seem to have it.
And if the integer value is to big to be stored perhaps just strip away a static 50 years or so from the timestamp.
 
@Znote
what the difference between os.time and os.mtime ?

os.time returns timestamp in seconds, mtime returns in milliseconds.

So if you cast a spell at 2.93 seconds, and the spell has 1 second exhaust, you will be able to cast it again in 0.07 seconds because the second timestamp will change between 2(.93) to 3(.00).
Using mtime to return it in milliseconds means if you cast a spell at 2.931 seconds with 1 second cooldown, you will have to wait until time has elapsed into 3.931 seconds.
 
This script has me confused as for how it would work. Could someone explain this to me? From looking at the script, the only time when the storage changes is when you set it yourself. Thus, how could
Code:
local storage = self:getStorageValue(value)
if storage <= 0 then
return 0
end
ever compute as true, unless you set it to <= 0 yourself?

With this change, it works fine for me:
Code:
if storage - os.time() <= 0 then

However, I'm curious; is there something I'm missing that makes the original script work the same way? :eek:
 
This script has me confused as for how it would work. Could someone explain this to me? From looking at the script, the only time when the storage changes is when you set it yourself. Thus, how could
Code:
local storage = self:getStorageValue(value)
if storage <= 0 then
return 0
end
ever compute as true, unless you set it to <= 0 yourself?

With this change, it works fine for me:
Code:
if storage - os.time() <= 0 then

However, I'm curious; is there something I'm missing that makes the original script work the same way? :eek:
The only time storage will be less than zero is when it's not initialized, or you set it yourself to be less than zero. Your change will work fine and is better because you won't get negative values as time goes on.
 
cuz I'm working on a little system that improve the loot of monsters, but I want to change the message that is sended to the player when kill some monster
exemple:
normal kill:
loot of a rat: gold coin
bonus loot kill:
loot of a rat: gold coin, Lucky Bonus: cheese
 
cuz I'm working on a little system that improve the loot of monsters, but I want to change the message that is sended to the player when kill some monster
exemple:
normal kill:
loot of a rat: gold coin
bonus loot kill:
loot of a rat: gold coin, Lucky Bonus: cheese

Then use onKill.
I mean I have been out of the game for awhile, but I'm pretty sure thats still there.

Also if you were "working on a little system" then why not just ask for help learning. If you thought you would need to change the source code to send that message, then you are clearly lost my friend. This community is great for helping. The general consensus for help seems to be that no one wants to help someone who doesn't want to learn tho.
 
Then use onKill.
I mean I have been out of the game for awhile, but I'm pretty sure thats still there.

Also if you were "working on a little system" then why not just ask for help learning. If you thought you would need to change the source code to send that message, then you are clearly lost my friend. This community is great for helping. The general consensus for help seems to be that no one wants to help someone who doesn't want to learn tho.
I already have onKill script, but seems that now I got it :eek: I have an idea to change the message, but I do not have compiled tfs in my computer to test, but when possible I'll test, thanks!
 
The accuracy of this exhaust is +/- 999ms. Consider changing os.time to os.mtime. Not sure if mtime is implemented though as standard C lua dosn't seem to have it.
And if the integer value is to big to be stored perhaps just strip away a static 50 years or so from the timestamp.

Hello sir I replaced os.time() with os.mtime() and as you said the number gets way too so that the function stops working. What would be the best way to make the number smaller so that we can use it? Since I need to check the milliseconds.
 
Hello sir I replaced os.time() with os.mtime() and as you said the number gets way too so that the function stops working. What would be the best way to make the number smaller so that we can use it? Since I need to check the milliseconds.
transform the number to a string
 
Back
Top