• 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.5 8.6] STAT_MAXHITPOINTS problem with multiple items

VitoxMaster

Member
Joined
Feb 6, 2023
Messages
38
Reaction score
16
Hi everyone!

I've been working on resistance upgrade system recently. I'm working on TFS 1.5 Nekiro downgrade to 8.6 and I've experienced weird condition behaviour. I have to mention that I've implemented ability feature from tfs-1-3-item-abilities-via-lua-v2.

This 'weird behaviour' is related to condition "maxhitpointspercent". Player on my server can upgrade its gear to have special attribute (ITEM_ABILITY_STAT_MAXHITPOINTSPERCENT) what is treated as "maxhitpointspercent" item attribute. Let's say I've got item with 2 % hp boost (so it's 102% to be precise). Note: If I set value to 2 % instead of 102 %, my HP will dramatically shrink to black HP. Short scenario to better describe what's goin' on:
T_0 -> nothing equipped 2650 HP
1694469674782.png
T_1 -> wear boots with boost
1694469716704.png1694469724165.png
As you can see my overall health increased by 53 HP (2%). We could say it's working. However problem occurs when...
T_3 -> I equip another item with same boost (so next base 102%).
1694469923217.png1694469931274.png
With 2 items equipped my overall HP changed to 5406 (204 % of base HP).
How can I neglect impact of "100" value in whole condition processing? I just want to add 2 % to 2% instead of summing up whole values.

Anyone has experienced something similar? Any ideas what should be changed in source code? Is it somehow fixed / resolved in main TFS 1.5 repo?
Thanks in advance!
 
Solution has been found. I will leave information here for those who have struggled with this problem or will struggle with it after implementing the script related to items abilities.

Code:
 data/scripts/ItemAbilities/2_core.lua

Lua:
function ItemAbilities.getCondition(key, value)
    local def = ABILITY_CONDITIONS[key]
    if def then
        -- update condition value before updating player
        if def.key then
            if (key == 'IA_MAXHITHPOINTSPERCENT' or key == 'IA_MAXMANAPOINTSPERCENT') then
                value = math.fmod(value, 100) + 100
            end
            def.condition:setParameter(def.key, value)
        elseif def.formula then
            if key == 'IA_SPEED' then
                value = value * 2 -- since client divides speed / 2
            end
            def.condition:setFormula(0, value, 0, value)
        end
    end
    return def
end
In other words, if ability condition is maxhitpointspercent/maxmanapointspercent then neglect additional '100' in every next equipped item (done by modulo).
 
@VitoxMaster Have you found a weird behavior regarding item ability "speed", when monsters paralyze you?
Some times it gets so bad that speed remains at 5 or less, and you need to de-equip/equip to fix, or even relog...
Thanks mate!
 
Someone reported to me that such thing happened. He was slowed down by quara and couldn't 'return' to regular speed. He had to log out. I can confirm that something like that can occur, but I'm not sure what's the reason (I haven't taken it to the workbench to test it on my own so far). For sure I will leave information here if I find something useful.

Worth to mention: he didn't have any 'upgraded' item with speed.
 
Back
Top