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

Problem in potions.lua

uniqiwwn

New Member
Joined
Jun 17, 2015
Messages
7
Reaction score
0
Hello

I have a problem with potions in my server. It seems that there is a 2sec CD between using them. I manage to solve the problem by editing this line in my potions.lua:
Code:
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))
to this
Code:
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 1000))
But why do i have to do that? In my config.lua i have these lines:
Code:
timeBetweenActions = 200
timeBetweenExActions = 1000
If i'm setting to 1ms why it takes 2sec? I know how long it is taking because i added this code:
Code:
print(os.date("%c"))
just after this line:
Code:
doCreatureSayWithRadius(target, 'Aaaah...', TALKTYPE_MONSTER_SAY, 2, 2)
So it prints on the console the time it used the potion.

Datapack: Lastest from https://otland.net/threads/10-77-tfs-1-2-orts-a-real-map-project.204514/
Distro: Lastest TFS from https://github.com/otland/forgottenserver/ compiled on my own machine using Windows 8.1.

As i said i manage to solve the problem but i wanna know why was that needed and if it can have any other unwanted effects.

PS: I want this to be as close as possible to rl tibia.

Thanks!
 
That's weird, the - 100 was probably added to compensate for network latency, since the the client polls the server every 1 second when holding down a hotkey button without releasing it.
Have you tried spamming/pressing the key repeatedly? It should not be 2 seconds under any circumstances.

BTW, for a more precise display of time you can use:
Code:
print(os.clock())
 
Yeah, i agree with you. I have no idead what's happening. I just did some tests and look:

- With -1000

Code:
48.748
49.779
50.749
51.75
52.777
53.778
54.779
55.779
56.779
57.779

- With -100

Code:
96.537
98.574
100.586
102.606
104.646
106.648
108.686
110.728
112.474

Meh... :<
 
Weird, you shouldn't be having that kind of latency on localhost. Try with -200 or -300 and see if it's still 2 seconds apart.
Or just remove the exhaust thing altogether, shouldn't affect much, maybe except for allowing you to combo potions and healing spells (not sure about this one).
 
I think the problem is not about latency. The monters move normal and i can run without any glitch if i hold down the arrow key. I'll try to do some tests when i get back home.
 
I also think latency isn't a problem on localhost, but 1000 - 100 is 900 milliseconds and that shouldn't be causing a cooldown of 1 second to suddenly become 2 seconds long.
 
Hmm. Well i've just logged in RL Tibia and held down a hotkey for using mana potion. I got no exhausted message and i can spam the pots they just take like 1sec for one to another. Also i've tried to press the hotkey once and then press another hotkey to cast any heal spell like 'exura' and it worked.

So i commented this line in my potions.lua:

Code:
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))

And everything worked like in RL Tibia. It's like the Server or anything else already has a 1s cooldown and by addin that line i'm just addin more 900 miliseconds so it becomes 1900ms which is almost 2s and explains why it's behaving like that.
 
And everything worked like in RL Tibia. It's like the Server or anything else already have a 1s cooldown and by addin that line i'm just addin more 900 miliseconds so it becomes 1900ms which is almost 2s and explain why it's behaving like that.
Cooldown durations do not stack, each exhaust condition sets the cooldown to an exact value, if a cooldown of a higher duration isn't already present in the current group. That's why i suggested testing with lower values (-200, -500) to see at which threshold it starts to work normally.
 
With these values it seems that the result is the same:

-500
Code:
17.375
19.375
21.376
23.378
25.379

-200
Code:
90.95
92.952
94.959
96.96
98.98

Along with the exhausted message.

I think i'll keep that way. Just need to play a bit to be sure there isn't any unwanted effect.

Thank you!
 

Similar threads

Back
Top