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

Can someone explain me exhaust system?

Marko999x

999x era
Premium User
Joined
Dec 14, 2017
Messages
2,755
Solutions
80
Reaction score
1,891
Location
Germany
tfs 1.3

Im using it like

Lua:
local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, 500)

if player:getCondition(CONDITION_EXHAUST_HEAL) then
   player:sendTextMessage(MESSAGE_STATUS_SMALL, 'exhausted')
   return true
end
    
player:addCondition(exhaust)

but the exhaust is like 1sec which should be half sec as you see above
what im doing wrong?
im confused
 
Solution
You can try to check endTime of condition:
Lua:
local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, 500)

local foundCondition = player:getCondition(CONDITION_EXHAUST_HEAL)
if foundCondition and foundCondition:getEndTime() > os.mtime() then
   player:sendTextMessage(MESSAGE_STATUS_SMALL, 'exhausted')
   return true
end
    
player:addCondition(exhaust)
That way you should detect that condition listed in creature.cpp should be already removed.
Have you tried both extremes to see if it calculates ticks properly, has a set minimum, or ignores this completely?

ie
0,500,1000,10000
 
Over 1000 its working perfect which means I can use 1500 or 3000 or what ever but once I go lower than 1000 it acts weird
So I think somewhere is a limit set
 
You can also try changing this:
Code:
exhaust:setParameter(CONDITION_PARAM_TICKS, 500)
to this:
Code:
exhaust:setTicks(500)

Btw. if you are using it in action, check your config.lua timeBetweenActions and timeBetweenExActions.
 
You can also try changing this:
Code:
exhaust:setParameter(CONDITION_PARAM_TICKS, 500)
to this:
Code:
exhaust:setTicks(500)

Btw. if you are using it in action, check your config.lua timeBetweenActions and timeBetweenExActions.

still same

-- Item Usage
timeBetweenActions = 1
timeBetweenExActions = 1

its set to 1 alredy
 
So it seems essentially there is a minimum of 1000 set somewhere. I checked sources and didn’t see anything obvious, it just returns ticks.

Is this on clean tfs latest build?
 
Last edited:
I could never figure this out either, wasn't important so didn't try to solve it, would be cool to see it resolved here though.

For what it's worth, I converted my applicable scripts to be a "spell" when I wanted <1000 exhaust since spell exhaust works perfectly down to 100ms (not tested below).
 
executeCondition (checkCreatures in game class) is executed every 1 second, so setting it under 1s, will not work as expected and in some cases it will be 1s, because that's the time from one execution to another and executeCondition ends conditions
Easiest fix for that is to change 1000ms to for example 500ms, but that will execute faster which means it will consume more cpu
or... if you dont want to mess with that, just use storage with time stored in there, os.mtime() + 500 and check if storage <= os.mtime()
you cant save it in storages cause they are max u32 though, so you have to keep this in memory
 
Last edited:
You can try to check endTime of condition:
Lua:
local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, 500)

local foundCondition = player:getCondition(CONDITION_EXHAUST_HEAL)
if foundCondition and foundCondition:getEndTime() > os.mtime() then
   player:sendTextMessage(MESSAGE_STATUS_SMALL, 'exhausted')
   return true
end
    
player:addCondition(exhaust)
That way you should detect that condition listed in creature.cpp should be already removed.
 
Solution
You can try to check endTime of condition:
Lua:
local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, 500)

local foundCondition = player:getCondition(CONDITION_EXHAUST_HEAL)
if foundCondition and foundCondition:getEndTime() > os.mtime() then
   player:sendTextMessage(MESSAGE_STATUS_SMALL, 'exhausted')
   return true
end
   
player:addCondition(exhaust)
That way you should detect that condition listed in creature.cpp should be already removed.
Thats even better
 
-- Item Usage
timeBetweenActions = 500 << exhaust for fishing rod and torch type itens...
timeBetweenExActions = 1000 << exhaust for vials...
 
Back
Top