• 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.X+ Issue - distance auto attack stops with potion use

nugo

Australia OT Mapper
Joined
Apr 1, 2009
Messages
396
Solutions
4
Reaction score
194
Hello,

Its probably easier if i just post this convo:

14:43 Mazz [525]: after you pot
14:43 Mazz [525]: it resets the arrow autoattack
14:43 Mazz [525]: same with using a rune
14:43 Mazz [525]: after you pot or use a rune
14:43 Mazz [525]: wont be able to autoattack for 2 seconds
14:43 Mazz [525]: they share the same cooldown
14:43 Mazz [525]: that doesnt happen in RL tibia
14:44 Mazz [525]: its ok
14:44 Mazz [525]: if i only have to juggle potting and autoattack
14:44 Mazz [525]: but if i have to juggle that and runes
14:44 Mazz [525]: then it really doesnt make it smooth to play
14:44 Mazz [525]: thats my main issue
14:44 Nugo [1337]: is it just paladins
14:44 Mazz [525]: all vocs
14:44 Mazz [525]: mages cant rune after potting either
14:44 Mazz [525]: for 2sec
14:44 Mazz [525]: but mages dont have to pot every turn
14:44 Mazz [525]: +like i do

Any ideas, my config lua is the stock standard TFS repo one:


Code:
timeBetweenActions = 200
timeBetweenExActions = 1000

I noticed otserverBR's is:

Code:
timeBetweenActions = 500
timeBetweenExActions = 700

I am using TFS 1.2 official repo release.

Cheers
 
Hello,

Its probably easier if i just post this convo:

14:43 Mazz [525]: after you pot
14:43 Mazz [525]: it resets the arrow autoattack
14:43 Mazz [525]: same with using a rune
14:43 Mazz [525]: after you pot or use a rune
14:43 Mazz [525]: wont be able to autoattack for 2 seconds
14:43 Mazz [525]: they share the same cooldown
14:43 Mazz [525]: that doesnt happen in RL tibia
14:44 Mazz [525]: its ok
14:44 Mazz [525]: if i only have to juggle potting and autoattack
14:44 Mazz [525]: but if i have to juggle that and runes
14:44 Mazz [525]: then it really doesnt make it smooth to play
14:44 Mazz [525]: thats my main issue
14:44 Nugo [1337]: is it just paladins
14:44 Mazz [525]: all vocs
14:44 Mazz [525]: mages cant rune after potting either
14:44 Mazz [525]: for 2sec
14:44 Mazz [525]: but mages dont have to pot every turn
14:44 Mazz [525]: +like i do

Any ideas, my config lua is the stock standard TFS repo one:


Code:
timeBetweenActions = 200
timeBetweenExActions = 1000

I noticed otserverBR's is:

Code:
timeBetweenActions = 500
timeBetweenExActions = 700

I am using TFS 1.2 official repo release.

Cheers

Paste this in config.lua
Code:
timeBetweenActions = 100 -- Time before you can use other actions, 100 is the lowest working value.
timeBetweenExActions = 500 -- Time before you can use the same action (potion, rune, etc.), 100 is the lowest working value.
maxPacketsPerSecond = 75 -- more packets from player per second, more packets=need stronger server :D
 
Paste this in config.lua
Code:
timeBetweenActions = 100 -- Time before you can use other actions, 100 is the lowest working value.
timeBetweenExActions = 500 -- Time before you can use the same action (potion, rune, etc.), 100 is the lowest working value.
maxPacketsPerSecond = 75 -- more packets from player per second, more packets=need stronger server :D
No luck, didnt think that would help. I have provided some Gifs to demonstrate the issue. All below tests done with mana potion but its my understanding its all potions that do it.

Paladin - Issue were auto attacks dont happen while potting

ThSSuUT.gif


Knight - Acts as normal auto attacks continue while potting

be3GhPT.gif


Sorc - Acts as normal can still SD attack as normal while potting

Jv71Ugk.gif


Potions.lua - Not sure if this is even related but here it is anyway.

Lua:
local supremeHealthPot = 26031
local ultimateSpiritPot = 26030
local ultimateManaPot = 26029
local ultimateHealthPot = 8473
local greatHealthPot = 7591
local greatManaPot = 7590
local greatSpiritPot = 8472
local strongHealthPot = 7588
local strongManaPot = 7589
local healthPot = 7618
local manaPot = 7620
local smallHealthPot = 8704
local antidotePot = 8474
local greatEmptyPot = 7635
local strongEmptyPot = 7634
local emptyPot = 7636

local antidote = Combat()
antidote:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
antidote:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
antidote:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
antidote:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
antidote:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON)

