• 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+ TFS 1.3 Item Description (abilities) not showing

jakub742

New Member
Joined
May 1, 2010
Messages
81
Solutions
1
Reaction score
3
Location
Slovakia
Hello i just pulled latest TFS from github and implemented ItemAbilities via Lua V2. Everything works fine no errors, abilities are working correctly but i cant see those special abilities when i look on Item. I tried multiple abilities but there was no description.

19:10 You see a magic sword (Atk:48, Def:35 +3).
It can only be wielded properly by players of level 80 or higher.
It weighs 42.00 oz.
It's the Sword of Valor.


The sword has speed, absorbs, mana gain, health gain, skill sword

I see the relevant code for it in Item.cpp in getDescription
For eg. speed
Code:
if (it.abilities->speed) {
                if (begin) {
                    begin = false;
                    s << " (";
                } else {
                    s << ", ";
                }
                s << "speed " << std::showpos << (it.abilities->speed >> 1) << std::noshowpos;
            }

Can someone help ? Thanks
 
Solution
you should start over and create a pull request with the base as your fork with my code and pull all changes instead of doing it manually

Fluffydrakoz

Member
Joined
Apr 29, 2021
Messages
26
Solutions
1
Reaction score
16
GitHub
Fluffydrakoz
Hello i just pulled latest TFS from github and implemented ItemAbilities via Lua V2. Everything works fine no errors, abilities are working correctly but i cant see those special abilities when i look on Item. I tried multiple abilities but there was no description.

19:10 You see a magic sword (Atk:48, Def:35 +3).
It can only be wielded properly by players of level 80 or higher.
It weighs 42.00 oz.
It's the Sword of Valor.


The sword has speed, absorbs, mana gain, health gain, skill sword

I see the relevant code for it in Item.cpp in getDescription
For eg. speed
Code:
if (it.abilities->speed) {
                if (begin) {
                    begin = false;
                    s << " (";
                } else {
                    s << ", ";
                }
                s << "speed " << std::showpos << (it.abilities->speed >> 1) << std::noshowpos;
            }

Can someone help ? Thanks
did u try
XML:
<attribute key="showattributes" value="1" />
 
OP
OP
J

jakub742

New Member
Joined
May 1, 2010
Messages
81
Solutions
1
Reaction score
3
Location
Slovakia
do you have luaItemDesc = true in config.lua
I just tried that.
But still, im only seeing the default description without my attributes. Im using item action script to set ability on item like this:
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local position = player:getPosition()
    target:setAbility(ITEM_ABILITY_ABSORBPHYSICAL, 10)
    target:setAbility(ITEM_ABILITY_SKILL_SWORD, 5)
    target:setAbility(ITEM_ABILITY_MANAGAIN, 50)
    target:setAbility(ITEM_ABILITY_MANATICKS, 2000)
    target:setAbility(ITEM_ABILITY_CRITICALHITCHANCE, 50)
    target:setAbility(ITEM_ABILITY_CRITICALHITAMOUNT, 400)
    target:setAbility(ITEM_ABILITY_ABSORBENERGY, 1)
    target:setAbility(ITEM_ABILITY_SPEED, 20)
    target:setAbility(ITEM_ABILITY_MANASHIELD, 1)
    position:sendMagicEffect(CONST_ME_MAGIC_RED)
    return true
end

I can see attributes that are set inside items.xml
Code:
<item id="2400" article="a" name="magic sword">    
        <attribute key="showattributes" value="1" />
        <attribute key="description" value="It's the Sword of Valor." />
        <attribute key="weight" value="4200" />
        <attribute key="defense" value="35" />
        <attribute key="attack" value="48" />
        <attribute key="weaponType" value="sword" />
        <attribute key="extradef" value="3" />
    </item>

Idk if im doing something wrong or not. I see no errors.

Should i see updated description after i set ability on item through item:setAbility ?? Or you can only see those attributes that are hard coded in items.xml ?
 

Infernum

