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

Best way to add description for item attribut? TFS 1.3 , LUA

Mr Noxi

Noxus Otserver
Joined
May 13, 2010
Messages
272
Solutions
3
Reaction score
94
Location
Sweden
Hey there!

Question!

Am adding attributes to items.xml exampel a Shield of honour, the attributes am trying to give the item is

Lua:
<attribute key="maxhitpointspercent" value="133" />
    <attribute key="maxmanapointspercent" value="133" />

My issue is why does the attribute not show when you "Look" at the item? And how come that some attributes can be shown automaticly like
Code:
<attribute key="skillsword" value="55" />

In case if the answer is "thats just how it is" how can i in a good way add the description of the item like
Lua:
<attribute key="description" value="Increase max HP 33%, max MP 33%,Leech Chance 3%" />

Ingame GIF cuz atm it does not look well done..
 
Make sure it is added into movements too
For sure, i have it also
Lua:
<movevent event="Equip" itemid="2517" slot="shield" level="0" function="onEquipItem" />
    <movevent event="DeEquip" itemid="2517" slot="shield" function="onDeEquipItem" />
 
Can i add all that code somewhere around same lines or dont matter? Because i see that i have a bit diffrent set up then this link has and then recompile just?
 
LOL, you weren't supposed to replace any code, I just showed the code responsible for the item descriptions that you need to add the part you want there
 
Hey there!

Question!

Am adding attributes to items.xml exampel a Shield of honour, the attributes am trying to give the item is

Lua:
<attribute key="maxhitpointspercent" value="133" />
    <attribute key="maxmanapointspercent" value="133" />

My issue is why does the attribute not show when you "Look" at the item? And how come that some attributes can be shown automaticly like
Code:
<attribute key="skillsword" value="55" />

In case if the answer is "thats just how it is" how can i in a good way add the description of the item like
Lua:
<attribute key="description" value="Increase max HP 33%, max MP 33%,Leech Chance 3%" />

Ingame GIF cuz atm it does not look well done..
Im good understand? U wanna do something like this?

pobrane.png

If you add health or mana to items, u wanna see it displayed same as other stuff like sword fighting etc?
In both case for armor items and weapons in item.cpp just add this stat what u want

Find
C++:
        if (it.abilities) {
            for (uint8_t i = SKILL_FIRST; i <= SKILL_LAST; i++) {
                if (!it.abilities->skills[i]) {
                    continue;
                }

And before it paste
C++:
s << std::endl << "";
        if (it.abilities) {
            if (it.abilities->stats[STAT_MAXHITPOINTSPERCENT]) {
                if (begin) {
                    begin = false;
                    s << "";
                } else {
                    s << "";
                }
                s << "HP%:  " << std::showpos << it.abilities->stats[STAT_MAXHITPOINTSPERCENT] << std::noshowpos << ' ';
            }
            s << std::endl << "";

Stats, abilities etc. u can find in enums.h and add what u want.
 
LOL, you weren't supposed to replace any code, I just showed the code responsible for the item descriptions that you need to add the part you want there
Ahh my bad, have a backup so np, miss understood u.
Post automatically merged:

<attribute key="showattributes" value="1" />
Dident help unfortunately, tried that before posting
Post automatically merged:

Im good understand? U wanna do something like this?

View attachment 54885

If you add health or mana to items, u wanna see it displayed same as other stuff like sword fighting etc?
In both case for armor items and weapons in item.cpp just add this stat what u want

Find
C++:
        if (it.abilities) {
            for (uint8_t i = SKILL_FIRST; i <= SKILL_LAST; i++) {
                if (!it.abilities->skills[i]) {
                    continue;
                }

And before it paste
C++:
s << std::endl << "";
        if (it.abilities) {
            if (it.abilities->stats[STAT_MAXHITPOINTSPERCENT]) {
                if (begin) {
                    begin = false;
                    s << "";
                } else {
                    s << "";
                }
                s << "HP%:  " << std::showpos << it.abilities->stats[STAT_MAXHITPOINTSPERCENT] << std::noshowpos << ' ';
            }
            s << std::endl << "";

Stats, abilities etc. u can find in enums.h and add what u want.
Something close, think about like an item gives +3 sword it shows arm: 10, maximum hp 5% direct in same line so it looks smooth but ur type works as well :) thx I will look into that
 
Last edited:
I allow myself to refresh the topic, because i need same thing.
Find
C++:
        if (it.abilities) {
            for (uint8_t i = SKILL_FIRST; i <= SKILL_LAST; i++) {
                if (!it.abilities->skills[i]) {
                    continue;
                }

And before it paste
C++:
s << std::endl << "";
        if (it.abilities) {
            if (it.abilities->stats[STAT_MAXHITPOINTSPERCENT]) {
                if (begin) {
                    begin = false;
                    s << "";
                } else {
                    s << "";
                }
                s << "HP%:  " << std::showpos << it.abilities->stats[STAT_MAXHITPOINTSPERCENT] << std::noshowpos << ' ';
            }
            s << std::endl << "";

Stats, abilities etc. u can find in enums.h and add what u want.

To which one? I found 2 same parts of code, at line 1024 and at 1182. I tried both options, and got errors (in both options):

1640714527387.png


Code screen:

1640714572057.png
 
I allow myself to refresh the topic, because i need same thing.


To which one? I found 2 same parts of code, at line 1024 and at 1182. I tried both options, and got errors (in both options):

View attachment 64256


Code screen:

View attachment 64257
What engine version u have?
U check "enums.h"? There u have list of attributes, if you dont have here "maxhitpointspercent" it will wont work, and looks you dont have it.
 
What engine version u have?
U check "enums.h"? There u have list of attributes, if you dont have here "maxhitpointspercent" it will wont work, and looks you dont have it.
TFS 1.4

I do have. I guess? Enums.h:
1640718983435.png

And maxhitpointspercent was just an example, cause OP needed that. For me, it is a lot of attrs, like maxhitpoints (flat), mana, etc, actually every attribute you can attach to the item.
 
TFS 1.4

I do have. I guess? Enums.h:
View attachment 64265

And maxhitpointspercent was just an example, cause OP needed that. For me, it is a lot of attrs, like maxhitpoints (flat), mana, etc, actually every attribute you can attach to the item.
OK this was for 1.2, there some differences in code... Paste original code if you can. And for working percents do
C++:
if (it.abilities->statsPercent[STAT_MAXHITPOINTS])
C++:
s << "HP%:  " << std::showpos << it.abilities->statsPercent[STAT_MAXHITPOINTS] << std::noshowpos << ' ';
instead of
C++:
if (it.abilities->stats[STAT_MAXHITPOINTSPERCENT])
 
Well it was just example, because OP asked for that and that code youve posted for him was about MAXHITPOINTSPERCENT. I just want to know how to make attributes (any, each, every - whatever) visible in item's description.
 
Back
Top