-- local exhaust = Condition(CONDITION_EXHAUST_HEAL)
-- exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))
-- edited this section out so that potions are actually every 1 second, they are governed by con fig lau minimum exhaust
local t = {
    -- Supreme health potion
    [26031] = {vocArray = {4, 8}, level = 200, str = "knights", func = function(p) return doTargetCombatHealth(0, p, COMBAT_HEALING, 875, 1125, CONST_ME_MAGIC_BLUE) end},
    -- Ultimate spirit potion
    [26030] = {vocArray = {3, 7}, level = 130, str = "paladins", func = function(p) return doTargetCombatHealth(0, p, COMBAT_HEALING, 420, 680, CONST_ME_MAGIC_BLUE), doTargetCombatMana(0, p, 150, 250, CONST_ME_MAGIC_BLUE) end},
    -- Ultimate health potion
    [8473]  = {vocArray = {4, 8}, level = 130, str = "knights", func = function(p) return doTargetCombatHealth(0, p, COMBAT_HEALING, 650, 860, CONST_ME_MAGIC_BLUE) end},
    -- Great health potion
    [7591]  = {vocArray = {3, 4, 7, 8}, level = 80, str = "knights", func = function(p) return doTargetCombatHealth(0, p, COMBAT_HEALING, 425, 575, CONST_ME_MAGIC_BLUE) end},
    -- Great spirit potion
    [8472]  = {vocArray = {3, 7}, level = 80, str = "paladins", func = function(p) return doTargetCombatHealth(0, p, COMBAT_HEALING, 250, 350, CONST_ME_MAGIC_BLUE), doTargetCombatMana(0, p, 100, 200, CONST_ME_MAGIC_BLUE) end},
    -- Strong health potion
    [7588]  = {vocArray = {3, 4, 7, 8}, level = 50, str = "paladins and knights", func = function(p) return doTargetCombatHealth(0, p, COMBAT_HEALING, 250, 350, CONST_ME_MAGIC_BLUE) end},
    -- Ultimate mana potion
    [26029] = {vocArray = {1, 2, 5, 6}, level = 130, str = "sorcerers, druids and knights", func = function(p) return doTargetCombatMana(0, p, 425, 575, CONST_ME_MAGIC_BLUE) end},
    -- Great mana potion
    [7590]  = {vocArray = {1, 2, 5, 6}, level = 80, str = "sorcerers and druids", func = function(p) return doTargetCombatMana(0, p, 150, 250, CONST_ME_MAGIC_BLUE) end},
    -- Strong mana potion
    [7589]  = {vocArray = {1, 2, 3, 4, 5, 6, 7, 8}, level = 50, str = "sorcerers and druids", func = function(p) return doTargetCombatMana(0, p, 115, 185, CONST_ME_MAGIC_BLUE) end},
    -- Mana potion
    [7620]  = {func = function(p) return doTargetCombatMana(0, p, 75, 125, CONST_ME_MAGIC_BLUE) end},
    -- Health potion
    [7618]  = {func = function(p) return doTargetCombatHealth(0, p, COMBAT_HEALING, 125, 175, CONST_ME_MAGIC_BLUE) end},
    -- Small health potion
    [8704]  = {func = function(p) return doTargetCombatHealth(0, p, COMBAT_HEALING, 60, 90, CONST_ME_MAGIC_BLUE) end},
    -- Antidote potion
    [8474]  = {func = function(p) return antidote:execute(p, numberToVariant(p:getId())) end}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not target:getPlayer() then
        return true
    end
    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end

    local tmp = t[item.itemid]
    if tmp then
        local level = tmp.level or 0
        if tmp.vocArray and (not isInArray(tmp.vocArray, target:getVocation():getId()) or target:getLevel() < level) and not getPlayerFlagValue(player, PlayerFlag_IgnoreSpellCheck) then
            player:say(string.format("This potion can only be consumed by %s of level %d or higher.", tmp.str, level), TALKTYPE_MONSTER_SAY)
            return true
        end
        if not tmp.func(target) then
            return false
        end
--       player:addCondition(exhaust)
        target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
        item:remove(1)
        player:addItem(tmp.empty, 1)
    end
    return true
end
 
Last edited:
Diff:
 function onUse(player, item, fromPosition, target, toPosition, isHotkey)
     if not target:getPlayer() then
         return true
     end
     if player:getCondition(CONDITION_EXHAUST_HEAL) then
         player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
-        return true
+        return false
     end
 
     local tmp = t[item.itemid]
     if tmp then
         local level = tmp.level or 0
         if tmp.vocArray and (not isInArray(tmp.vocArray, target:getVocation():getId()) or target:getLevel() < level) and not getPlayerFlagValue(player, PlayerFlag_IgnoreSpellCheck) then
             player:say(string.format("This potion can only be consumed by %s of level %d or higher.", tmp.str, level), TALKTYPE_MONSTER_SAY)
             return true
         end
         if not tmp.func(target) then
             return false
         end
 --       player:addCondition(exhaust)
         target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
         item:remove(1)
         player:addItem(tmp.empty, 1)
     end
     return true
 end
 
Diff:
 function onUse(player, item, fromPosition, target, toPosition, isHotkey)
     if not target:getPlayer() then
         return true
     end
     if player:getCondition(CONDITION_EXHAUST_HEAL) then
         player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
-        return true
+        return false
     end

     local tmp = t[item.itemid]
     if tmp then
         local level = tmp.level or 0
         if tmp.vocArray and (not isInArray(tmp.vocArray, target:getVocation():getId()) or target:getLevel() < level) and not getPlayerFlagValue(player, PlayerFlag_IgnoreSpellCheck) then
             player:say(string.format("This potion can only be consumed by %s of level %d or higher.", tmp.str, level), TALKTYPE_MONSTER_SAY)
             return true
         end
         if not tmp.func(target) then
             return false
         end
--       player:addCondition(exhaust)
         target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
         item:remove(1)
         player:addItem(tmp.empty, 1)
     end
     return true
end
No luck, I am using an older datapack as its one i have had for years to build my server but i isntalled and set up a fresh version of the 1.2 release im using and im able to replicate the issue on it. I have looked on github for a possible fix after 1.2's release but im useless at github haha.

 
Last edited:
No luck, I am using an older datapack as its one i have had for years to build my server but i isntalled and set up a fresh version of the 1.2 release im using and im able to replicate the issue on it.

Ok i test it with storages and os.time, then i test by using not "potion" items and problem also appear. So, its not problem of condition or exhaust.
I will chec ksource to find it out, give me some min.

@edit
Its look like, every distance shoot is "programmed" as use item/weapon.
 
Last edited:
Hello,

Its probably easier if i just post this convo:

14:43 Mazz [525]: after you pot
14:43 Mazz [525]: it resets the arrow autoattack
14:43 Mazz [525]: same with using a rune
14:43 Mazz [525]: after you pot or use a rune
14:43 Mazz [525]: wont be able to autoattack for 2 seconds
14:43 Mazz [525]: they share the same cooldown
14:43 Mazz [525]: that doesnt happen in RL tibia
14:44 Mazz [525]: its ok
14:44 Mazz [525]: if i only have to juggle potting and autoattack
14:44 Mazz [525]: but if i have to juggle that and runes
14:44 Mazz [525]: then it really doesnt make it smooth to play
14:44 Mazz [525]: thats my main issue
14:44 Nugo [1337]: is it just paladins
14:44 Mazz [525]: all vocs
14:44 Mazz [525]: mages cant rune after potting either
14:44 Mazz [525]: for 2sec
14:44 Mazz [525]: but mages dont have to pot every turn
14:44 Mazz [525]: +like i do

Any ideas, my config lua is the stock standard TFS repo one:


Code:
timeBetweenActions = 200
timeBetweenExActions = 1000

I noticed otserverBR's is:

Code:
timeBetweenActions = 500
timeBetweenExActions = 700

I am using TFS 1.2 official repo release.

Cheers
 

I found this thread.


Do you think this would still work? At work but I'll test when I'm home.

I also found this

@Evil Puncker mentioned it was intended behaviour but I don't think that's correct.

I'm going to test if this is an issue on 1.3 when I'm home
 
Last edited:
I found this thread.


Do you think this would still work? At work but I'll test when I'm home.

I also found this

@Evil Puncker mentioned it was intended behaviour but I don't think that's correct.

I'm going to test if this is an issue on 1.3 when I'm home

Swing option is for older distributions, 0.3.6/0.4
There is no solve of it in github etc.
You can use my fix or do nothing with that xD
 
After doing some learning i have fixed it.


Just so people are aware this is a issue in the official tfs 1.2 release. You need a source edit to fix this issue. For people looking for this in the future the swing = true comments on other threads is for tfs version below 1.0

This fixed the issue for me.


There is a disclaimier

Lua:
-- NOTE: classicAttackSpeed set to true makes players constantly attack at regular
-- intervals regardless of other actions such as item (potion) use. This setting
-- may cause high CPU usage with many players and potentially affect performance!

I will reply on this thread with how it effected performance once i put it on my live server.
 
After doing some learning i have fixed it.


Just so people are aware this is a issue in the official tfs 1.2 release. You need a source edit to fix this issue. For people looking for this in the future the swing = true comments on other threads is for tfs version below 1.0

This fixed the issue for me.


There is a disclaimier

Lua:
-- NOTE: classicAttackSpeed set to true makes players constantly attack at regular
-- intervals regardless of other actions such as item (potion) use. This setting
-- may cause high CPU usage with many players and potentially affect performance!

I will reply on this thread with how it effected performance once i put it on my live server.

As promised an update on this change. Maybe it's not exactly what is required but none the less it's solved the issue, had no impact on my server (around 45 on online avg) and has had no noticeable side effects.
 
Back
Top