• 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

Musaab

NoxOts
Premium User
Joined
May 13, 2010
Messages
177
Reaction score
74
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..
 
OP
OP
Musaab

Musaab

NoxOts
Premium User
Joined
May 13, 2010
Messages
177
Reaction score
74
Location
Sweden
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" />
 
OP
OP
Musaab

Musaab

NoxOts
Premium User
Joined
May 13, 2010
Messages
177
Reaction score
74
Location
Sweden
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?
 

Evil Puncker

prolonged absenteeism
TFS Developer
Joined
May 30, 2009
Messages
7,973
Solutions
206
Reaction score
3,813

Evil Puncker

prolonged absenteeism
TFS Developer
Joined
May 30, 2009
Messages
7,973
Solutions
206
Reaction score
3,813
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
 

Ascuas Funkeln

Rakkedo Game
Joined
Apr 14, 2013
Messages
515
Solutions
30
Reaction score
268
Location
Poland
GitHub
AscuasFunkeln
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.
 
OP
OP
Musaab

Musaab

NoxOts
Premium User
Joined
May 13, 2010
Messages
177
Reaction score
74
Location
Sweden
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:
Top