Senator
Joined
Feb 14, 2015
Messages
5,631
Solutions
559
Reaction score
3,846
I just tried that.
But still, im only seeing the default description without my attributes. Im using item action script to set ability on item like this:
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local position = player:getPosition()
    target:setAbility(ITEM_ABILITY_ABSORBPHYSICAL, 10)
    target:setAbility(ITEM_ABILITY_SKILL_SWORD, 5)
    target:setAbility(ITEM_ABILITY_MANAGAIN, 50)
    target:setAbility(ITEM_ABILITY_MANATICKS, 2000)
    target:setAbility(ITEM_ABILITY_CRITICALHITCHANCE, 50)
    target:setAbility(ITEM_ABILITY_CRITICALHITAMOUNT, 400)
    target:setAbility(ITEM_ABILITY_ABSORBENERGY, 1)
    target:setAbility(ITEM_ABILITY_SPEED, 20)
    target:setAbility(ITEM_ABILITY_MANASHIELD, 1)
    position:sendMagicEffect(CONST_ME_MAGIC_RED)
    return true
end

I can see attributes that are set inside items.xml
Code:
<item id="2400" article="a" name="magic sword">   
        <attribute key="showattributes" value="1" />
        <attribute key="description" value="It's the Sword of Valor." />
        <attribute key="weight" value="4200" />
        <attribute key="defense" value="35" />
        <attribute key="attack" value="48" />
        <attribute key="weaponType" value="sword" />
        <attribute key="extradef" value="3" />
    </item>

Idk if im doing something wrong or not. I see no errors.

Should i see updated description after i set ability on item through item:setAbility ?? Or you can only see those attributes that are hard coded in items.xml ?
the description should be updated no matter what
you're sure you have item.lua in /lib/core?
and restarted the server after setting luaItemDesc = true in config.lua
 
OP
OP
J

jakub742

New Member
Joined
May 1, 2010
Messages
81
Solutions
1
Reaction score
3
Location
Slovakia
the description should be updated no matter what
you're sure you have item.lua in /lib/core?
and restarted the server after setting luaItemDesc = true in config.lua
There is item.lua in /lib/core also luaItemDesc = true in config.lua (did not had that before creating a thread but after ur reply i inserted that line and tested and still nothing.

1620394500653.png1620394689045.png
 

InkofDeath

New Member
Joined
May 7, 2021
Messages
1
Reaction score
0
Compare your compat.lua file to the extension's compat.lua file. And item.lua to the extensions.

Item.lua
• line 112 setAuxFunctions() to line 590 (EOF)
• These are what dictates what is shown in the description whilst looking at an item when the luaItemDesc = true is present
• If you are missing the changes of the extension to show item abilities, then they will not appear

Additionally, go to:
and click on 'File Changes'. Compare what is different between each file and what you have currently. Or link a repo of your code for comparison.
 
Last edited:
OP
OP
J

jakub742

New Member
Joined
May 1, 2010
Messages
81
Solutions
1
Reaction score
3
Location
Slovakia
Compare your compat.lua file to the extension's compat.lua file.

Compat.lua
• line 112 setAuxFunctions() to line 590 (EOF)
• These are what dictates what is shown in the description whilst looking at an item when the luaItemDesc = true is present
• If you are missing the changes of the extension to show item abilities, then they will not appear

Additionally, go to:
and click on 'File Changes'. Compare what is different between each file and what you have currently. Or link a repo of your code for comparison.
i dont see any item-abilities related differences in compact.lua here is diff check. Here is my github
 

Infernum

Senator
Joined
Feb 14, 2015
Messages
5,631
Solutions
559
Reaction score
3,846
you should start over and create a pull request with the base as your fork with my code and pull all changes instead of doing it manually
 
Solution
OP
OP
J

jakub742

New Member
Joined
May 1, 2010
Messages
81
Solutions
1
Reaction score
3
Location
Slovakia
I pulled your item-abilities-updated branch and its working. I had to add premdays and lastday to accounts/players table because i wasnt able to login bcs of missing columns.

Code:
12:54 You see a magic sword (Atk:48, Def:35 +3, sword fighting +5, critical hit chance +50%, protection physical +10%, energy +1%, speed +10).
It can only be wielded properly by players of level 80 or higher.
It weighs 42.00 oz.
It's the Sword of Valor.

PogChamp thanks. Should i try merging the code with latest TFS ? or i can work with this branch ?
 
Top