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

Lua How to show all my item attributes On Look ?

mRefaat

Marketing and Coding
Joined
Jan 18, 2014
Messages
856
Solutions
3
Reaction score
141
Location
Egypt
Hi,

Like the title say how i can do that?

for example :

Code:
    <item id="7899" article="a" name="magma coat">
        <attribute key="weight" value="2250"/>
        <attribute key="armor" value="11"/>   
        <attribute key="increasemagicpercent" value="110"/>       
        <attribute key="absorbPercentFire" value="8"/>
        <attribute key="absorbPercentIce" value="-8"/>
        <attribute key="slotType" value="body"/>
    </item>

and on look

Code:
21:08 You see a magma coat (Arm:11, protection fire +8%, ice -8%).
It can only be wielded properly by sorcerers and druids of level 50 or higher.
It weighs 22.50 oz.

how i can show the magic percent too and everything i add like maxhealthpoints, etc?

i use TFS 0.3.7 rev5916
 
Hey MoHameD Refaat,
You need to add an attribute key to the item in items.xml. This is the attribute key:
Code:
<attribute key="showattributes" value="1" />
So for example, this attribute key added to the magma coat will look like this:
Code:
<item id="7899" article="a" name="magma coat">
<attribute key="weight" value="2250"/>
<attribute key="armor" value="11"/>
<attribute key="increasemagicpercent" value="110"/>
<attribute key="absorbPercentFire" value="8"/>
<attribute key="absorbPercentIce" value="-8"/>
<attribute key="slotType" value="body"/>
<attribute key="showattributes" value="1" />
</item>
and that should show all the attributes.
 
Hey MoHameD Refaat,
You need to add an attribute key to the item in items.xml. This is the attribute key:
Code:
<attribute key="showattributes" value="1" />
So for example, this attribute key added to the magma coat will look like this:
Code:
<item id="7899" article="a" name="magma coat">
<attribute key="weight" value="2250"/>
<attribute key="armor" value="11"/>
<attribute key="increasemagicpercent" value="110"/>
<attribute key="absorbPercentFire" value="8"/>
<attribute key="absorbPercentIce" value="-8"/>
<attribute key="slotType" value="body"/>
<attribute key="showattributes" value="1" />
</item>
and that should show all the attributes.
Still nothing

Code:
21:56 You see a magma coat (Arm:11, protection fire +8%, ice -8%).
It can only be wielded properly by sorcerers and druids of level 50 or higher.
It weighs 22.50 oz.
ItemID: [7899].
Position: [X: 2010] [Y: 2030] [Z: 7].

BUMP ! Any help ?!
 
Last edited by a moderator:
I think this would need a massive refactoring in the sources for a minimal reward, so if you ever need some stat you'd better just stick it in the look of the an item that can show that attribute
Armor Items can support on look by default:
Armor/Protection
Critical Chance
A couple of skills like ML, club, sword, etc

Weapons can support many other things:
Range, attack, attack speed, speed(movement), etc

So even if you add an stat not available on look, it works, just won't be able to look into, HP and Mana also are not supported on look anywhere so adding those two wouldn't be a giga refactor, but you can just add into the description since are only two values
Let's say you want a helmet with attack speed, it's better to add it to a weapon and only allow it to be equipped to a certain vocation or something
Otherwise you'd need to refactor way too many things for it to be worth IMO

All of the above and other can be found on your item.cpp(list of supported attributes on look are on the Item::getDescription function)
Possible attributes can be found in items.cpp inside the loop for(xmlNodePtr itemAttributesNode ...

Maybe this can be done easily via lua but I'm not a big fan of doing frequent tasks like looking, looting, combat, etc, via scripting, never disconsider performance or it may be too late!
 
I think this would need a massive refactoring in the sources for a minimal reward, so if you ever need some stat you'd better just stick it in the look of the an item that can show that attribute
Armor Items can support on look by default:
Armor/Protection
Critical Chance
A couple of skills like ML, club, sword, etc

Weapons can support many other things:
Range, attack, attack speed, speed(movement), etc

So even if you add an stat not available on look, it works, just won't be able to look into, HP and Mana also are not supported on look anywhere so adding those two wouldn't be a giga refactor, but you can just add into the description since are only two values
Let's say you want a helmet with attack speed, it's better to add it to a weapon and only allow it to be equipped to a certain vocation or something
Otherwise you'd need to refactor way too many things for it to be worth IMO

All of the above and other can be found on your item.cpp(list of supported attributes on look are on the Item::getDescription function)
Possible attributes can be found in items.cpp inside the loop for(xmlNodePtr itemAttributesNode ...

Maybe this can be done easily via lua but I'm not a big fan of doing frequent tasks like looking, looting, combat, etc, via scripting, never disconsider performance or it may be too late!
Thanks man for replying, this issue fixed via source editing long time ago :)
 
Back
Top